Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756601AbbGGJVW (ORCPT ); Tue, 7 Jul 2015 05:21:22 -0400 Received: from mail-bl2on0120.outbound.protection.outlook.com ([65.55.169.120]:39552 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752729AbbGGJVN (ORCPT ); Tue, 7 Jul 2015 05:21:13 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Date: Tue, 7 Jul 2015 16:12:27 +0800 From: Shengjiu Wang To: Vinod Koul CC: , , Subject: Re: [PATCH] dmaengine: imx-sdma: Add device to device support Message-ID: <20150707081226.GA18136@shlinux2> References: <1435048974-23700-1-git-send-email-shengjiu.wang@freescale.com> <20150707042057.GH11002@localhost> <20150707052420.GA9703@shlinux2> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150707052420.GA9703@shlinux2> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11OLC013;1:jFbxDypbrPLyV2If2TzcwkBNPr7PkII9sqUiCsIiAFNEWO1lE8w0g53dDd7XvlVE5Gx8zF/tZBD4TAWB9yUcWA7cRve7i/btM22CHxWTyqieRRg2QE2X0o14CfUWb9979BMmpGEfkPeWH8WD5VX8PYmF8JbVYrvOl3tamL8NsWaEXHbp2TKGoAIR/0DgnAcxmaEzNfrpOYwpmEodgcS32Q+Kt3EPvmnZhP/ENIZJfxISok87iyamfRbeG3lc4cwq25g0OGs9rgKfki7NGJCr78nGeSPsb0Ndwsth4aR3kgVn8R2sXSpVgDbSqfulP2IISESvY1IRe8mtp3itPciUeDMVzCHuUWfE+gzWg7nEuJCO6BvNpeFme9ALN1OsNOHF0Hr7MzUBBezfOF4IWMvdvP6kfyVIzLiXk+9QBJVYUsDhRqxVU//iFejANlarSWTu X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(24454002)(51704005)(189002)(199003)(92566002)(33716001)(4001350100001)(23726002)(77096005)(97756001)(2950100001)(189998001)(46406003)(105606002)(76176999)(86362001)(104016003)(54356999)(33656002)(47776003)(50986999)(87936001)(77156002)(85426001)(6806004)(106466001)(83506001)(46102003)(110136002)(5001960100002)(62966003)(50466002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB286;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB286;2:0sOpWkYn7mSVUChbmmaaCleT6YUN1FxiwZ/GeprkFXJ0+wUN/Tibjji2w8lH5h1U;3:VCoiLCPLrWkBOad2UZEDxclX3H4DTNgwv/dnD2uZ+mhcR4xuuK+CKeL7KZE1Ki649SdjLcZKhn7WUBtZEjIXOH1rG9V9BYJPeUhc5kXFVHFBrwbbX0JG5IElkK7geDNsRE4PxpdX+r3X+7lQpPH3fRLm28ca73WhM/NIzJa7EFWd0A2Q3BWbomtGMyeCYVgvokp4MwJ7zMYmxQA/SnuE/KUxyXJqiz52nHiA1jCSVzM=;25:RSrNK1CIWCvf1NZxLxR/2QAUOSxiAu+pJzQvXTo7P6DSMRKSPKMNro3daURtPq07ia0+ex21wpbzE/iqp0/2GW6da3THqAv1BOhYgcvJbewczNOb3re93MDG/aNRNu0pWZi7fS0IYEKQBCdoaLErO3bsopfmj9NNhZ6mAkjLrDdCZHw1PYWZBum5+HPNfX3W2wKs/0OdEGqe00EfIryxhsNlk1SA6OYYBZ6S1+B8mp3YH/qpaD73Xpn+mxPn1HBgh9IuhXk9HcovADA+TNbi7g==;20:nTDpOgHf6CXoUgl0TkjVvVHqorg6XrBpcaLNNbI5ki/eMCYoaJA8xVjzrvu0EgDMez8R29kUbAiGi79nzNAWwG9Iz0zaQ0fqYgLSY0ol6WBx32uMdGAvu84atInr3bSOskd4Qy5RytmCjHw+GuyZC72LO+si/BK9rTNCVq2Yg++efNkdZ1gDwE5B4uDWv6sAOQWJ8S6/0jKmYth40bbL+mbEdNE0THbphlWno6/5WSUzG9OwGgJCRch7Wt8699nTbYOqzko1tO8CxHqqdM6Q8TH4rPPNs8RiWVqhQJ2X+ieJC+XAlUtJM+hd6ChfkvmeUabOH2ogBm+NJEnAIMuuIxCE0yWRntqktDu7rUY1etA= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB286; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY2PR03MB286;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB286; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB286;4:vbQxzLcBwW9OKpYCghgJrW1yXJe37toPM+oLuD9upFenhh63Fc4mICpC7iavQm90KQgd+sYQzkDKZu0JX6bJ0m8SA/j5CgOydeYgiUe+e5JgltEokTQAe9EAIWIJU0JNKwf6R/DhrFGlISj7lcpwuLVIgoJSSqPSIDufo0pFieBFIqgUq/WUoH3E0U8DzbbwHeHw2/fBBaHeysTDbZHbU4DCD/crVkWM1PEi/o1pcMC7qTxu3qmpzVEMlPFjGx0iso1MSrCbVyAIW8t8+hrkMIZzT3uqweD9bZsOhG1Jb+w= X-Forefront-PRVS: 0630013541 X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB286;23:53XuWEwOgu0S+TMFMEssf6/QUHYyUU6Lz8mqaBsjfRh0zn1CftuhkJeWZcN50eZokGec9U6kaXokXYqxxOYK4I0DHblHye47+ntlFwdcKUjoz62ixLWaRjOuqkjZpreTu86AFRUWJknTy0JsZiJ9Xud10OAhQLf/BVpJMhsXW3152UFveSOJafv7tiOINo3/zPt5NZX0wD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UMvBXRLgP0HTqsltFCaw5CItA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2015 09:21:09.0130 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB286 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4291 Lines: 117 On Tue, Jul 07, 2015 at 01:24:20PM +0800, Shengjiu Wang wrote: > Hi vinod > > On Tue, Jul 07, 2015 at 09:50:57AM +0530, Vinod Koul wrote: > > On Tue, Jun 23, 2015 at 04:42:54PM +0800, Shengjiu Wang wrote: > > > +static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac) > > > +{ > > > + struct sdma_engine *sdma = sdmac->sdma; > > > + > > > + int lwml = sdmac->watermark_level & 0xff; > > > + int hwml = (sdmac->watermark_level >> 16) & 0xff; > > > + > > > + if (sdmac->event_id0 > 31) { > > > + sdmac->event_mask[0] |= 0; > > > + __set_bit(28, &sdmac->watermark_level); > > why not use set_bit(), you are modifying driver memory > Original driver all use the __set_bit. do you think we need to change > all the __set_bit to set_bit? And from the header file "arch/arm/include/asm > /bitops.h", the set_bit is same as __set_bit. > > > > > > > + sdmac->event_mask[1] |= > > > + BIT(sdmac->event_id0 % 32); > > and then why not use set_bit() here too? > > > > > + } else { > > > + sdmac->event_mask[0] |= 0; > > > + sdmac->event_mask[1] |= > > > + BIT(sdmac->event_id0 % 32); > > > + } > > > + if (sdmac->event_id1 > 31) { > > > + sdmac->event_mask[1] |= 0; > > > + __set_bit(29, &sdmac->watermark_level); > > > + sdmac->event_mask[0] |= > > > + BIT(sdmac->event_id1 % 32); > > > + } else { > > > + sdmac->event_mask[1] |= 0; > > > + sdmac->event_mask[0] |= > > > + BIT(sdmac->event_id1 % 32); > > > + } > > pattern for eventidX is repeated, also in that we can make generic macro to > > handle and reduce code size > I will change this. > > > > > + > > > + /* > > > + * If LWML(src_maxburst) > HWML(dst_maxburst), we need > > > + * swap LWML and HWML of INFO(A.3.2.5.1), also need swap > > > + * r0(event_mask[1]) and r1(event_mask[0]). > > > + */ > > > + if (lwml > hwml) { > > > + sdmac->watermark_level &= ~0xff00ff; > > Magic number? > > > > > static int sdma_config_channel(struct dma_chan *chan) > > > { > > > struct sdma_channel *sdmac = to_sdma_chan(chan); > > > @@ -869,6 +945,12 @@ static int sdma_config_channel(struct dma_chan *chan) > > > sdma_event_enable(sdmac, sdmac->event_id0); > > > } > > > > > > + if (sdmac->event_id1) { > > > + if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events) > > > + return -EINVAL; > > > + sdma_event_enable(sdmac, sdmac->event_id1); > > > + } > > > + > > > switch (sdmac->peripheral_type) { > > > case IMX_DMATYPE_DSP: > > > sdma_config_ownership(sdmac, false, true, true); > > > @@ -887,19 +969,21 @@ static int sdma_config_channel(struct dma_chan *chan) > > > (sdmac->peripheral_type != IMX_DMATYPE_DSP)) { > > > /* Handle multiple event channels differently */ > > > if (sdmac->event_id1) { > > > - sdmac->event_mask[1] = BIT(sdmac->event_id1 % 32); > > > - if (sdmac->event_id1 > 31) > > > - __set_bit(31, &sdmac->watermark_level); > > > - sdmac->event_mask[0] = BIT(sdmac->event_id0 % 32); > > > - if (sdmac->event_id0 > 31) > > > - __set_bit(30, &sdmac->watermark_level); > > > - } else { > > > + if (sdmac->peripheral_type == IMX_DMATYPE_ASRC_SP || > > > + sdmac->peripheral_type == IMX_DMATYPE_ASRC) > > > + sdma_set_watermarklevel_for_p2p(sdmac); > > > + } else > > > __set_bit(sdmac->event_id0, sdmac->event_mask); > > > - } > > > + > > > /* Watermark Level */ > > > sdmac->watermark_level |= sdmac->watermark_level; > > > /* Address */ > > > - sdmac->shp_addr = sdmac->per_address; > > > + if (sdmac->direction == DMA_DEV_TO_DEV) { > > Okay the direction is depreciated, so can you store both source and > > destination and use them based on direction in prepare() > > > > Also I see driver is not doing this, so while at it, can you fix this is > > current code as well > > > which prepare() do you mean? sdma_prep_dma_cyclic, sdma_prep_slave_sg? > I exchange the meaning of per_address and per_address2 for p2p. So can remove the direction checking here. > > -- > > ~Vinod > > > > I have sent a V2 patch for review. Thanks. > best regards > wang shengjiu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/