From: Martin Blumenstingl <martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
gregkh <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
DTML <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
"open list:ARM/Amlogic Meson SoC support"
<linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
Chunfeng Yun
<chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Subject: Re: [RFC usb-next v5 1/3] dt-bindings: usb: add the documentation for USB root-hub
Date: Tue, 17 Oct 2017 23:00:03 +0200 [thread overview]
Message-ID: <CAFBinCC7disratgMmmaSJMfywb-bPF32L-1BarSsX6zTChHEJg@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a2C+8w5_8uZF2qHvq7Cp=AH6DDx5Y=mGJFCCz2pTLvPPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 4875 bytes --]
Hi Arnd,
On Fri, Oct 13, 2017 at 9:37 AM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> On Thu, Oct 12, 2017 at 10:56 PM, Martin Blumenstingl
> <martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
>> Hi Arnd,
>>
>> thank you for reviewing this patch!
>>
>> On Mon, Oct 9, 2017 at 12:24 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
>>> On Sun, Oct 8, 2017 at 11:17 PM, Martin Blumenstingl
>>> <martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 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-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
>>>> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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:
I slightly modified your patch (see the attached version) and tried it:
# lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/0p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M
the roothub (bus 1 port 1 dev 1) and a soldered down hub (child of
that root-hub, port 1 dev 2) have an entry in the .dts
# dmesg | grep usb
[ 0.174097] usbcore: registered new interface driver usbfs
[ 0.174147] usbcore: registered new interface driver hub
[ 0.174217] usbcore: registered new device driver usb
[ 1.354280] usb usb2: We don't know the algorithms for LPM for this
host, disabling LPM.
[ 1.373297] usbcore: registered new interface driver usb-storage
[ 1.512840] usbcore: registered new interface driver dvb_usb_rtl28xxu
[ 1.550506] usb 1-1: of_node /soc/usb@c9000000/hub@1 parent /soc/usb@c9000000
^ this is the soldered down hub
[ 1.552579] usbcore: registered new interface driver bcm203x
[ 1.712033] usbcore: registered new interface driver usbhid
[ 1.716994] usbhid: USB HID core driver
[ 1.738827] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 2.142392] usb 1-1.3: of_node <no-node> parent /soc/usb@c9000000/hub@1
^ this is the thumb drive plugged into the hub (not specified in the .dts)
[ 2.220399] usb 1-1.3: new high-speed USB device number 3 using xhci-hcd
[ 2.326144] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[ 2.328352] scsi host0: usb-storage 1-1.3:1.0
so for me it seems to be working fine
is there anything else you want me to test?
> 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 */
> }
>
>
> Arnd
Regards,
Martin
[-- Attachment #2: khadas-vim-soldered-usb-hub-print.patch --]
[-- Type: text/x-patch, Size: 885 bytes --]
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index cfbfbfeff85d..7677ce77d122 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -81,6 +81,11 @@
phy-names = "usb2-phy";
};
};
+
+ hub@1 {
+ compatible = "usb1a40,801";
+ reg = <1>;
+ };
};
};
};
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 17681d5638ac..893f4e8b0733 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 %s parent %s\n", of_node_full_name(dev->dev.of_node), of_node_full_name(parent->dev.of_node));
/* hub driver sets up TT records */
}
next prev parent reply other threads:[~2017-10-17 21:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-08 21:17 [RFC usb-next v5 0/3] initialize (multiple) PHYs on the roothub Martin Blumenstingl
[not found] ` <20171008211713.18696-1-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2017-10-08 21:17 ` [RFC usb-next v5 1/3] dt-bindings: usb: add the documentation for USB root-hub Martin Blumenstingl
[not found] ` <20171008211713.18696-2-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2017-10-09 10:24 ` Arnd Bergmann
[not found] ` <CAK8P3a2607YnNRRmAJJyTNJTTJmJvx-ZJm3QNAq84noPLy+F+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-12 20:56 ` Martin Blumenstingl
[not found] ` <CAFBinCCc+Fj6wwGk+OLNQTHEYU8xBPe7OGHVSQ82kMew3xUsww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-12 21:17 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1710121715390.1278-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-10-12 21:35 ` Martin Blumenstingl
[not found] ` <CAFBinCBwzzzj-ew-VTb9zojfzC9gedHd0uu0ez4WejBRTpnsWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-13 14:15 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1710131008390.1364-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-10-17 21:02 ` Martin Blumenstingl
2017-10-13 7:37 ` Arnd Bergmann
[not found] ` <CAK8P3a2C+8w5_8uZF2qHvq7Cp=AH6DDx5Y=mGJFCCz2pTLvPPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-17 21:00 ` Martin Blumenstingl [this message]
[not found] ` <CAFBinCC7disratgMmmaSJMfywb-bPF32L-1BarSsX6zTChHEJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-17 21:10 ` Arnd Bergmann
[not found] ` <CAK8P3a31GLjQDUUdyTeaAX_fELV5_UkNQfbj+ssHrGa7Ek2NcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-17 21:19 ` Martin Blumenstingl
[not found] ` <CAFBinCCmk3bSa4-OY7Mu0sPEhVv6=dQbSO94P=YMqk_hc+53Pg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-18 9:05 ` Arnd Bergmann
[not found] ` <CAK8P3a0hFF-gMa4UWMXh-28=scF-8cnzPv-Sa11PzyvgMYAkQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-19 9:54 ` Neil Armstrong
2017-10-19 21:25 ` Martin Blumenstingl
[not found] ` <CAFBinCAtsxu2gFXABhq5r0_DMJwsLGkLYjgWaEXMg=CVEjiv7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-19 22:10 ` Arnd Bergmann
[not found] ` <CAK8P3a1cdob4trLG80xos1Zh1oXWLMExFTyS2EFsq0g+YULKpw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-23 21:36 ` Martin Blumenstingl
2017-10-08 21:17 ` [RFC usb-next v5 2/3] usb: core: add a wrapper for the USB PHYs on the root-hub Martin Blumenstingl
[not found] ` <20171008211713.18696-3-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2017-10-09 17:16 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1710091314310.6996-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-10-12 21:00 ` Martin Blumenstingl
2017-10-12 21:08 ` Martin Blumenstingl
2017-10-08 21:17 ` [RFC usb-next v5 3/3] usb: core: hcd: integrate the PHY roothub wrapper Martin Blumenstingl
[not found] ` <20171008211713.18696-4-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2017-10-09 17:18 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1710091316170.6996-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-10-12 21:05 ` Martin Blumenstingl
[not found] ` <CAFBinCC4qseHoEkTtNa4NtVXgrcV=NRrOf2BBKvQRbhaZeEzsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-13 14:07 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1710131005420.1364-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-10-17 21:05 ` Martin Blumenstingl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFBinCC7disratgMmmaSJMfywb-bPF32L-1BarSsX6zTChHEJg@mail.gmail.com \
--to=martin.blumenstingl-gm/ye1e23mwn+bqq9rbeug@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).