Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757768AbcCCR1O (ORCPT ); Thu, 3 Mar 2016 12:27:14 -0500 Received: from mail-cys01nam02on0070.outbound.protection.outlook.com ([104.47.37.70]:55904 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753817AbcCCR1M convert rfc822-to-8bit (ORCPT ); Thu, 3 Mar 2016 12:27:12 -0500 X-Greylist: delayed 892 seconds by postgrey-1.27 at vger.kernel.org; Thu, 03 Mar 2016 12:27:12 EST Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Appana Durga Kedareswara Rao To: Vinod Koul CC: "dan.j.williams@intel.com" , Michal Simek , Soren Brinkmann , "moritz.fischer@ettus.com" , "laurent.pinchart@ideasonboard.com" , "luis@debethencourt.com" , Anirudha Sarangi , "dmaengine@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v3 4/4] dmaengine: xilinx_vdma: Use readl_poll_timeout instead of do while loop's Thread-Topic: [PATCH v3 4/4] dmaengine: xilinx_vdma: Use readl_poll_timeout instead of do while loop's Thread-Index: AQHRcJ6gBbXNJ5Fw60itXaDlZtAwW59HW7uAgAChRQA= Date: Thu, 3 Mar 2016 17:12:13 +0000 Message-ID: References: <1456495434-11722-1-git-send-email-appanad@xilinx.com> <1456495434-11722-4-git-send-email-appanad@xilinx.com> <20160303152957.GM11154@localhost> In-Reply-To: <20160303152957.GM11154@localhost> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.23.229.5] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22168.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(377454003)(13464003)(189002)(24454002)(199003)(2906002)(97756001)(55846006)(92566002)(5250100002)(5003600100002)(19580395003)(189998001)(5004730100002)(15975445007)(2920100001)(2900100001)(110136002)(50466002)(23726003)(106116001)(4326007)(6116002)(102836003)(63266004)(2950100001)(19580405001)(106466001)(47776003)(586003)(46406003)(50986999)(76176999)(54356999)(6806005)(33656002)(1096002)(5008740100001)(86362001)(11100500001)(1220700001)(81166005)(107986001)(422495003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1NAM02HT073;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-MS-Office365-Filtering-Correlation-Id: 28866483-5722-4a0c-991e-08d34386f938 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501002);SRVR:CY1NAM02HT073; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13015025)(13018025)(13024025)(8121501046)(5005006)(13017025)(13023025)(10201501046)(3002001);SRVR:CY1NAM02HT073;BCL:0;PCL:0;RULEID:;SRVR:CY1NAM02HT073; X-Forefront-PRVS: 0870212862 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2016 17:12:16.9973 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT073 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3597 Lines: 113 Hi Vinod, > -----Original Message----- > From: dmaengine-owner@vger.kernel.org [mailto:dmaengine- > owner@vger.kernel.org] On Behalf Of Vinod Koul > Sent: Thursday, March 03, 2016 9:00 PM > To: Appana Durga Kedareswara Rao > Cc: dan.j.williams@intel.com; Michal Simek; Soren Brinkmann; Appana Durga > Kedareswara Rao; moritz.fischer@ettus.com; > laurent.pinchart@ideasonboard.com; luis@debethencourt.com; Anirudha > Sarangi; dmaengine@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > linux-kernel@vger.kernel.org > Subject: Re: [PATCH v3 4/4] dmaengine: xilinx_vdma: Use readl_poll_timeout > instead of do while loop's > > On Fri, Feb 26, 2016 at 07:33:54PM +0530, Kedareswara rao Appana wrote: > > > static void xilinx_vdma_halt(struct xilinx_vdma_chan *chan) { > > - int loop = XILINX_VDMA_LOOP_COUNT; > > + int err = 0; > > + u32 val; > > > > vdma_ctrl_clr(chan, XILINX_VDMA_REG_DMACR, > > XILINX_VDMA_DMACR_RUNSTOP); > > > > /* Wait for the hardware to halt */ > > - do { > > - if (vdma_ctrl_read(chan, XILINX_VDMA_REG_DMASR) & > > - XILINX_VDMA_DMASR_HALTED) > > - break; > > - } while (loop--); > > + err = xilinx_vdma_poll_timeout(chan, XILINX_VDMA_REG_DMASR, val, > > + (val & XILINX_VDMA_DMASR_HALTED), 0, > > + XILINX_VDMA_LOOP_COUNT); > > > > - if (!loop) { > > + if (err) { > > dev_err(chan->dev, "Cannot stop channel %p: %x\n", > > chan, vdma_ctrl_read(chan, > XILINX_VDMA_REG_DMASR)); > > chan->err = true; > > @@ -576,18 +579,17 @@ static void xilinx_vdma_halt(struct > xilinx_vdma_chan *chan) > > */ > > static void xilinx_vdma_start(struct xilinx_vdma_chan *chan) { > > - int loop = XILINX_VDMA_LOOP_COUNT; > > + int err = 0; > > why is this initialization required here and other places? Yes initialization is not required on the other mail you said you already applied this patch series. Will send a separate patch to fix it. Regards, Kedar. > > > + u32 val; > > > > vdma_ctrl_set(chan, XILINX_VDMA_REG_DMACR, > > XILINX_VDMA_DMACR_RUNSTOP); > > > > /* Wait for the hardware to start */ > > - do { > > - if (!(vdma_ctrl_read(chan, XILINX_VDMA_REG_DMASR) & > > - XILINX_VDMA_DMASR_HALTED)) > > - break; > > - } while (loop--); > > + err = xilinx_vdma_poll_timeout(chan, XILINX_VDMA_REG_DMASR, val, > > + !(val & XILINX_VDMA_DMASR_HALTED), 0, > > + XILINX_VDMA_LOOP_COUNT); > > > > - if (!loop) { > > + if (err) { > > dev_err(chan->dev, "Cannot start channel %p: %x\n", > > chan, vdma_ctrl_read(chan, > XILINX_VDMA_REG_DMASR)); > > > > @@ -754,21 +756,17 @@ static void xilinx_vdma_complete_descriptor(struct > xilinx_vdma_chan *chan) > > */ > > static int xilinx_vdma_reset(struct xilinx_vdma_chan *chan) { > > - int loop = XILINX_VDMA_LOOP_COUNT; > > + int err = 0; > > u32 tmp; > > > > vdma_ctrl_set(chan, XILINX_VDMA_REG_DMACR, > XILINX_VDMA_DMACR_RESET); > > > > - tmp = vdma_ctrl_read(chan, XILINX_VDMA_REG_DMACR) & > > - XILINX_VDMA_DMACR_RESET; > > - > > /* Wait for the hardware to finish reset */ > > - do { > > - tmp = vdma_ctrl_read(chan, XILINX_VDMA_REG_DMACR) & > > - XILINX_VDMA_DMACR_RESET; > > - } while (loop-- && tmp); > > + err = xilinx_vdma_poll_timeout(chan, XILINX_VDMA_REG_DMACR, tmp, > > + !(tmp & XILINX_VDMA_DMACR_RESET), 0, > > + XILINX_VDMA_LOOP_COUNT); > > > > - if (!loop) { > > + if (err) { > > > > -- > ~Vinod > -- > To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body > of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html