Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751925AbcCRDkn (ORCPT ); Thu, 17 Mar 2016 23:40:43 -0400 Received: from mail-am1on0093.outbound.protection.outlook.com ([157.56.112.93]:54631 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750937AbcCRDkm convert rfc822-to-8bit (ORCPT ); Thu, 17 Mar 2016 23:40:42 -0400 From: Rajesh Bhagat To: Peter Chen , Arnd Bergmann CC: Li Yang , Bjorn Andersson , Peter Chen , "Greg Kroah-Hartman" , "linux-usb@vger.kernel.org" , lkml , "Srinivas Kandagatla" , linux-arm-msm , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH] usb: chipidea: Configure DMA properties and ops from DT Thread-Topic: [PATCH] usb: chipidea: Configure DMA properties and ops from DT Thread-Index: AQHRbTJuAJRcjRscmkehdN0ozhOCpJ831iCAgADKawCADjNugIAJObmAgACCqQCAAUjEAIAHC1AAgAULT4CAAKgCAIAAGGWg Date: Fri, 18 Mar 2016 03:25:41 +0000 Message-ID: References: <1456119133-16114-1-git-send-email-bjorn.andersson@linaro.org> <20160314105108.GB2131@shlinux2.ap.freescale.net> <3240370.XdEELlSA8f@wuerfel> <20160318015414.GA30851@shlinux2.ap.freescale.net> In-Reply-To: <20160318015414.GA30851@shlinux2.ap.freescale.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [192.88.169.1] x-ms-office365-filtering-correlation-id: f6acfb84-817d-4c38-da35-08d34edcfbe9 x-microsoft-exchange-diagnostics: 1;DB5PR04MB1445;5:eMspj4vytDXIxmTUMGG06e+fFEtVDVH4VBBpwHw+d+KN3JXVy2XBnUo1q5hX8PUYmbO+RwevgGu9oZDchC0MM9NOYj9vYVYAHm2Q8EBo8NoTgXzegcrQWLjfJEaLlzhg2+IUBWYaI+8GphpQCKTa9g==;24:J89pfIrnzo4svirDpt9VxJW6AGNh2skIiOC77ZDukvJBE3fXOAfI1M7ob68ad47n9Olbz20xR9XLxKYSQHLAufxzokdEsUAVFgyizFjKA8o= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR04MB1445; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:DB5PR04MB1445;BCL:0;PCL:0;RULEID:;SRVR:DB5PR04MB1445; x-forefront-prvs: 088552DE73 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(13464003)(377454003)(24454002)(86362001)(5008740100001)(54356999)(76176999)(11100500001)(50986999)(5004730100002)(19580395003)(122556002)(19580405001)(74316001)(76576001)(66066001)(87936001)(10400500002)(106116001)(93886004)(33656002)(92566002)(2906002)(5003600100002)(5001770100001)(189998001)(77096005)(3280700002)(1096002)(4326007)(5002640100001)(3660700001)(81166005)(3846002)(2900100001)(2950100001)(6116002)(102836003)(1220700001)(586003)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR04MB1445;H:HE1PR0401MB2028.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2016 03:25:41.3362 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1445 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4177 Lines: 88 > -----Original Message----- > From: Peter Chen [mailto:hzpeterchen@gmail.com] > Sent: Friday, March 18, 2016 7:24 AM > To: Arnd Bergmann > Cc: Li Yang ; Bjorn Andersson ; > Peter Chen ; Greg Kroah-Hartman > ; Rajesh Bhagat ; linux- > usb@vger.kernel.org; lkml ; Srinivas Kandagatla > ; linux-arm-msm msm@vger.kernel.org>; linux-arm-kernel@lists.infradead.org > Subject: Re: [PATCH] usb: chipidea: Configure DMA properties and ops from DT > > On Thu, Mar 17, 2016 at 04:52:55PM +0100, Arnd Bergmann wrote: > > On Monday 14 March 2016 18:51:08 Peter Chen wrote: > > > On Wed, Mar 09, 2016 at 05:16:50PM -0600, Li Yang wrote: > > > > On Tue, Mar 8, 2016 at 9:40 PM, Bjorn Andersson > > > > wrote: > > > > > On Tue, Mar 8, 2016 at 11:52 AM, Li Yang wrote: > > > > >> On Wed, Mar 2, 2016 at 4:59 PM, Li Yang wrote: > > > > >>> On Mon, Feb 22, 2016 at 4:07 PM, Bjorn Andersson > > > > >>> wrote: > > > > >>>> On Mon 22 Feb 02:03 PST 2016, Srinivas Kandagatla wrote: > > > > > > > > > > I had the chance to go through this with Arnd and the verdict is > > > > > that devices not described in DT should not do DMA (or allocate > > > > > buffers for doing DMA). > > > > > > > > > > So I believe the solution is to fall back on Peter's > > > > > description; the chipidea driver is the core driver and the > > > > > Qualcomm code should just be a platform layer. > > > > > > > > > > My suggestion is that we turn the chipidea core into a set of > > > > > APIs that can called by the platform specific pieces. That way > > > > > we will have the chipidea core be the device described in the DT. > > > > > > > > But like I said, this problem is not just existing for chipidea > > > > driver. We already found that the dwc3 driver is also suffering > > > > from the same issue. I don't know how many other drivers are > > > > impacted by this change, but I suspect there will be some. A grep > > > > of > > > > platform_device_add() in driver/ directory returns many possible > > > > drivers to be impacted. As far as I know, the > > > > drivers/net/ethernet/freescale/fman/mac.c is registering child > > > > ethernet devices that definitely will do dma. If you want to do this > > > > kind of rework to all these drivers, it will be a really big effort. > > > > > > > > > > +1 > > > > > > Yes, I think this DMA things should be covered by driver core too. > > > > > > > I don't think it's a very widespread problem, there are only very few > > developers that intentionally use this method, and some use the > > platform_device_register_full() call to create a device with a known > > mask, which is generally ok for the limited case where the driver is > > only ever going to run on a single platform, but not in the more > > general case that of_dma_configure is designed to handle. > > Even only for qualcomm platforms, it may be possible have different DMA masks at > ARM64 platforms, so we may can't use a fixed value at glue layer driver. So, using > of_dma_configure is suitable choice for DT platforms for this case, right? > > > > > I think we should fix the drivers to consistently use the device that > > was created by the platform (DT or ACPI or board file) to pass that > > into the DMA API, anything else will just cause more subtle bugs. > > > > Although I don't know what kinds of bugs it may have, it may be met before, > otherwise, why most of platform drivers need to call dma_set_coherent_mask or > dma_coerce_mask_and_coherent explicitly > > -- > > Best Regards, > Peter Chen Though chipidea platform drivers are calling functions mentioned by you i.e. dma_set_coherent_mask or dma_coerce_mask_and_coherent explicity e.g. in file drivers/usb/chipidea/ci_hdrc_imx.c. Still the mentioned error is coming while calling ci_hdrc_add_device which lies in chipidea/core.c. similar is the case with DWC3 driver. Best Regards, Rajesh Bhagat