From patchwork Mon Aug 15 11:10:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 9280797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA6ED60467 for ; Mon, 15 Aug 2016 11:10:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AD7F28B9C for ; Mon, 15 Aug 2016 11:10:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EC6828BA9; Mon, 15 Aug 2016 11:10:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63FBD28B9C for ; Mon, 15 Aug 2016 11:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752328AbcHOLKk (ORCPT ); Mon, 15 Aug 2016 07:10:40 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:33922 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752455AbcHOLKj (ORCPT ); Mon, 15 Aug 2016 07:10:39 -0400 Received: from us02secmta2.synopsys.com (us02secmta2.synopsys.com [10.12.235.98]) by smtprelay.synopsys.com (Postfix) with ESMTP id 6401F10C121D; Mon, 15 Aug 2016 04:10:38 -0700 (PDT) Received: from us02secmta2.internal.synopsys.com (us02secmta2.internal.synopsys.com [127.0.0.1]) by us02secmta2.internal.synopsys.com (Service) with ESMTP id 56D4955F13; Mon, 15 Aug 2016 04:10:38 -0700 (PDT) Received: from mailhost.synopsys.com (unknown [10.13.184.66]) by us02secmta2.internal.synopsys.com (Service) with ESMTP id 1A48D55F02; Mon, 15 Aug 2016 04:10:38 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 049A5900; Mon, 15 Aug 2016 04:10:38 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id DD6D88FF; Mon, 15 Aug 2016 04:10:37 -0700 (PDT) Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 15 Aug 2016 04:10:37 -0700 Received: from DE02WEMBXB.internal.synopsys.com ([fe80::95ce:118a:8321:a099]) by DE02WEHTCA.internal.synopsys.com ([::1]) with mapi id 14.03.0266.001; Mon, 15 Aug 2016 13:10:35 +0200 From: Eugeniy Paltsev To: "andriy.shevchenko@linux.intel.com" CC: "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "viresh.kumar@linaro.org" , "Nelson.Pereira@synopsys.com" , "vinod.koul@intel.com" , "linux-snps-arc@lists.infradead.org" Subject: Re: Wrong "nollp" DW DMAC parameter value on ARC SDP. Thread-Topic: Wrong "nollp" DW DMAC parameter value on ARC SDP. Thread-Index: AQHR9G/6s4R1NpyYYUGbb0oI+xybdaBFBtwAgAAruACAAAkEAIAEhUoA Date: Mon, 15 Aug 2016 11:10:34 +0000 Message-ID: <1471259434.21247.47.camel@synopsys.com> References: <1470988994.21247.33.camel@synopsys.com> <1470999584.4887.94.camel@linux.intel.com> <1471008972.21247.40.camel@synopsys.com> <1471010908.4887.100.camel@linux.intel.com> In-Reply-To: <1471010908.4887.100.camel@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.14.112] Content-ID: MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 2016-08-12 at 17:08 +0300, Andy Shevchenko wrote: > On Fri, 2016-08-12 at 13:36 +0000, Eugeniy Paltsev wrote: > >  > > On Fri, 2016-08-12 at 13:59 +0300, Andy Shevchenko wrote: > > >  > > >  > > > On Fri, 2016-08-12 at 08:03 +0000, Eugeniy Paltsev wrote: > > > >  > > > >  > > > >  > > > > Hi, > > > >  > > > > "nollp" parameter defines if DW DMAC channel supports multi > > > > block > > > > transfer or not. > > > >  > > > > It is calculated in runtime, but differently depending on on > > > > availability of pdata. If pdata is absent "nollp" is calculated > > > > using > > > > autoconfig hardware registers. Otherwise "nollp" is calculated > > > > using > > > > the next code construction: > > > > channel_writel(dwc, LLP, DWC_LLP_LOC(0xffffffff)); > > > > dwc->nollp = DWC_LLP_LOC(channel_readl(dwc, LLP)) == 0; > > > > channel_writel(dwc, LLP, 0); > > > >  > > > > I realized that these methods give different results. > > > > For example on ARC AXS101 SDP in case of using autoconfig > > > > "nollp" > > > > was > > > > calculated as "true" (and DMAC works fine),  > > > > otherwise "nollp" was calculated as "false" (and DMAC doesn't > > > > work). > > > Can you show out what the value you read back? > > channel_readl(dwc, LLP) return 0xfffffffc > Nice. >  > Oh, forgot to ask, what are the DW_PARAMS and DWC_PARAMS[x] are on > the same hardware? DW_PARAMS: 0x38280b0c DWC_PARAMS[0]: 0x4926d300 DWC_PARAMS[1]: 0x4926d300 DWC_PARAMS[2]: 0x4926d300 DWC_PARAMS[3]: 0x4926d300 > I assume we are talking about that one which has no hardware LLP > support. Yep. > >  > > >  > > > >  > > > > So I'm wondering how the code in question really works? > > > > From DW AHB DMAC databook I wasn't able to find anything > > > > relevant > > > > to > > > > this tricky implementation. Could you please clarify a little > > > > but > > > > what > > > > happens here? > > > "Table 4-1: > > > ... > > > Hardcode Channel x LLP register to 0? > > > ... > > > Description: If set to 1, hardcodes channel x Linked List Pointer > > > register to 0 (LLPx.LOC == 0), ..." > So, any comment on this one? I suppose you may have an access to some > internal Synopsys documentation which might shed a light. Or maybe I > missed something else which should be considered. Looks like this code based on idea, what if DMA ip-core doesn't have  LLP support it will not have LLP registers. It is not necessarily true. > > >  > > >  > > > >  > > > > Maybe we should add "nollp" field in pdata structure and > > > > receive > > > > it > > > > from pdata/device tree (like we use "is_private" or "is_memcpu" > > > > fields) > > > Yeah, perhaps we can remove that trick since we need this flag to > > > be > > > set > > > on Intel Quark which might have the same issue as your case [1]. > > >  > > > [1] http://www.spinics.net/lists/linux-serial/msg22948.html > > >  > > In which tree I can find this patch applied, so I may base my work > > on > > it? > The series is under review. I'm preparing v10, so, I would like to > re- > make this patch with regarding to your input. >  > For now I would prefer just to remove the trick, but I still wonder > what > the circumstances are to bring it not working. >  Please add this code to read "is_memcpy" and "is_nollp" property  from device tree. ----------------------------->8------------------------------ ----------------------------->8------------------------------ --   Paltsev Eugeniy Reviewed-by: Eugeniy Platsev diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index 5bda0eb..2712602 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c @@ -129,6 +129,12 @@ dw_dma_parse_dt(struct platform_device *pdev)         if (of_property_read_bool(np, "is_private"))                 pdata->is_private = true;   +       if (of_property_read_bool(np, "is_memcpy")) +               pdata->is_memcpy = true; + +       if (of_property_read_bool(np, "is_nollp")) +               pdata->is_nollp = true; +         if (!of_property_read_u32(np, "chan_allocation_order", &tmp))                 pdata->chan_allocation_order = (unsigned char)tmp;