Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754153AbcKKKnF (ORCPT ); Fri, 11 Nov 2016 05:43:05 -0500 Received: from mail-db5eur01on0081.outbound.protection.outlook.com ([104.47.2.81]:56768 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750714AbcKKKnD (ORCPT ); Fri, 11 Nov 2016 05:43:03 -0500 From: Sriram Dash To: Felipe Balbi , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" CC: "mathias.nyman@intel.com" , "gregkh@linuxfoundation.org" , Suresh Gupta , "stern@rowland.harvard.edu" , "pku.leo@gmail.com" , "Arnd Bergmann" Subject: RE: [PATCH v3 5/6] usb: dwc3: use bus->sysdev for DMA configuration Thread-Topic: [PATCH v3 5/6] usb: dwc3: use bus->sysdev for DMA configuration Thread-Index: AQHSOyuYgUZA43dYKEumlkcpOtoRj6DSDW6AgAGKm+A= Date: Fri, 11 Nov 2016 10:42:57 +0000 Message-ID: References: <1478766001-26463-1-git-send-email-sriram.dash@nxp.com> <1478766001-26463-6-git-send-email-sriram.dash@nxp.com> <87fumzha30.fsf@linux.intel.com> In-Reply-To: <87fumzha30.fsf@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sriram.dash@nxp.com; x-originating-ip: [192.88.169.1] x-microsoft-exchange-diagnostics: 1;HE1PR04MB1353;7:h5Nav5TR8G1g+DHsoEjAafDO88ewMfJyFErFt0e/gqKPRdsj3SbRP151tWrQHS1ZNJn77MKvRJRf4CSdlF0WVHHa5cHyjsDvZBrsQaA4w/xnYVmFG8wJQv3Nu4Djiut/SmWG0RDGRPeFyzll0Jf9UPs8VLATrBtXTRfQ8PK7hDj82wJc1I6iYWSViHP66i7MKTg6W99svbM+chfLlam99uXio4DSIgzpraUxJZQnDVSgtgJh3GsbBfLk0ujjm8/PnEceyMaT3+jLHD0M91fatT1WbklQzgID9zy6EKGBKjKNAHcdpry6w/vaVSjEtZXQGvKjPxnKSsFdb2fx1ZT9A8nfgiq7Bghs8voREWHPpiI= x-ms-office365-filtering-correlation-id: e7d133da-0e94-4cd2-76d1-08d40a1f7ffa x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:HE1PR04MB1353; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(6045074)(6060229)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6046074)(6072074);SRVR:HE1PR04MB1353;BCL:0;PCL:0;RULEID:;SRVR:HE1PR04MB1353; x-forefront-prvs: 012349AD1C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(189002)(199003)(74316002)(5660300001)(305945005)(3660700001)(122556002)(50986999)(54356999)(76176999)(7846002)(3846002)(33656002)(7736002)(6116002)(101416001)(106356001)(102836003)(586003)(105586002)(106116001)(7696004)(3280700002)(2950100002)(189998001)(77096005)(5001770100001)(97736004)(4326007)(2900100001)(8676002)(76576001)(92566002)(2906002)(2201001)(68736007)(86362001)(9686002)(81166006)(81156014)(229853002)(87936001)(575784001)(66066001)(8936002)(2501003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR04MB1353;H:DB5PR0401MB1925.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2016 10:42:57.2226 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1353 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uABAhAOP029550 Content-Length: 3208 Lines: 103 >From: Felipe Balbi [mailto:felipe.balbi@linux.intel.com] > > >Hi, Hello Felipe, > >Sriram Dash writes: >> From: Arnd Bergmann >> >> The dma ops for dwc3 devices are not set properly. So, use a physical >> device sysdev, which will be inherited from parent, to set the >> hardware / firmware parameters like dma. >> >> Signed-off-by: Arnd Bergmann >> Signed-off-by: Sriram Dash >> --- >> Changes in v3: >> - No update >> >> Changes in v2: >> - integrate dwc3 driver changes together >> >> drivers/usb/dwc3/core.c | 28 +++++++++++++++------------- >> drivers/usb/dwc3/core.h | 1 + >> drivers/usb/dwc3/ep0.c | 8 ++++---- >> drivers/usb/dwc3/gadget.c | 37 +++++++++++++++++++------------------ >> drivers/usb/dwc3/host.c | 12 ++++-------- >> 5 files changed, 43 insertions(+), 43 deletions(-) >> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index >> 7287a76..0af0dc0 100644 >> --- a/drivers/usb/dwc3/core.c >> +++ b/drivers/usb/dwc3/core.c >> @@ -25,6 +25,7 @@ >> #include >> #include >> #include >> +#include > >I'd prefer to add a device property instead of checking for PCI bus type. > >> @@ -943,6 +944,13 @@ static int dwc3_probe(struct platform_device *pdev) >> dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1); >> dwc->mem = mem; >> dwc->dev = dev; >> +#ifdef CONFIG_PCI >> + /* TODO: or some other way of detecting this? */ >> + if (dwc->dev->parent && dwc->dev->parent->bus == &pci_bus_type) >> + dwc->sysdev = dwc->dev->parent; >> + else >> +#endif > >IOW: > > dwc->sysdev_is_parent = device_property_read_bool(dev, > "linux,sysdev_is_parent"); > >[...] > > if (dwc->sysdev_is_parent) > dwc->sysdev = dwc->dev->parent; > else > dwc->sysdev = dwc->dev; > I am with you in the fact that the core should not worry about pci. This change you proposed is also appealing. But, if we are going with this solution, all the clients which are using dwc3 pci have to mention the dts property "linux,sysdev_is_parent". This will be requiring a lot of testing and proper changes from the dts, or it might break the functionality for dwc3 pci clients. So, IMO, we could postpone this change and try it out in future. >> @@ -112,9 +108,9 @@ int dwc3_host_init(struct dwc3 *dwc) >> return 0; >> err2: >> phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", >> - dev_name(&xhci->dev)); >> + dev_name(dwc->dev)); >> phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", >> - dev_name(&xhci->dev)); >> + dev_name(dwc->dev)); >> err1: >> platform_device_put(xhci); >> return ret; >> @@ -123,8 +119,8 @@ int dwc3_host_init(struct dwc3 *dwc) void >> dwc3_host_exit(struct dwc3 *dwc) { >> phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", >> - dev_name(&dwc->xhci->dev)); >> + dev_name(dwc->dev)); >> phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", >> - dev_name(&dwc->xhci->dev)); >> + dev_name(dwc->dev)); > >this looks unrelated to $subject. Care to explain? > Apologies. Will remove unrelated changes in next version. >-- >balbi