diff mbox

[RFC,usb-next,v5,1/3] dt-bindings: usb: add the documentation for USB root-hub

Message ID CAK8P3a2C+8w5_8uZF2qHvq7Cp=AH6DDx5Y=mGJFCCz2pTLvPPg@mail.gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Arnd Bergmann Oct. 13, 2017, 7:37 a.m. UTC
On Thu, Oct 12, 2017 at 10:56 PM, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
> Hi Arnd,
>
> thank you for reviewing this patch!
>
> On Mon, Oct 9, 2017 at 12:24 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Sun, Oct 8, 2017 at 11:17 PM, Martin Blumenstingl
>> <martin.blumenstingl@googlemail.com> wrote:
>>> A USB root-hub may have several PHYs which need to be configured before
>>> the root-hub starts working.
>>> This adds the documentation for such a USB root-hub as well as a hint
>>> regarding the child-nodes on XHCI controllers which can include the
>>> roothub.
>>>
>>> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>>> Acked-by: Rob Herring <robh@kernel.org>
>>
>> Have you checked that this still works with DT properties on a USB device
>> that is listed in the DT? A common use-case is to provide the MAC address
>> of a soldered-down USB-ethernet that lacks its own eeprom, and it seems
>> you are changing the way the parent devices of that get represented,
>> so the dev->of_node pointer in the USB device might no longer refer
>> to the correct device.
> I haven't tested the described use-case. however, this patch is not
> supposed to change the binding for actual devices.
> USB device numbering starts at 1, while 0 is reserved for the root-hub
> (at least from what I know). before this patch there was no way to
> describe the root-hub via .dts. this however is required for some
> platforms that need to set up a PHY for each port on the root-hub
> (Amlogic Meson GXL platform is one example: there are two ports
> enabled on dwc3's root-hub with 2x USB2 and 1x USB3 PHYs) - so this
> patch uses a similar binding as we already have (to describe the
> devices) to describe the root-hub

My point is that the DT binding does depend on the hierarchy, there
is no way to find a particular device unless each parent up the
chain is described correctly in DT as well and has a valid of_node
pointer.

It's possible that this has never worked on XHCI because of the lack
of the root-hub in DT. Either way, we should ensure that it does work
now and you didn't break it, so please at least test it with your patches.

The patch below should be sufficient to see if any device has an
of_node pointer when you add it to your DT:

        }


       Arnd
diff mbox

Patch

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 17681d5638ac..498d0aa0a5c0 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -647,6 +647,7 @@  struct usb_device *usb_alloc_dev(struct usb_device *parent,
                }
                dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node,
                                raw_port);
+               dev_info(&dev->dev, "of_node %p parent %p\n",
dev->dev.of_node, parent->dev.of_node);

                /* hub driver sets up TT records */