Skip to contentSkip to conversation

usb: Fix USB3 detection

PATCH Superseded Shantur Rathore 2 participants 9 messages Dec 8, 2023 – Dec 10, 2023 Arm (32-bit)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover 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(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH v2 1/2 common: usb-hub: Reset hub port before scanning

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.

---

(no changes since v1)

 common/usb_hub.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
common/usb_hub.c +3 -1
index 85c0822d8b..06fe436add 100644
@@ -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
Signature · 1 line
2.40.1
#2 lore raw

PATCH v2 2/2 dts: rockpro64: Disable usb regulators-always-on

In reply to Shantur Rathore

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.

---

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(+)
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +12 -0
index 732727d9b0..638d567357 100644
@@ -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>;
Signature · 1 line
2.40.1
#3 lore raw

Re: [PATCH v2 2/2] dts: rockpro64: Disable usb regulators-always-on

Quoted 1 line · Shantur Rathore

USB port regulators should be controlled by phys

PHYs

Quoted 4 lines

so we remove always-on property and let phy manage the regulator.

Typec port has misconfugred

misconfigured (typo)

Quoted 3 lines

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.

#4 lore raw

Re: [PATCH v2 2/2] dts: rockpro64: Disable usb regulators-always-on

Hi Marek,

Quoted 4 lines · Marek Vasut
Quoted 1 line · Shantur Rathore

USB port regulators should be controlled by phys

Quoted 8 lines

PHYs

Quoted 4 lines

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

Quoted 8 lines
Quoted 4 lines

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.

Quoted 2 lines

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.

#5 lore raw

Re: [PATCH v2 2/2] dts: rockpro64: Disable usb regulators-always-on

Hi Marek,

Quoted 28 lines · Shantur Rathore

Hi Marek,

Quoted 4 lines · Marek Vasut
Quoted 1 line · Shantur Rathore

USB port regulators should be controlled by phys

Quoted 8 lines

PHYs

Quoted 4 lines

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

Quoted 8 lines
Quoted 4 lines

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 ?

Quoted 6 lines

No, there is no patch yet for this in Linux upstream.

Quoted 2 lines

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/[email protected]/
[1] - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Thanks,
Shantur

#6 lore raw

Re: [PATCH v2 2/2] dts: rockpro64: Disable usb regulators-always-on

In reply to Shantur Rathore
Quoted 23 lines · Shantur Rathore

Hi Marek,

Quoted 4 lines · Marek Vasut
Quoted 1 line · Shantur Rathore

USB port regulators should be controlled by phys

Quoted 8 lines

PHYs

Quoted 4 lines

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

Quoted 5 lines
Quoted 4 lines

phy-supply in upstream and
now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.

Quoted 5 lines
Quoted 3 lines

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 .

#7 lore raw

Re: [PATCH v2 2/2] dts: rockpro64: Disable usb regulators-always-on

Quoted 25 lines · Marek Vasut
Quoted 23 lines · Shantur Rathore

Hi Marek,

Quoted 4 lines · Marek Vasut
Quoted 1 line · Shantur Rathore

USB port regulators should be controlled by phys

Quoted 8 lines

PHYs

Quoted 4 lines

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

Quoted 5 lines
Quoted 4 lines

phy-supply in upstream and
now that we are removing always-on, we need to fix the phy-supply until its fixed upstream.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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.

#8 lore raw

Re: [PATCH v2 2/2] dts: rockpro64: Disable usb regulators-always-on

Quoted 31 lines · Shantur Rathore
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Shantur Rathore

Hi Marek,

Quoted 4 lines · Marek Vasut
Quoted 1 line · Shantur Rathore

USB port regulators should be controlled by phys

Quoted 8 lines

PHYs

Quoted 4 lines

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

Quoted 8 lines
Quoted 4 lines

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 ?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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/[email protected]/