[PATCH v2 0/2] usb: Fix USB3 detection

This patch series implements USB 3.0 port reset requirement before scanning port.
Changes in v2: - As requested, added fix for regulator-always-on in RockPro64
Shantur Rathore (2): common: usb-hub: Reset hub port before scanning dts: rockpro64: Disable usb regulators-always-on
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 12 ++++++++++++ common/usb_hub.c | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-)

Currently when a hub is turned on, all the ports are powered on. This works well for hubs which have individual power control.
For the hubs without individual power control this has no effect. Mostly in these scenarios the hub port is powered before the USB controller is enabled, this can lead to some devices in unexpected state.
With this patch, we explicitly reset the port while powering up hub This resets the port for hubs without port power control and has no effect on hubs with port power control as the port is still off.
Before this patch AMicro AM8180 based NVME to USB adapter won't be detected as a USB3.0 Mass Storage device but with this it works as expected.
Tested working after this patch: 1. AMicro AM8180 based NVME to USB Adapter 2. Kingston DataTraveler 3.0 3. GenesysLogic USB3.0 Hub
The drives were tested while connected directly and via the hub.
Signed-off-by: Shantur Rathore i@shantur.com ---
(no changes since v1)
common/usb_hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/common/usb_hub.c b/common/usb_hub.c index 85c0822d8b..06fe436add 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -174,8 +174,10 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
debug("enabling power on all ports\n"); for (i = 0; i < dev->maxchild; i++) { + usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_RESET); + debug("Reset : port %d returns %lX\n", i + 1, dev->status); usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); - debug("port %d returns %lX\n", i + 1, dev->status); + debug("PowerOn : port %d returns %lX\n", i + 1, dev->status); }
#ifdef CONFIG_SANDBOX

USB port regulators should be controlled by phys so we remove always-on property and let phy manage the regulator.
Typec port has misconfugred phy-supply in upstream and now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.
Signed-off-by: Shantur Rathore i@shantur.com
---
Changes in v2: - As requested, added fix for regulator-always-on in RockPro64
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi index 732727d9b0..638d567357 100644 --- a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +++ b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi @@ -22,6 +22,18 @@ }; };
+&u2phy0_host { + phy-supply = <&vcc5v0_typec>; +}; + +&vcc5v0_host { + /delete-property/ regulator-always-on; +}; + +&vcc5v0_typec { + /delete-property/ regulator-always-on; +}; + &vdd_center { regulator-min-microvolt = <950000>; regulator-max-microvolt = <950000>;

On 12/8/23 01:09, Shantur Rathore wrote:
USB port regulators should be controlled by phys
PHYs
so we remove always-on property and let phy manage the regulator.
Typec port has misconfugred
misconfigured (typo)
phy-supply in upstream and now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.
Where is the upstream Linux kernel patch ? Was it submitted already ?
You should send this patch separately, it doesn't depend on the USB Hub 1/2 patch and will go in through different (rockchip) tree.

Hi Marek,
On Sat, Dec 9, 2023 at 5:31 PM Marek Vasut marex@denx.de wrote:
On 12/8/23 01:09, Shantur Rathore wrote:
USB port regulators should be controlled by phys
PHYs
so we remove always-on property and let phy manage the regulator.
Typec port has misconfugred
misconfigured (typo)
Thanks will fix both typos in v3
phy-supply in upstream and now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.
Where is the upstream Linux kernel patch ? Was it submitted already ?
No, there is no patch yet for this in Linux upstream.
You should send this patch separately, it doesn't depend on the USB Hub 1/2 patch and will go in through different (rockchip) tree.
Sure, I will split and send v3 for these now.

Hi Marek,
On Sat, Dec 9, 2023 at 5:57 PM Shantur Rathore i@shantur.com wrote:
Hi Marek,
On Sat, Dec 9, 2023 at 5:31 PM Marek Vasut marex@denx.de wrote:
On 12/8/23 01:09, Shantur Rathore wrote:
USB port regulators should be controlled by phys
PHYs
so we remove always-on property and let phy manage the regulator.
Typec port has misconfugred
misconfigured (typo)
Thanks will fix both typos in v3
phy-supply in upstream and now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.
Where is the upstream Linux kernel patch ? Was it submitted already ?
No, there is no patch yet for this in Linux upstream.
You should send this patch separately, it doesn't depend on the USB Hub 1/2 patch and will go in through different (rockchip) tree.
Sure, I will split and send v3 for these now.
These have been split to
[0] - https://patchwork.ozlabs.org/project/uboot/patch/20231209181057.331815-1-i@s... [1] - https://patchwork.ozlabs.org/project/uboot/patch/20231209180437.330969-1-i@s...
Thanks, Shantur

On 12/9/23 18:57, Shantur Rathore wrote:
Hi Marek,
On Sat, Dec 9, 2023 at 5:31 PM Marek Vasut marex@denx.de wrote:
On 12/8/23 01:09, Shantur Rathore wrote:
USB port regulators should be controlled by phys
PHYs
so we remove always-on property and let phy manage the regulator.
Typec port has misconfugred
misconfigured (typo)
Thanks will fix both typos in v3
phy-supply in upstream and now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.
Where is the upstream Linux kernel patch ? Was it submitted already ?
No, there is no patch yet for this in Linux upstream.
Why not ? I would expect the fix should be consistent between both U-Boot and Linux .

On Sat, Dec 9, 2023 at 10:05 PM Marek Vasut marex@denx.de wrote:
On 12/9/23 18:57, Shantur Rathore wrote:
Hi Marek,
On Sat, Dec 9, 2023 at 5:31 PM Marek Vasut marex@denx.de wrote:
On 12/8/23 01:09, Shantur Rathore wrote:
USB port regulators should be controlled by phys
PHYs
so we remove always-on property and let phy manage the regulator.
Typec port has misconfugred
misconfigured (typo)
Thanks will fix both typos in v3
phy-supply in upstream and now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.
Where is the upstream Linux kernel patch ? Was it submitted already ?
No, there is no patch yet for this in Linux upstream.
Why not ? I would expect the fix should be consistent between both U-Boot and Linux .
Yes you are right. I will be raising a patch for linux too.

On Sat, Dec 9, 2023 at 10:20 PM Shantur Rathore i@shantur.com wrote:
On Sat, Dec 9, 2023 at 10:05 PM Marek Vasut marex@denx.de wrote:
On 12/9/23 18:57, Shantur Rathore wrote:
Hi Marek,
On Sat, Dec 9, 2023 at 5:31 PM Marek Vasut marex@denx.de wrote:
On 12/8/23 01:09, Shantur Rathore wrote:
USB port regulators should be controlled by phys
PHYs
so we remove always-on property and let phy manage the regulator.
Typec port has misconfugred
misconfigured (typo)
Thanks will fix both typos in v3
phy-supply in upstream and now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.
Where is the upstream Linux kernel patch ? Was it submitted already ?
No, there is no patch yet for this in Linux upstream.
Why not ? I would expect the fix should be consistent between both U-Boot and Linux .
Yes you are right. I will be raising a patch for linux too.
This has been published to devicetree - https://lore.kernel.org/linux-devicetree/20231209233536.350876-1-i@shantur.c...
participants (2)
-
Marek Vasut
-
Shantur Rathore