Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756914AbbGQHQW (ORCPT ); Fri, 17 Jul 2015 03:16:22 -0400 Received: from mail-bn1bon0131.outbound.protection.outlook.com ([157.56.111.131]:13484 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751300AbbGQHQU (ORCPT ); Fri, 17 Jul 2015 03:16:20 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Date: Fri, 17 Jul 2015 14:07:02 +0800 From: Shengjiu Wang To: Vinod Koul CC: , , Subject: Re: [PATCH V2] dmaengine: imx-sdma: Add device to device support Message-ID: <20150717060659.GA26704@shlinux2> References: <20150710075807.GB836@localhost> <20150710075836.GB14762@shlinux2> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150710075836.GB14762@shlinux2> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD012;1:qnSWB/Lo8wSC20Yqu8XFyM0L50l9RVWPb9IDW8N3xktiQz8P2gqx6JHtNcNVkQ/FelVQzT/NRN7Ll2t1Numk21O6ScI/3L4VLLz0rtwzKlc11defUFuGdYGuAe1bQw3+Fj3Ujxx+B9JRpCW6HmiQMey0HTJA5s6Gb5ScPPo/sRotLwqNCfTwQAxbKiq3ErVQ2mQoVwwO7hef4EKvf4ivQk66aSnFJ6RqxpcBts59rPSDXaCZ5ysmlo5YHcID/iX9z9G/JX7d2GFHUX9Gopxmu2GqhDEvO5xztdw6FaIBccrKRY2sa9o1gQH3XYXCGp3ZJzgbwiZMckcqReFo0Z8XwNshnJ/ZMRgs3noHAqO5cpoiBJN7oNhQsGWlzDUVTY0/apnZ+0NiIRbJo+0bTrt0LX8WFm33eQkHHzG4wPdwEh+7t9+PPAdhO0CgbeWGTDLK X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(24454002)(189002)(106466001)(2950100001)(77156002)(23726002)(50466002)(105606002)(83506001)(86362001)(62966003)(85426001)(76176999)(50986999)(54356999)(189998001)(5001920100001)(33656002)(46102003)(4001350100001)(6806004)(92566002)(97756001)(33716001)(110136002)(104016003)(77096005)(87936001)(5001960100002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB607;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB607;2:VDZHPsGTWIc3lEob9exSYGo575IL9Q7Gofu9BCLHDSLCg0BexOzr/+Z0+ycokukN;3:5LKyoiCqrv6cXwY+cr5dKBHcFpMTq3gQS0nL7h6gDyz8UK5Q01mV+qVIw0sJT8wezfCKl14K3MoFTZxs5nTGS5XO63MkSFXnpbaz+rkKe4tEznyUW9fH/XclicImXXF1t3NbWoCbrLhJnCdrRDjhHMgd/yGc3lSrgvrvhia+AszaBYyqC5jdHoT2aVjchXbGmgdt67Isr8hl2lfSgCflQxlCW0lH6hteT9kx72/jGRM=;25:Zh9+ousTanwV8q2mgZsI11XuoYRlim6XlB7Em1SB3E21Y0A4JHWMvzgln49CfqM27qJL1ySwkFhUz2hAqD/cD9PiixnDMQxsJEPphtDbebIj2xfBXzP/5cOlUIqXckObL6GjuVlJD2/BK+cExIOorkTH6DJ4FOyBzojLv+1p2gKHWQtVD7+CaY8n1sx9QheILBN6tMrsGSkASY64yKLBHnLy5o1LaYC87QTHFAQleNAEPl8mD2GZHHW2fDrplCqfmvtozPbg8E1nXNBQBlzlHA==;20:E1zZK3JVkYjvZzieQ7E7aXy4cDfgbEjwMJfNExmSipZ7PaC6gFtRivNmjQcqQopahVN+n+RDH534Wbl+uSsGXgAQ9HC/BqURlpmLfR4TUUgkzs1lAUwcy+/J6su92aqZjspeQ4owgrY9qsFv+vMWyJ4tJRqhyvF5cPPdZc7C+DPVRKPQg61H7zbTATpNcddbJ0sHcticvdo6MWp1Cup3AHZzr/QwUv9pYAqaKw31Zdt451c2xycoKfOxS0IO3ZEmN0RmuA8cPFR7PbhSQO2fJgiE58fiOi6c2NSl3oSmTEJNI1JkR+Q7EZ1yrryn7DgcdJZmJthXDq3Mhh4dXzhKzvNlQ1j9dhy6V32k0UvD/KY= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB607; BY2PR03MB607: X-MS-Exchange-Organization-RulesExecuted 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:BY2PR03MB607;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB607; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB607;4:pPawM3b8RU9EdLAqZi8XZx6TDrtcYqLS1eeGE6+1wQmR62f+emcqD6KRL+MZ3w+x10R+XUGwhDZv5haSfj3JvWojx3GpMlPVRs3CO05OzsHW+bPyQXSTyeZtWOmslrHMfoHgTDygdSngV8d2ilnhzLFRqZTx7Mg+6brIIyfOl1doslyg7Ri1VRfVVFFnRcyTMNAADNMe9YW6qGt8fCZXyAAvFkqxtIuScilcknbK5NPeVUzzJKDrf8GyZpCpHK2Gj3XBwNqNN3bBsI5EPwFkeFaUtAegmyJ9fnVkqCNekLs= X-Forefront-PRVS: 06400060E1 X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB607;23:L4EMYVPBBU8gl+t3xCTQD/myI6rnHU+b7I4K3ZU64NLvW/yYR2KtbOw2r9lfcWYHLl133OBv+yUNbnX8ErgCerRjFGCkGgt5EZBclhJPE+dCd8IVPSZ37o3Zh08X8P25Flzo+vfvbOOdLz6V7Hwg/fRQzUDneSK9Fledtc7L1Yvm4bT0iFO7mL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aGi8oAVOazS6yQw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2015 07:16:17.0036 (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.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB607 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4735 Lines: 124 On Fri, Jul 10, 2015 at 03:58:36PM +0800, Shengjiu Wang wrote: > On Fri, Jul 10, 2015 at 01:28:07PM +0530, Vinod Koul wrote: > > On Tue, Jul 07, 2015 at 05:20:04PM +0800, Shengjiu Wang wrote: > > > > > +/* > > > + * p_2_p watermark_level description > > > + * Bits Name Description > > > + * 0-7 Lower WML Lower watermark level > > > + * 8 PS 1: Pad Swallowing > > > + * 0: No Pad Swallowing > > > + * 9 PA 1: Pad Adding > > > + * 0: No Pad Adding > > > + * 10 SPDIF If this bit is set both source > > > + * and destination are on SPBA > > > + * 11 Source Bit(SP) 1: Source on SPBA > > > + * 0: Source on AIPS > > > + * 12 Destination Bit(DP) 1: Destination on SPBA > > > + * 0: Destination on AIPS > > > + * 13-15 --------- MUST BE 0 > > > + * 16-23 Higher WML HWML > > > + * 24-27 N Total number of samples after > > > + * which Pad adding/Swallowing > > > + * must be done. It must be odd. > > > + * 28 Lower WML Event(LWE) SDMA events reg to check for > > > + * LWML event mask > > > + * 0: LWE in EVENTS register > > > + * 1: LWE in EVENTS2 register > > > + * 29 Higher WML Event(HWE) SDMA events reg to check for > > > + * HWML event mask > > > + * 0: HWE in EVENTS register > > > + * 1: HWE in EVENTS2 register > > > + * 30 --------- MUST BE 0 > > > + * 31 CONT 1: Amount of samples to be > > > + * transferred is unknown and > > > + * script will keep on > > > + * transferring samples as long as > > > + * both events are detected and > > > + * script must be manually stopped > > > + * by the application > > > + * 0: The amount of samples to be > > > + * transferred is equal to the > > > + * count field of mode word > > > + */ > > > +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; > > > + > > > + __set_bit(sdmac->event_id0 % 32, &sdmac->event_mask[1]); > > > + __set_bit(sdmac->event_id1 % 32, &sdmac->event_mask[0]); > > > + > > > + if (sdmac->event_id0 > 31) > > > + __set_bit(28, &sdmac->watermark_level); > > > + > > > + if (sdmac->event_id1 > 31) > > > + __set_bit(29, &sdmac->watermark_level); > > > + > > > + /* > > > + * 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; > > > + sdmac->watermark_level |= hwml; > > > + sdmac->watermark_level |= lwml << 16; > > > + swap(sdmac->event_mask[0], sdmac->event_mask[1]); > > so typical practice is to define macros for these. For example above can be > > defined as > > #define SDMA_WATERMARK_LWML BIT(X) > > #define SDMA_WATERMARK_PA BIT(Y) > > > > Then here you can say > > sdmac->watermark_level &= SDMA_WATERMARK_PA | .... > > > > That way it is easier to read, review and maintain > > > > > > > + } > > > + > > > + if (sdmac->per_address2 >= sdma->spba_start_addr && > > > + sdmac->per_address2 <= sdma->spba_end_addr) > > > + __set_bit(11, &sdmac->watermark_level); > > > + > > > + if (sdmac->per_address >= sdma->spba_start_addr && > > > + sdmac->per_address <= sdma->spba_end_addr) > > > + __set_bit(12, &sdmac->watermark_level); > > > + > > > + __set_bit(31, &sdmac->watermark_level); > > All these and few more below will look much better by have defines above > > > > > @@ -1221,6 +1311,14 @@ static int sdma_config(struct dma_chan *chan, > > > sdmac->watermark_level = dmaengine_cfg->src_maxburst * > > > dmaengine_cfg->src_addr_width; > > > sdmac->word_size = dmaengine_cfg->src_addr_width; > > > + } else if (dmaengine_cfg->direction == DMA_DEV_TO_DEV) { > > > + sdmac->per_address2 = dmaengine_cfg->src_addr; > > > + sdmac->per_address = dmaengine_cfg->dst_addr; > > > + sdmac->watermark_level = > > > + dmaengine_cfg->src_maxburst & 0xff; > > > + sdmac->watermark_level |= > > > + (dmaengine_cfg->dst_maxburst & 0xff) << 16; > > > + sdmac->word_size = dmaengine_cfg->dst_addr_width; > > Please fix this as well > > > I will refine this patch and send V3 for review. Thanks > > best regards > wang shengjiu > > -- > > ~Vinod Hi Vinod V3 for this patch has been sent, please 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/