Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753837AbbGGGdP (ORCPT ); Tue, 7 Jul 2015 02:33:15 -0400 Received: from mail-bl2on0111.outbound.protection.outlook.com ([65.55.169.111]:12415 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753291AbbGGGdI (ORCPT ); Tue, 7 Jul 2015 02:33:08 -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 13:24:22 +0800 From: Shengjiu Wang To: Vinod Koul CC: , , Subject: Re: [PATCH] dmaengine: imx-sdma: Add device to device support Message-ID: <20150707052420.GA9703@shlinux2> References: <1435048974-23700-1-git-send-email-shengjiu.wang@freescale.com> <20150707042057.GH11002@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150707042057.GH11002@localhost> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD033;1:a4ml0WqXClO4LIXeJ8DI/HgbQJ0s7ifD2nUEVm6B4qTBFynyxa+3KcDn5mcV+JHVj6OSCUObS3QIA/hdgbsz/w8ucIzPfkmJotzTPsH9dQ3VNeEZsTjga6RgSTEeNO22s+ZSOGj9w9IS0c81Z/iAhqIONexCS0o7FXRXWY56P0MtQ88blCMDgwVfP0XhG6qiEnMtVFgKhbQBN76pc4UhAFXK21aVavgtduTyWefO1Yay9HzBBoAplrm5s+ONVnfU1rT1fQyic1bDkMEupBlfwGVoAzhCGGeEl1+2id/4hz/DFTzXpdO5t83p1nekz4/C4Ng+jRMRfOwAWtWaqc3mRg== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(51704005)(24454002)(86362001)(23726002)(50986999)(2950100001)(77096005)(54356999)(110136002)(104016003)(97756001)(76176999)(87936001)(5001960100002)(189998001)(6806004)(106466001)(33716001)(83506001)(85426001)(4001350100001)(46406003)(105606002)(92566002)(77156002)(47776003)(33656002)(50466002)(46102003)(62966003);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR03MB604;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB604;2:guX5ogxon8EiUwXvE2rZq4QtDpX1a9yaO4UFt6QQQbeoB2iqH5JtLKBg5mhzXDxJ;3:vO9ichEHbLRbal+F1gvh0gn4oF//A7t9WXXFm2fXSmXprplcqq6bRHtWVfVec1/VBMDQUDx2aPwVhn1x572S3I29k8lrp8uEV/rdywL9gdTolD8ZXOVxZzorYS6EXY1X0p6YlKNJI/oUPgeChyQA47IU+QeZaDIYFVEhui+0n10TDI6m8cVaTFeMNfspazQTxjEQgYFRMUiN0rAuPgFTi8KkGyJFY69cZoiIg2RQkLM=;25:JNiGqmUfTdCS1qki48bb7ZHCDp3uIvEntlUcURRuDwnP7YHa2HOyNWII9i7XLy+oEDByLafKP2TgP/jsjW3nLeEyMjeHdnl7bt4ynvap9ZajpbEizj7WHgfxR5FIj9HnE556s/u4AEzK9VtXlVn0dJgvBSqvZ+ehu/WUVVohsrjJ15ZPxN4JchX5w9WwZmy4KfNOFMHfbFlw4iwTbTYwHtt2LgCs6Y+HzuRCXwXqb7MY6CoI8N3+RLZvrFVl4d23CUfUxa30GNx3ZfetrfhBSPPSpQ4YXl92WL0TLGVui1s=;20:KhBFMLF6USIoh3vE8wa3dmJG0jAk+eTdtN7h3Bp5mHqBPTGiPc+5pDetZL4lqSxCpWswAReE6ulfyXruzAJi3o0wfOCjcD2TyRPAQDM2mqMZmmwdKqtyKtJ3g0EI+JFfO/iz6Pa+4nq23DJ9tsgh22pWCxE243MU2D2u+sWjQCR11tBbOvoDcZqYeRYkPOpBLgXzMLo/zL3WSEHb1FCO4t9dirLwKiC8vgrNz9dZRiuAs8qMSOUzkGBcu20i2J6HQOpnhUWzNU0DcZYDOXDwEAmGrwWH3Sl97Onaxq9Hi1BsdPmA6vKDCBxJF7hyAx9Afnx5H2xDWa8NqjwuPixzWBtJdkn/cmj/LgthT1108ek= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB604; 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:BL2PR03MB604;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB604; X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB604;4:JXWTIYeIhwmyCekuJcmKEw+RisMkQhkBRhl9njU37uWbaGmMS6evVFRrAq8zw2Eqf7JQxQoVPNcbAAUmbl32iZhAs6lPLW6jD02sGNnCIcFM8XzFrU/MJiMmtontAY1rAv9HWerh/XDmHwOYrVb9T231Wi2iYYVbXOUaaXbMKa+JonzPOMZqmf7EVTGOVELGku7K8FNxWvjeNKhHhwTcXGLd7+CnpUzKdbqipgEqR5iIPUwNPC/uYtNA9sdW5E9QT6SWe7+hhe8prE+wXgAo68ORSlMNdfpwhuU7f9sY7xk= X-Forefront-PRVS: 0630013541 X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB604;23:D9FEMwDL/qiWgAsyQ00/FUC1MZYONJgunfXX5wkF6soaxxJtYjmRVgRIXTCBV/m1VkRI1CRLfYk173i2zL0GdWDdBAHKCQs6YcMLqCybg+5TNAqdEjyHq9s+rAZr/r1JG6Hc1aWWXPzhNbdGE/mEeCJqQvdMjMckwqJLo2Ov6NOpVCCX7RIM9D4hEtOmFTUu7N/cWOAVhj9icRUUc+jqap6ml9C2r7iZ99rXcMZ6xeyNvq0ifaGSGO9PJ5Yb3NizPAx2slkxyLVwoTQVbydUmMuEOnz3cmpRAZWfuvK6HGYKyvgRvsvfpz6I8mYE28m7c6k4ZCLZnh4mf9ZlP1b0A0NS8buFh5+f60c/1rye0b4Whv1/LxKiFE7LIHCXShQsJbRfBp8otdmcVbwEEGd0zqrFvgTJIuGpLOnD5ao02uoC9Z92q+vnxtDgldBejyw4jbi69MqnqMhTH3JthgUPH3VPD2HX8A0tmowkfDwDSu8a0phQPz5lkjmBuaOYudfgNK0S71NGUy4QxyAYsK3r8wUaU+PFRcxpan3rutxo3jfDyBQptqsx+sn9mF15tzeuI4NtsGnKRnh9FgTldk/B7scE7DnrNXHjPlASK+2UrNgac/3MzuLBDBgEiBHNzWiOjCNYYSzh6EaETiDBccDkgL8xF+Ukd2fU2aJgIPz/Y7n7W+lkgaFHx3TaZDTnmL4mehUwo9u8UEH0uh4LUAPkAzS9Mb03YQsfaiwYIdEQVkFDDyCfz3XkMI9xFLgcZeFSIXvtH41UE3dURj1eb9TJDILI2g3R26qf2Icsdq1d3GEDXjk/HI8hsu3NBmymVEBmVG7IOhdeJ2SEnOxsQaKr5Ime6rUJCD3yrnSjrdD4ODDFPn+J+usyKHKbJOTKn9Md X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB604;5:7rC4fntbQiUq8/1cUe54KpylQEbimDlS9ptL5ZiHnUb+lc81odsFmEBQZWd8e7bmhI1gZxzFHFYgG6AXChgGLq2PpC/1TboPjiS3Cm5NVsiUnXPU5XaFYY6WpTU+deMNcvJjuGc3V/rJATVXfApNdg==;24:LRFZGOtYm2xMrUjy64W3T+kRsWCfk3SXPTkmMAos64fW0ADZRi0SZwvAXzUTjvno1i/Q2it4FeMIFvkd9X81H82TVwEvbKMLOyDl1hge0nE=;20:VZFspbpZ1jgFqcddi5+mjV+hBemooISaXvaTsRSD8i559V8yv2TwRsr8yUnsodwxwWyRgt/sKwd0c2oPwGVHDQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2015 06:33:04.5283 (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: BL2PR03MB604 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3863 Lines: 112 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? > -- > ~Vinod > 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/