Skip to contentSkip to conversation

Used onboard HUB to reset and add power to hub

PATCH Superseded Anand Moon 5 participants 23 messages Jan 21, 2023 – Aug 6, 2023

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Anand Moon

author
#0 lore raw

v3 cover Used onboard HUB to reset and add power to hub

Amlogic board use gpio-hog to reset the USB hub.
so using onboard hub we could reset the USB hub and also enable power to the USB hub.
v3: Fix some small changes in $subject
address the input from Neil
fix the vialab device tree binding as per Krzysztof inputs.

v2: Odroid C1 / C2 : usb hub reset working as expected.
Odroid N2 : dropped usb hub changes, since my board USB hub
is hitting regression.
Odroid C4 : Fix the device tree binding and used peer-hub for
usb2.0 and usb3.0 hub.
[1] https://lore.kernel.org/all/[email protected]

v1: Odroid C1 / C2 : were not working as expected.
Odroid N2 : used single USB 3.0 hub reset. Odroid C4 : used single USB 3.0 hub reset.

[0] https://patchwork.kernel.org/project/linux-amlogic/list/?series=707292

Any inputs for these changes ?

Thanks
-Anand

Anand Moon (9):
dt-bindings: usb: Add device id for Genesys Logic hub controller
ARM: dts: amlogic: Used onboard usb hub reset on odroid c1
arm64: dts: amlogic: Used onboard usb hub reset on odroid c2
usb: misc: onboard_usb_hub: add Genesys Logic GL852G hub support
vendor-prefixes: Add VIA Labs, Inc.
dt-bindings: usb: Add Via lab VL817 hub
arm64: dts: amlogic: Used onboard usb hub reset on odroid c4
usb: misc: onboard_usb_hub: add VIA LAB VL817 hub support
arm64: defconfig: Enable USB onboard HUB driver

 .../bindings/usb/genesys,gl850g.yaml          |  1 +
 .../devicetree/bindings/usb/vialab,vl817.yaml | 71 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 arch/arm/boot/dts/meson8b-odroidc1.dts        | 23 +++---
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 25 +++----
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 33 +++++----
 arch/arm64/configs/defconfig                  |  1 +
 drivers/usb/misc/onboard_usb_hub.c            |  4 ++
 drivers/usb/misc/onboard_usb_hub.h            | 11 +++
 9 files changed, 131 insertions(+), 40 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/vialab,vl817.yaml
Signature · 7 lines
2.38.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
author
#1 lore raw

PATCH v3 1/9 dt-bindings: usb: Add device id for Genesys Logic hub controller

Add usb hub device id for Genesys Logic, Inc. GL852G Hub USB 2.0 root hub.

---
v3: - add Ack of Krzysztof
v2: - drop the vendor name from compatible string.
- drop the -OTG and -QFN76 suffix from commit message.
- drop the GL3523 USB 3.1 root hub device id.

---
 Documentation/devicetree/bindings/usb/genesys,gl850g.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/usb/genesys,gl850g.yaml +1 -0
index a9f831448cca..cc4cf92b70d1 100644
@@ -16,6 +16,7 @@ properties:
   compatible:
     enum:
       - usb5e3,608
+      - usb5e3,610
 
   reg: true
 
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH v3 1/9] dt-bindings: usb: Add device id for Genesys Logic hub controller

Quoted 10 lines · Anand Moon

Add usb hub device id for Genesys Logic, Inc. GL852G Hub USB 2.0 root hub.

---
v3: - add Ack of Krzysztof
v2: - drop the vendor name from compatible string.
- drop the -OTG and -QFN76 suffix from commit message.
- drop the GL3523 USB 3.1 root hub device id.

I only see 4 of the 9 patches sent to the linux-usb list and cc: me, so I'm totally confused.

I'll drop them all from my review queue now and expect a full series to show up if they are needed to be merged through the USB tree

thanks,

greg k-h

author
#3 lore raw

Re: [PATCH v3 1/9] dt-bindings: usb: Add device id for Genesys Logic hub controller

Hi Greg,

Thanks for your review comments.

Quoted 13 lines · Greg Kroah-Hartman
Quoted 10 lines · Anand Moon

Add usb hub device id for Genesys Logic, Inc. GL852G Hub USB 2.0 root hub.

---
v3: - add Ack of Krzysztof
v2: - drop the vendor name from compatible string.
- drop the -OTG and -QFN76 suffix from commit message.
- drop the GL3523 USB 3.1 root hub device id.

Quoted 8 lines

I only see 4 of the 9 patches sent to the linux-usb list and cc: me, so I'm totally confused.

I'll drop them all from my review queue now and expect a full series to show up if they are needed to be merged through the USB tree

thanks,

Sorry for this mixup from my side.
I will send the full series of patches again tmr

Quoted 1 line

greg k-h

Thanks
-Anand

author
#4 lore raw

PATCH v3 2/9 ARM: dts: amlogic: Used onboard usb hub reset on odroid c1

In reply to Anand Moon

On Odroid c1 previously use gpio-hog to reset the usb hub, switch to used on board usb hub reset to enable the usb hub and enable power to usb hub.

Add usb hub regulator as per the schematic.

---
v3 - Add Rev by Neil.
update the subject with odroid C1
dropped dr_mode
v2 - drop the vendor name from compatible string.
- move the hub node to USB controller node.
- drop the usb_otg_pwr since it only liked to OTG port and link p5v0 to the vdd-supply.

---
 arch/arm/boot/dts/meson8b-odroidc1.dts | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
arch/arm/boot/dts/meson8b-odroidc1.dts +10 -13
index 04356bc639fa..04c4bdca0b85 100644
@@ -281,19 +281,6 @@ &gpio_ao {
 			  "J7 Header Pin 6", "J7 Header Pin 5",
 			  "J7 Header Pin 7", "HDMI_CEC",
 			  "SYS_LED", "", "";
-
-	/*
-	 * WARNING: The USB Hub on the Odroid-C1/C1+ needs a reset signal
-	 * to be turned high in order to be detected by the USB Controller.
-	 * This signal should be handled by a USB specific power sequence
-	 * in order to reset the Hub when USB bus is powered down.
-	 */
-	usb-hub {
-		gpio-hog;
-		gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
-		output-high;
-		line-name = "usb-hub-reset";
-	};
 };
 
 &ir_receiver {
@@ -381,5 +368,15 @@ &usb1_phy {
 };
 
 &usb1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
 	status = "okay";
+
+	hub@1 {
+		/* Genesys Logic GL852G usb hub */
+		compatible = "usb5e3,610";
+		reg = <1>;
+		vdd-supply = <&p5v0>;
+		reset-gpio = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
+	};
 };
Signature · 1 line
2.38.1
author
#5 lore raw

PATCH v3 3/9 arm64: dts: amlogic: Used onboard usb hub reset on odroid c2

In reply to Anand Moon

On Odroid c2 previously use gpio-hog to reset the usb hub, switch to used on-board usb hub reset to enable the usb hub and enable power to hub.

---
v3 - Add rev by Neil.
droped dr_mode
v2 - drop the vendor name from compatible string.
- move the hub node to USB controller node.
- drop the usb_otg_pwr since it only liked to OTG port and link p5v0 to the vdd-supply.

---
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 25 ++++++++-----------
 1 file changed, 10 insertions(+), 15 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +10 -15
index 201596247fd9..70b10934a811 100644
@@ -250,21 +250,6 @@ eth_phy0: ethernet-phy@0 {
 	};
 };
 
-&gpio_ao {
-	/*
-	 * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
-	 * to be turned high in order to be detected by the USB Controller
-	 * This signal should be handled by a USB specific power sequence
-	 * in order to reset the Hub when USB bus is powered down.
-	 */
-	hog-0 {
-		gpio-hog;
-		gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
-		output-high;
-		line-name = "usb-hub-reset";
-	};
-};
-
 &hdmi_tx {
 	status = "okay";
 	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
@@ -414,5 +399,15 @@ &usb0 {
 };
 
 &usb1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
 	status = "okay";
+
+	hub@1 {
+		/* Genesys Logic GL852G USB 2.0 hub */
+		compatible = "usb5e3,610";
+		reg = <1>;
+		vdd-supply = <&p5v0>;
+		reset-gpio = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
+	};
 };
Signature · 1 line
2.38.1
#6 lore raw

Re: [PATCH v3 3/9] arm64: dts: amlogic: Used onboard usb hub reset on odroid c2

Quoted 62 lines · Anand Moon

On Odroid c2 previously use gpio-hog to reset the usb hub, switch to used on-board usb hub reset to enable the usb hub and enable power to hub.

---
v3 - Add rev by Neil.
droped dr_mode
v2 - drop the vendor name from compatible string.
- move the hub node to USB controller node.
- drop the usb_otg_pwr since it only liked to OTG port and link p5v0 to the vdd-supply.

---
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 25 ++++++++-----------
 1 file changed, 10 insertions(+), 15 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +10 -15
index 201596247fd9..70b10934a811 100644
@@ -250,21 +250,6 @@ eth_phy0: ethernet-phy@0 {
 	};
 };
 
-&gpio_ao {
-	/*
-	 * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
-	 * to be turned high in order to be detected by the USB Controller
-	 * This signal should be handled by a USB specific power sequence
-	 * in order to reset the Hub when USB bus is powered down.
-	 */
-	hog-0 {
-		gpio-hog;
-		gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
-		output-high;
-		line-name = "usb-hub-reset";
-	};
-};
-
 &hdmi_tx {
 	status = "okay";
 	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
@@ -414,5 +399,15 @@ &usb0 {
 };
 
 &usb1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
 	status = "okay";
+
+	hub@1 {
+		/* Genesys Logic GL852G USB 2.0 hub */
+		compatible = "usb5e3,610";
+		reg = <1>;
+		vdd-supply = <&p5v0>;
+		reset-gpio = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
+	};
 };
Signature · 1 line
2.38.1

Hello,

This patch breaks USB support on the ODROID-C2. As soon as the onboard_usb_hub module is loaded, all USB devices disconnect. Blacklisting onboard_usb_hub makes USB work as expected.

I tried to reproduce the problem by manually toggling the reset line, but the problem seems to be specific to this driver. When reset is asserted manually, the devices disconnect, but they all enumerate again as soon as reset is released.

Also, I have been unable to make USB work again (until the next reboot) even after unloading onboard_usb_hub.

Ben

#7 lore raw

Re: [PATCH v3 3/9] arm64: dts: amlogic: Used onboard usb hub reset on odroid c2

Quoted 5 lines · Ben Wolsieffer
Quoted 4 lines · Anand Moon

On Odroid c2 previously use gpio-hog to reset the usb hub, switch to used on-board usb hub reset to enable the usb hub and enable power to hub.

...

Quoted 18 lines
Quoted 11 lines
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +7 -0
+	hub@1 {
+		/* Genesys Logic GL852G USB 2.0 hub */
+		compatible = "usb5e3,610";
+		reg = <1>;
+		vdd-supply = <&p5v0>;
+		reset-gpio = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
+	};
 };
Signature · 1 line
2.38.1

Hello,

This patch breaks USB support on the ODROID-C2. As soon as the onboard_usb_hub module is loaded, all USB devices disconnect. Blacklisting onboard_usb_hub makes USB work as expected.

Quoted 7 lines

I tried to reproduce the problem by manually toggling the reset line, but the problem seems to be specific to this driver. When reset is asserted manually, the devices disconnect, but they all enumerate again as soon as reset is released.

Also, I have been unable to make USB work again (until the next reboot) even after unloading onboard_usb_hub.

Wasn't this patch made exactly to fix USB support, not break it? I might be missing something but maybe this was not tested at all?

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v3 3/9] arm64: dts: amlogic: Used onboard usb hub reset on odroid c2

Quoted 13 lines · Krzysztof Kozlowski
Quoted 12 lines · Ben Wolsieffer

Hello,

This patch breaks USB support on the ODROID-C2. As soon as the onboard_usb_hub module is loaded, all USB devices disconnect. Blacklisting onboard_usb_hub makes USB work as expected.

I tried to reproduce the problem by manually toggling the reset line, but the problem seems to be specific to this driver. When reset is asserted manually, the devices disconnect, but they all enumerate again as soon as reset is released.

Quoted 9 lines
Quoted 2 lines

Also, I have been unable to make USB work again (until the next reboot) even after unloading onboard_usb_hub.

Wasn't this patch made exactly to fix USB support, not break it? I might be missing something but maybe this was not tested at all?

Best regards,
Krzysztof

I have been using USB on the ODROID-C2 for several years without issues. It looks to me that this patch was designed to make reset control for the hub more elegant, rather than fix a specific issue. The same change was applied to several devices, so it seems plausible that it was not tested on all of them.

Thanks, Ben

author
#9 lore raw

Re: [PATCH v3 3/9] arm64: dts: amlogic: Used onboard usb hub reset on odroid c2

Hi Ben,

Quoted 25 lines · Ben Wolsieffer
Quoted 13 lines · Krzysztof Kozlowski
Quoted 12 lines · Ben Wolsieffer

Hello,

This patch breaks USB support on the ODROID-C2. As soon as the onboard_usb_hub module is loaded, all USB devices disconnect. Blacklisting onboard_usb_hub makes USB work as expected.

I tried to reproduce the problem by manually toggling the reset line, but the problem seems to be specific to this driver. When reset is asserted manually, the devices disconnect, but they all enumerate again as soon as reset is released.

Quoted 9 lines
Quoted 2 lines

Also, I have been unable to make USB work again (until the next reboot) even after unloading onboard_usb_hub.

Wasn't this patch made exactly to fix USB support, not break it? I might be missing something but maybe this was not tested at all?

Best regards,
Krzysztof

Quoted 6 lines

I have been using USB on the ODROID-C2 for several years without issues. It looks to me that this patch was designed to make reset control for the hub more elegant, rather than fix a specific issue. The same change was applied to several devices, so it seems plausible that it was not tested on all of them.

We tried to fix quite a few issues in the past but still, we could not resolve core issues.
Will try to resolve these issues in the future.
I have tested these changes at my end on Odroid C1+, Odroid C2, and Odroid C4,

Quoted 1 line

Thanks, Ben

Thanks
-Anand

author
#10 lore raw

PATCH v3 4/9 usb: misc: onboard_usb_hub: add Genesys Logic GL852G hub support

In reply to Anand Moon

Genesys Logic GL852G is a 4-port USB 2.0 STT hub that has a reset pin to toggle and a 5.0V core supply exported though an integrated LDO is available for powering it.

Add the support for this hub, for controlling the reset pin and the core power supply.

---
v3: - Add Ack Matthias
v2: - fix the compatible string
- drop the -OHG suffix from commit message.
- Add reset delay.

---
 drivers/usb/misc/onboard_usb_hub.c | 1 +
 drivers/usb/misc/onboard_usb_hub.h | 5 +++++
 2 files changed, 6 insertions(+)
drivers/usb/misc/onboard_usb_hub.c +1 -0
index 94e7966e199d..9bf59792fb94 100644
@@ -409,6 +409,7 @@ static void onboard_hub_usbdev_disconnect(struct usb_device *udev)
 
 static const struct usb_device_id onboard_hub_id_table[] = {
 	{ USB_DEVICE(VENDOR_ID_GENESYS, 0x0608) }, /* Genesys Logic GL850G USB 2.0 */
+	{ USB_DEVICE(VENDOR_ID_GENESYS, 0x0610) }, /* Genesys Logic GL852G USB 2.0 */
 	{ USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2514) }, /* USB2514B USB 2.0 */
 	{ USB_DEVICE(VENDOR_ID_REALTEK, 0x0411) }, /* RTS5411 USB 3.1 */
 	{ USB_DEVICE(VENDOR_ID_REALTEK, 0x5411) }, /* RTS5411 USB 2.1 */
drivers/usb/misc/onboard_usb_hub.h +5 -0
index 62129a6a1ba5..163fc07abf25 100644
@@ -26,11 +26,16 @@ static const struct onboard_hub_pdata genesys_gl850g_data = {
 	.reset_us = 3,
 };
 
+static const struct onboard_hub_pdata genesys_gl852g_data = {
+	.reset_us = 50,
+};
+
 static const struct of_device_id onboard_hub_match[] = {
 	{ .compatible = "usb424,2514", .data = &microchip_usb424_data, },
 	{ .compatible = "usb451,8140", .data = &ti_tusb8041_data, },
 	{ .compatible = "usb451,8142", .data = &ti_tusb8041_data, },
 	{ .compatible = "usb5e3,608", .data = &genesys_gl850g_data, },
+	{ .compatible = "usb5e3,610", .data = &genesys_gl852g_data, },
 	{ .compatible = "usbbda,411", .data = &realtek_rts5411_data, },
 	{ .compatible = "usbbda,5411", .data = &realtek_rts5411_data, },
 	{ .compatible = "usbbda,414", .data = &realtek_rts5411_data, },
Signature · 1 line
2.38.1
author
#11 lore raw

PATCH v3 5/9 vendor-prefixes: Add VIA Labs, Inc.

In reply to Anand Moon

Add the vendor prefix for VIA Labs, Inc. (VLI) is a supplier of USB and USB Power Delivery controllers for multi-functional devices and platforms.

Website: https://www.via-labs.com/

---
v3: - None
V2: - drop Drop marketing, so without "leading".
- add Ack of Krzysztof

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 70ffb3780621..d19b7f9cef4c 100644
@@ -1398,6 +1398,8 @@ patternProperties:
     description: Vertexcom Technologies, Inc.
   "^via,.*":
     description: VIA Technologies, Inc.
+  "^vialab,.*":
+    description: VIA Labs, Inc.
   "^vicor,.*":
     description: Vicor Corporation
   "^videostrong,.*":
Signature · 7 lines
2.38.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#12 lore raw

Re: [PATCH v3 5/9] vendor-prefixes: Add VIA Labs, Inc.

Quoted 11 lines · Anand Moon

Add the vendor prefix for VIA Labs, Inc. (VLI) is a supplier of USB and USB Power Delivery controllers for multi-functional devices and platforms.

Website: https://www.via-labs.com/

---
v3: - None
V2: - drop Drop marketing, so without "leading".

Wasn't this merged? Didn't you get email?

Best regards,
Krzysztof

author
#13 lore raw

Re: [PATCH v3 5/9] vendor-prefixes: Add VIA Labs, Inc.

Hi Krzysztof,

Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 lines · Anand Moon

Add the vendor prefix for VIA Labs, Inc. (VLI) is a supplier of USB and USB Power Delivery controllers for multi-functional devices and platforms.

Website: https://www.via-labs.com/

Quoted 8 lines
Quoted 5 lines

---
v3: - None
V2: - drop Drop marketing, so without "leading".

Wasn't this merged? Didn't you get email?

Yes, it was merged into USB testing branch.
I have rebased it on Linux master 6.2-rc5,
I hope this series picks up again.

Quoted 3 lines

Best regards,
Krzysztof

Thanks
-Anand

#14 lore raw

Re: [PATCH v3 5/9] vendor-prefixes: Add VIA Labs, Inc.

Quoted 18 lines · Anand Moon

Hi Krzysztof,

Quoted 14 lines · Krzysztof Kozlowski
Quoted 11 lines · Anand Moon

Add the vendor prefix for VIA Labs, Inc. (VLI) is a supplier of USB and USB Power Delivery controllers for multi-functional devices and platforms.

Website: https://www.via-labs.com/

---
v3: - None
V2: - drop Drop marketing, so without "leading".

Quoted 6 lines
Quoted 2 lines

Wasn't this merged? Didn't you get email?

Yes, it was merged into USB testing branch.
I have rebased it on Linux master 6.2-rc5,
I hope this series picks up again.

No, that's not how it works. If patch was picked up, you must drop it. Otherwise you might mislead maintainers (e.g. other maintainer) to pick it up again.

Best regards,
Krzysztof

author
#15 lore raw

Re: [PATCH v3 5/9] vendor-prefixes: Add VIA Labs, Inc.

Hi Krzysztof,

Quoted 23 lines · Krzysztof Kozlowski
Quoted 21 lines · Anand Moon

Hi Krzysztof,

Quoted 16 lines · Krzysztof Kozlowski
Quoted 11 lines · Anand Moon

Add the vendor prefix for VIA Labs, Inc. (VLI) is a supplier of USB and USB Power Delivery controllers for multi-functional devices and platforms.

Website: https://www.via-labs.com/

---
v3: - None
V2: - drop Drop marketing, so without "leading".

Wasn't this merged? Didn't you get email?

Quoted 8 lines
Quoted 3 lines

Yes, it was merged into USB testing branch.
I have rebased it on Linux master 6.2-rc5,
I hope this series picks up again.

No, that's not how it works. If patch was picked up, you must drop it. Otherwise you might mislead maintainers (e.g. other maintainer) to pick it up again.

Ok I will keep this in my mind for the future.

Quoted 4 lines

Best regards,
Krzysztof

Thanks
-Anand

author
#16 lore raw

PATCH v3 6/9 dt-bindings: usb: Add Via lab VL817 hub

In reply to Anand Moon

The VIA Lab VL817 is a USB 3.1 Gen 1 hub and USB 2.0 hub controller that features 4 downstream ports and 1 otg, with an internal 5V regulator and has external reset pin.

Add a device tree binding for its USB protocol part. The internal LDO is not covered by this and can just be modelled as a fixed regulator.

Add combo of USB 2.0 and USB 3.0 root hub using peer-hub.

---
v3 - address review coments - Krzysztof
dropped dr_mode
v2 - fix the compatible string and fix the $id
- update the commit message.
- update the example for use peer-hub node because it combo of USB 2.0 and USB 3.0 hub.
- rename the yaml file from vialab,vl817q7.yaml to vialab,vl817.yaml as q7 suffix is ued for USB 3.1 and q5 suffix is used for USB 2.0.

---
 .../devicetree/bindings/usb/vialab,vl817.yaml | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/vialab,vl817.yaml
Documentation/devicetree/bindings/usb/vialab,vl817.yaml new file +71 -0
new file mode 100644
index 000000000000..23a13e1d5c7a
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/vialab,vl817.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Via labs VL817 USB 3.1 hub controller
+
+maintainers:
+  - Anand Moon <[email protected]>
+
+allOf:
+  - $ref: usb-device.yaml#
+
+properties:
+  compatible:
+    enum:
+      - usb2109,2817
+      - usb2109,817
+
+  reg: true
+
+  reset-gpios:
+    maxItems: 1
+    description:
+      GPIO controlling the RESET# pin.
+
+  vdd-supply:
+    description:
+      phandle to the regulator that provides power to the hub.
+
+  peer-hub:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      phandle to the peer hub on the controller.
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - vdd-supply
+  - peer-hub
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    usb {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        /* 2.0 hub on port 1 */
+        hub_2_0: hub@1 {
+            compatible = "usb2109,2817";
+            reg = <1>;
+            vdd-supply = <&vcc_5v>;
+            peer-hub = <&hub_3_0>;
+            reset-gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
+        };
+
+        /* 3.1 hub on port 4 */
+        hub_3_0: hub@2 {
+            compatible = "usb2109,817";
+            reg = <2>;
+            vdd-supply = <&vcc_5v>;
+            peer-hub = <&hub_2_0>;
+            reset-gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
+        };
+    };
Signature · 7 lines
2.38.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Reviewed-by on v3 6/9
#17 lore raw

Re: [PATCH v3 6/9] dt-bindings: usb: Add Via lab VL817 hub

Quoted 8 lines · Anand Moon

The VIA Lab VL817 is a USB 3.1 Gen 1 hub and USB 2.0 hub controller that features 4 downstream ports and 1 otg, with an internal 5V regulator and has external reset pin.

Add a device tree binding for its USB protocol part. The internal LDO is not covered by this and can just be modelled as a fixed regulator.

Quoted 5 lines

Add combo of USB 2.0 and USB 3.0 root hub using peer-hub.

---
v3 - address review coments - Krzysztof

Best regards,
Krzysztof

author
#18 lore raw

PATCH v3 7/9 arm64: dts: amlogic: Used onboard usb hub reset on odroid c4

In reply to Anand Moon

On Odroid c4 previously use gpio-hog to reset the usb hub, switch to used on-board usb hub reset to enable the usb hub and enable power to hub.

USB hub is combination of USB 2.0 and USB 3.0 root hub so use peer-hub node to link then.

---
v3: - move the usb hub under dwc3 node.
dropped dr_mode
v2: - fix the compatible string.
- Fix the hub node to use peer-hub to link the usb 2.0 and usb 3.0.

---
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 33 ++++++++++++-------
 1 file changed, 21 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +21 -12
index 8c30ce63686e..a988015dd2d5 100644
@@ -28,18 +28,27 @@ sound {
 	};
 };
 
-&gpio {
-	/*
-	 * WARNING: The USB Hub on the Odroid-C4 needs a reset signal
-	 * to be turned high in order to be detected by the USB Controller
-	 * This signal should be handled by a USB specific power sequence
-	 * in order to reset the Hub when USB bus is powered down.
-	 */
-	hog-0 {
-		gpio-hog;
-		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
-		output-high;
-		line-name = "usb-hub-reset";
+&dwc3 {
+	/* USB hub supports both USB 2.0 and USB 3.0 root hub */
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	/* 2.0 hub on port 1 */
+	hub_2_0: hub@1 {
+		compatible = "usb2109,2817";
+		reg = <1>;
+		peer-hub = <&hub_3_0>;
+		reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>;
+		vdd-supply = <&vcc_5v>;
+	};
+
+	/* 3.1 hub on port 4 */
+	hub_3_0: hub@2 {
+		compatible = "usb2109,817";
+		reg = <2>;
+		peer-hub = <&hub_2_0>;
+		reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>;
+		vdd-supply = <&vcc_5v>;
 	};
 };
 
Signature · 7 lines
2.38.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
author
#19 lore raw

PATCH v3 8/9 usb: misc: onboard_usb_hub: add VIA LAB VL817 hub support

In reply to Anand Moon

VIA LAB VL817 is a 4-port USB 3.1 hub and USB 2.0 root hub that has a reset pin to toggle and a 5.0V core supply exported though an integrated LDO is available for powering it.

Add the support for this hub, for controlling the reset pin and the core power supply.

Add USB device id's for USB 2.0 and USB 3.0 root hub.

---
v3 - Add ack Matthias
v2 - fix the compatible string and update the commit message
- update the USB device id for USB 3.0 and USB 2.0 root hub.

---
 drivers/usb/misc/onboard_usb_hub.c | 3 +++
 drivers/usb/misc/onboard_usb_hub.h | 6 ++++++
 2 files changed, 9 insertions(+)
drivers/usb/misc/onboard_usb_hub.c +3 -0
index 9bf59792fb94..945d4e7125ea 100644
@@ -335,6 +335,7 @@ static struct platform_driver onboard_hub_driver = {
 #define VENDOR_ID_MICROCHIP	0x0424
 #define VENDOR_ID_REALTEK	0x0bda
 #define VENDOR_ID_TI		0x0451
+#define VENDOR_ID_VIA		0x2109
 
 /*
  * Returns the onboard_hub platform device that is associated with the USB
@@ -417,6 +418,8 @@ static const struct usb_device_id onboard_hub_id_table[] = {
 	{ USB_DEVICE(VENDOR_ID_REALTEK, 0x5414) }, /* RTS5414 USB 2.1 */
 	{ USB_DEVICE(VENDOR_ID_TI, 0x8140) }, /* TI USB8041 3.0 */
 	{ USB_DEVICE(VENDOR_ID_TI, 0x8142) }, /* TI USB8041 2.0 */
+	{ USB_DEVICE(VENDOR_ID_VIA, 0x0817) }, /* VIA VL817 3.1 */
+	{ USB_DEVICE(VENDOR_ID_VIA, 0x2817) }, /* VIA VL817 2.0 */
 	{}
 };
 MODULE_DEVICE_TABLE(usb, onboard_hub_id_table);
drivers/usb/misc/onboard_usb_hub.h +6 -0
index 163fc07abf25..0a943a154649 100644
@@ -30,6 +30,10 @@ static const struct onboard_hub_pdata genesys_gl852g_data = {
 	.reset_us = 50,
 };
 
+static const struct onboard_hub_pdata vialab_vl817_data = {
+	.reset_us = 10,
+};
+
 static const struct of_device_id onboard_hub_match[] = {
 	{ .compatible = "usb424,2514", .data = &microchip_usb424_data, },
 	{ .compatible = "usb451,8140", .data = &ti_tusb8041_data, },
@@ -40,6 +44,8 @@ static const struct of_device_id onboard_hub_match[] = {
 	{ .compatible = "usbbda,5411", .data = &realtek_rts5411_data, },
 	{ .compatible = "usbbda,414", .data = &realtek_rts5411_data, },
 	{ .compatible = "usbbda,5414", .data = &realtek_rts5411_data, },
+	{ .compatible = "usb2109,817", .data = &vialab_vl817_data, },
+	{ .compatible = "usb2109,2817", .data = &vialab_vl817_data, },
 	{}
 };
 
Signature · 7 lines
2.38.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
author
#20 lore raw

PATCH v3 9/9 arm64: defconfig: Enable USB onboard HUB driver

In reply to Anand Moon

Enable the USB onboard HUB driver, used on Amlogic boards.

---
v3: add rev Neil
v2: none

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 851e8f9be06d..42c3528a2473 100644
@@ -923,6 +923,7 @@ CONFIG_USB_SERIAL_CP210X=m
 CONFIG_USB_SERIAL_FTDI_SIO=m
 CONFIG_USB_SERIAL_OPTION=m
 CONFIG_USB_HSIC_USB3503=y
+CONFIG_USB_ONBOARD_HUB=m
 CONFIG_NOP_USB_XCEIV=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_RENESAS_USBHS_UDC=m
Signature · 7 lines
2.38.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
maintainer
#21 lore raw
In reply to Anand Moon

Hi Anand,

Le 21/01/2023 à 18:56, Anand Moon a écrit :

Quoted 14 lines

Amlogic board use gpio-hog to reset the USB hub.
so using onboard hub we could reset the USB hub and also enable power to the USB hub.
v3: Fix some small changes in $subject
address the input from Neil
fix the vialab device tree binding as per Krzysztof inputs.

v2: Odroid C1 / C2 : usb hub reset working as expected.
Odroid N2 : dropped usb hub changes, since my board USB hub
is hitting regression.
Odroid C4 : Fix the device tree binding and used peer-hub for
usb2.0 and usb3.0 hub.
[1] https://lore.kernel.org/all/[email protected]

Quoted 7 lines

v1: Odroid C1 / C2 : were not working as expected.
Odroid N2 : used single USB 3.0 hub reset. Odroid C4 : used single USB 3.0 hub reset.

[0] https://patchwork.kernel.org/project/linux-amlogic/list/?series=707292

Any inputs for these changes ?

Most of the patches have been applied by Greg, so rebase this serie on the lastest linux-next and send only the remaining patches.

Neil

Quoted 25 lines

Thanks
-Anand

Anand Moon (9):
dt-bindings: usb: Add device id for Genesys Logic hub controller
ARM: dts: amlogic: Used onboard usb hub reset on odroid c1
arm64: dts: amlogic: Used onboard usb hub reset on odroid c2
usb: misc: onboard_usb_hub: add Genesys Logic GL852G hub support
vendor-prefixes: Add VIA Labs, Inc.
dt-bindings: usb: Add Via lab VL817 hub
arm64: dts: amlogic: Used onboard usb hub reset on odroid c4
usb: misc: onboard_usb_hub: add VIA LAB VL817 hub support
arm64: defconfig: Enable USB onboard HUB driver

  .../bindings/usb/genesys,gl850g.yaml          |  1 +
  .../devicetree/bindings/usb/vialab,vl817.yaml | 71 +++++++++++++++++++
  .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
  arch/arm/boot/dts/meson8b-odroidc1.dts        | 23 +++---
  .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 25 +++----
  .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 33 +++++----
  arch/arm64/configs/defconfig                  |  1 +
  drivers/usb/misc/onboard_usb_hub.c            |  4 ++
  drivers/usb/misc/onboard_usb_hub.h            | 11 +++
  9 files changed, 131 insertions(+), 40 deletions(-)
Quoted 2 lines

create mode 100644 Documentation/devicetree/bindings/usb/vialab,vl817.yaml

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

author
#22 lore raw

Hi Neil,

Quoted 22 lines · Neil Armstrong

Hi Anand,

Quoted 18 lines · Anand Moon

Amlogic board use gpio-hog to reset the USB hub.
so using onboard hub we could reset the USB hub and also enable power to the USB hub.
v3: Fix some small changes in $subject
address the input from Neil
fix the vialab device tree binding as per Krzysztof inputs.

v2: Odroid C1 / C2 : usb hub reset working as expected.
Odroid N2 : dropped usb hub changes, since my board USB hub
is hitting regression.
Odroid C4 : Fix the device tree binding and used peer-hub for
usb2.0 and usb3.0 hub.
[1] https://lore.kernel.org/all/[email protected]

v1: Odroid C1 / C2 : were not working as expected.
Odroid N2 : used single USB 3.0 hub reset. Odroid C4 : used single USB 3.0 hub reset.

Quoted 9 lines
Quoted 3 lines

[0] https://patchwork.kernel.org/project/linux-amlogic/list/?series=707292

Any inputs for these changes ?

Most of the patches have been applied by Greg, so rebase this serie on the lastest linux-next and send only the remaining patches.

Neil

Ok. Thanks
-Anand

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic