From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755664AbcIGKTF (ORCPT ); Wed, 7 Sep 2016 06:19:05 -0400 Received: from mga07.intel.com ([134.134.136.100]:58819 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751207AbcIGKTD (ORCPT ); Wed, 7 Sep 2016 06:19:03 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,296,1470726000"; d="asc'?scan'208";a="875945477" From: Felipe Balbi To: Russell King - ARM Linux , Peter Chen Cc: Arnd Bergmann , Leo Li , Grygorii Strashko , Catalin Marinas , Yoshihiro Shimoda , "linux-usb\@vger.kernel.org" , Sekhar Nori , lkml , Stuart Yoder , Scott Wood , David Fisher , "Thang Q. Nguyen" , Alan Stern , Greg Kroah-Hartman , "linux-arm-kernel\@lists.infradead.org" Subject: Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev In-Reply-To: <20160907093525.GK1041@n2100.armlinux.org.uk> References: <20562703.Glp77l1PBf@wuerfel> <20160907074428.GB13903@b29397-desktop> <4780626.ofOZnpf19s@wuerfel> <20160907092901.GC13903@b29397-desktop> <20160907093525.GK1041@n2100.armlinux.org.uk> User-Agent: Notmuch/0.22.1+63~g994277e (https://notmuchmail.org) Emacs/25.1.3 (x86_64-pc-linux-gnu) Date: Wed, 07 Sep 2016 13:18:26 +0300 Message-ID: <87lgz4ko7h.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, Russell King - ARM Linux writes: > On Wed, Sep 07, 2016 at 05:29:01PM +0800, Peter Chen wrote: >> On Wed, Sep 07, 2016 at 10:52:46AM +0200, Arnd Bergmann wrote: >> > On Wednesday, September 7, 2016 3:44:28 PM CEST Peter Chen wrote: >> > >=20 >> > > The pre-condition of DT function at USB HCD core works is the host >> > > controller device has of_node, since it is the root node for USB tree >> > > described at DT. If the host controller device is not at DT, it needs >> > > to try to get its of_node, the chipidea driver gets it through its >> > > parent node [1] >> >=20 >> > >=20 >> > > [1] https://lkml.org/lkml/2016/8/8/119 >> > >=20 >> >=20 >> > Ah, this is what I was referring to in the other mail. >> >=20 >> > However, the way you set the of_node might be dangerous too: >> > We should generally not have two platform_device structures with >> > the same of_node pointer, most importantly it may cause the >> > child device to be bound to the same driver as the parent >> > device since the probing is done by compatible string. >> >=20 >> > As you tested it successfully, it must work at the moment on your >> > machine, but it could easily break depending on deferred probing >> > or module load order. >> >=20 >>=20 >> Currently, I work around above problems by setting core device of_node >> as NULL at both probe error path and platform driver .remove routine. >>=20 >> I admit it is not a good way, but if we only have of_node at device's >> life periods after probe, it seems ok currently. It is hard to create >> of_node dynamically when create device, and keep some contents >> of parent's of_node, and some are not. > > How about turning dwc3 into a library which can be used by a range of > platform devices? Wouldn't that solve all the current problems, and > completely avoid the need to copy resources from one platform device > to another? This will break all existing DTs out there. Also, there are other benefits from keeping current design, these have been discussed before but here's a short summary: . PM callbacks are kept simple . We avoid abuse of internal dwc3 functions . It's a lot less work to "port" dwc3 to "your SoC" . We prevent another MUSB (drivers/usb/musb/) And few others. Sure, they are rather subjective benefits, but it has worked well so far. Also, breaking DT ABI is kind of a big deal. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJXz+lyAAoJEMy+uJnhGpkGMRgP/ioWGLdxQXsMmQm5CKsDsl/V 50hIVdF7mJHnLaxSNIJG1mLVSoCxNs4tvzWsGxOUF3JLAuCb7zhJWKmsuedcKz+v 4gDWUj3L+EzC2iINOTBqMmDjY6R7RP86jO8ALY/gIgWVwAGLHP2SmVx3DIAmsEbX kedlAztRnNsSeh8rngO5ioX06T61Xm89i2gIIyFarV0oiWJtG6lwRRJy2FoKmado Z2WzqQg3iO5oMnCfGYS5rEBrAJ29V4gf3w1vgPWPPBhKObuE/VQPobfeZ8blXTjv f0ECxzQs57CuuHTZUPr3lGAICmXtZuk82Ob/Vn2CubxQWYIrQN5zEcjI/uA5vfSK L4bYQL5rJN+7KjafUseD4AJFWj+cLIWkZgZeC2LuHgocVFhYPJkmU0I9E9z3H7EB YB2nlGzh3SdW1Z0XP5RKrRapf2BqMHlUmkFVnBSHSI++Idwcy7sJJDPh81PyAdIC AW7OxsuNbuV9XSTlzANySr2RPpgvT2IbFEeB44PGKCtwoyBIvO+Uagp+3YszwWXT fC4Fj05tR03q5zkUd2zZ/F3hmL3Yqr09mx5VmWkGzFYjEn4oGMfk3m1OuHc/hBBf 3Aom78A3iGHl11uitsK4xCg7draLbxy/G9WsakfxFlNcEhbR8/zOfmGgz2arA54K aLvoyVSB1u1PGSavSUG9 =xJ5s -----END PGP SIGNATURE----- --=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: balbi@kernel.org (Felipe Balbi) Date: Wed, 07 Sep 2016 13:18:26 +0300 Subject: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev In-Reply-To: <20160907093525.GK1041@n2100.armlinux.org.uk> References: <20562703.Glp77l1PBf@wuerfel> <20160907074428.GB13903@b29397-desktop> <4780626.ofOZnpf19s@wuerfel> <20160907092901.GC13903@b29397-desktop> <20160907093525.GK1041@n2100.armlinux.org.uk> Message-ID: <87lgz4ko7h.fsf@linux.intel.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, Russell King - ARM Linux writes: > On Wed, Sep 07, 2016 at 05:29:01PM +0800, Peter Chen wrote: >> On Wed, Sep 07, 2016 at 10:52:46AM +0200, Arnd Bergmann wrote: >> > On Wednesday, September 7, 2016 3:44:28 PM CEST Peter Chen wrote: >> > > >> > > The pre-condition of DT function at USB HCD core works is the host >> > > controller device has of_node, since it is the root node for USB tree >> > > described at DT. If the host controller device is not at DT, it needs >> > > to try to get its of_node, the chipidea driver gets it through its >> > > parent node [1] >> > >> > > >> > > [1] https://lkml.org/lkml/2016/8/8/119 >> > > >> > >> > Ah, this is what I was referring to in the other mail. >> > >> > However, the way you set the of_node might be dangerous too: >> > We should generally not have two platform_device structures with >> > the same of_node pointer, most importantly it may cause the >> > child device to be bound to the same driver as the parent >> > device since the probing is done by compatible string. >> > >> > As you tested it successfully, it must work at the moment on your >> > machine, but it could easily break depending on deferred probing >> > or module load order. >> > >> >> Currently, I work around above problems by setting core device of_node >> as NULL at both probe error path and platform driver .remove routine. >> >> I admit it is not a good way, but if we only have of_node at device's >> life periods after probe, it seems ok currently. It is hard to create >> of_node dynamically when create device, and keep some contents >> of parent's of_node, and some are not. > > How about turning dwc3 into a library which can be used by a range of > platform devices? Wouldn't that solve all the current problems, and > completely avoid the need to copy resources from one platform device > to another? This will break all existing DTs out there. Also, there are other benefits from keeping current design, these have been discussed before but here's a short summary: . PM callbacks are kept simple . We avoid abuse of internal dwc3 functions . It's a lot less work to "port" dwc3 to "your SoC" . We prevent another MUSB (drivers/usb/musb/) And few others. Sure, they are rather subjective benefits, but it has worked well so far. Also, breaking DT ABI is kind of a big deal. -- balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 800 bytes Desc: not available URL: