From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755943AbcKKK6b (ORCPT ); Fri, 11 Nov 2016 05:58:31 -0500 Received: from mga09.intel.com ([134.134.136.24]:25637 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755768AbcKKK63 (ORCPT ); Fri, 11 Nov 2016 05:58:29 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,621,1473145200"; d="asc'?scan'208";a="2813624" From: Felipe Balbi To: Sriram Dash , "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 In-Reply-To: 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> Date: Fri, 11 Nov 2016 12:57:53 +0200 Message-ID: <87twbeffm6.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Sriram Dash writes: >>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 =3D PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1); >>> dwc->mem =3D mem; >>> dwc->dev =3D dev; >>> +#ifdef CONFIG_PCI >>> + /* TODO: or some other way of detecting this? */ >>> + if (dwc->dev->parent && dwc->dev->parent->bus =3D=3D &pci_bus_type) >>> + dwc->sysdev =3D dwc->dev->parent; >>> + else >>> +#endif >> >>IOW: >> >> dwc->sysdev_is_parent =3D device_property_read_bool(dev, >> "linux,sysdev_is_parent"); >> >>[...] >> >> if (dwc->sysdev_is_parent) >> dwc->sysdev =3D dwc->dev->parent; >> else >> dwc->sysdev =3D 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=20 > mention the dts property "linux,sysdev_is_parent". This will be requiring PCI doesn't use DTS ;-) You're gonna need something like so: 1 file changed, 10 insertions(+) drivers/usb/dwc3/dwc3-pci.c | 10 ++++++++++ modified drivers/usb/dwc3/dwc3-pci.c @@ -73,6 +73,16 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) { struct platform_device *dwc3 =3D dwc->dwc3; struct pci_dev *pdev =3D dwc->pci; + int ret; + + struct property_entry sysdev_property[] =3D { + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), + { }, + }; + + ret =3D platform_device_add_properties(dwc3, sysdev_property); + if (ret) + return ret; =20 if (pdev->vendor =3D=3D PCI_VENDOR_ID_AMD && pdev->device =3D=3D PCI_DEVICE_ID_AMD_NL_USB) { > 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. not taking any ifdefs, sorry. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJYJaQxAAoJEMy+uJnhGpkGJuUQALAxHi3Xbj1e8Ad7TCFqXOSM 89QOHjnzYP1UJUe97+5PB9ya5SzS6gytlbR2WtUgzvMf9ML2OnmPYlPFSZZsO3hz G6OOSkmkmG1LrLEV+3b6JYrIEMy+6VxoihMSJVCtpdpMr2KO9DGME+yTvOzhGe93 wciwjTAn2xcJnLfAI7QgVGKy2dURlguXGzfw9KOfsfRMjOfQEynR4ev7fhUE+ZFN e4ayCkAfcZeb25kxd9Y/hBUq5aCTSBTyIvy+Rpx7JQeI2zFuP+FRjaG/sa36PPQ5 BLSQF4G7nByp6rI7nfx86SfApWBPl/Fb0ZhJ6ogtvmKxe9czbGxAZ27pqU1KuzIU z4HzE4DCAry4YJDOqWN1tAmP0Ivx+sshPoDdDwHFjS8zPCaZ4/U6xYc9Hdx0J0TC cnBmjRpDRzuzM770kA+a7a04ZfLx+qtOP0mwHUJCsoNYOZCEWuzv82vWTTXHDKXQ FiY88naWADMMxlzcBXCvZ6uRaKyYqjaaaBT2PgXUojpbLoioFmtVlUP6QVjj4BZf MZ61edIuy8oKwnR5DY3lQhGroNNhnGEuINgyD7P9TDhQKs9BFLIbJqdjGMRmJDP8 UmscAXI3O+f1xXCm6qm/ciz5ZFzm8mtYdyUJdBQGPb88GTvoSlzLtiKQeQf4/vs/ hPi1WIhgO2OSbjlDjGWn =aLzI -----END PGP SIGNATURE----- --=-=-=--