Skip to contentSkip to conversation

usb: onboard-hub: VL817 support for SpacemiT K1 boards

PATCH Applied Hung-Chun Tseng 3 participants 8 messages Nov 13 – Nov 18 RISC-V SpacemiT SoC Support

lore
Share & tools
lore
#0 lore raw

v2 cover usb: onboard-hub: VL817 support for SpacemiT K1 boards

The Milk-V Jupiter and the Banana Pi BPI-F3 put a VIA Labs VL817 hub in front of all their USB ports. Its supply and reset are GPIOs, so usb start only finds the root hub until someone powers the hub by hand.

This adds the VL817 to the onboard hub driver and enables it for K1.

Tested on a Milk-V Jupiter, cold boot from SD: usb start finds both VL817 hubs and a USB 3 stick at 5 Gb/s, with no manual GPIO setup. That test capped DRAM at 4 GiB to avoid the K1 DRAM sizing bug, which is now fixed in main by commit e6308cc14 ("spacemit: k1: drop the CS1 DRAM map on single-rank boards").

Changes in v2:
- Rebased on main.
- Added Zixian's Tested-by to 1/2.

v1: <[email protected]>

Hung-Chun Tseng (2):
usb: onboard-hub: Add support for VIA Labs VL817
configs: spacemit_k1: Enable onboard USB hub support

 common/usb_onboard_hub.c      | 14 +++++++++++++-
 configs/spacemit_k1_defconfig |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)
Signature · 1 line
2.56.1
#1 lore raw

PATCH v2 1/2 usb: onboard-hub: Add support for VIA Labs VL817

The VL817 is a USB 3.1 Gen 1 hub controller with one supply and a reset pin. Use the same reset time as Linux.

The Milk-V Jupiter and the Banana Pi BPI-F3 have one in front of all their USB ports. Without this, U-Boot leaves the hub unpowered and in reset, so no USB device is found.

---
 common/usb_onboard_hub.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
common/usb_onboard_hub.c +13 -1
index 0684f7bfd..0ed70a6ba 100644
@@ -289,9 +289,21 @@ static const struct onboard_hub_data usbhx3_data = {
 	.supply_names = { "vdd-supply", "vdd2-supply" },
 };
 
+static const struct onboard_hub_data vialab_vl817_data = {
+	.reset_us = 10,
+	.num_supplies = 1,
+	.supply_names = { "vdd-supply" },
+};
+
 static const struct udevice_id usb_onboard_hub_ids[] = {
 	/* Use generic usbVID,PID dt-bindings (usb-device.yaml) */
-	{	.compatible = "usb3431,6241",	/* Corechips SL6341 USB 2.0 */
+	{	.compatible = "usb2109,2817",	/* VIA Labs VL817 USB 2.0 */
+		.data = (ulong)&vialab_vl817_data,
+	}, {
+		.compatible = "usb2109,817",	/* VIA Labs VL817 USB 3.0 */
+		.data = (ulong)&vialab_vl817_data,
+	}, {
+		.compatible = "usb3431,6241",	/* Corechips SL6341 USB 2.0 */
 		.data = (ulong)&corechips_sl6341_data,
 	}, {
 		.compatible = "usb3431,6341",	/* Corechips SL6341 USB 3.0 */
Signature · 1 line
2.56.1
maintainer
#2 lore raw

Re: [PATCH v2 1/2] usb: onboard-hub: Add support for VIA Labs VL817

Hi Marek,

Quoted 7 lines · Hung-Chun Tseng

The VL817 is a USB 3.1 Gen 1 hub controller with one supply and a reset pin. Use the same reset time as Linux.

The Milk-V Jupiter and the Banana Pi BPI-F3 have one in front of all their USB ports. Without this, U-Boot leaves the hub unpowered and in reset, so no USB device is found.

Quoted 5 lines
---
 common/usb_onboard_hub.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

would you prefer to take this patch via usb tree?
or I could queue it in spacemit custodian tree,
either way works for me, just let me know

Signature · 1 line
Yixun Lan (dlan)
Reviewed-by on v2 1/2
#3 lore raw

Re: [PATCH v2 1/2] usb: onboard-hub: Add support for VIA Labs VL817

In reply to Hung-Chun Tseng
Quoted 9 lines · Hung-Chun Tseng

The VL817 is a USB 3.1 Gen 1 hub controller with one supply and a reset pin. Use the same reset time as Linux.

The Milk-V Jupiter and the Banana Pi BPI-F3 have one in front of all their USB ports. Without this, U-Boot leaves the hub unpowered and in reset, so no USB device is found.

#4 lore raw

PATCH v2 2/2 configs: spacemit_k1: Enable onboard USB hub support

In reply to Hung-Chun Tseng

The Milk-V Jupiter and the Banana Pi BPI-F3 need the VL817 hub to be powered and taken out of reset before their USB ports work.

---
 configs/spacemit_k1_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/spacemit_k1_defconfig +1 -0
index b8f777e89..31e429c03 100644
@@ -117,4 +117,5 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_STORAGE=y
+CONFIG_USB_ONBOARD_HUB=y
 CONFIG_SPL_LIB_RATIONAL=y
Signature · 1 line
2.56.1
maintainer Reviewed-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] configs: spacemit_k1: Enable onboard USB hub support

Quoted 4 lines · Hung-Chun Tseng

The Milk-V Jupiter and the Banana Pi BPI-F3 need the VL817 hub to be powered and taken out of reset before their USB ports work.

Quoted 17 lines
---
 configs/spacemit_k1_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/spacemit_k1_defconfig +1 -0
index b8f777e89..31e429c03 100644
@@ -117,4 +117,5 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_STORAGE=y
+CONFIG_USB_ONBOARD_HUB=y
 CONFIG_SPL_LIB_RATIONAL=y
Signature · 1 line
2.56.1
Signature · 1 line
Yixun Lan (dlan)
maintainer Reviewed-by on the v2 series
#6 lore raw
In reply to Hung-Chun Tseng

Hi Hung-Chun,

Quoted 19 lines · Hung-Chun Tseng

The Milk-V Jupiter and the Banana Pi BPI-F3 put a VIA Labs VL817 hub in front of all their USB ports. Its supply and reset are GPIOs, so usb start only finds the root hub until someone powers the hub by hand.

This adds the VL817 to the onboard hub driver and enables it for K1.

Tested on a Milk-V Jupiter, cold boot from SD: usb start finds both VL817 hubs and a USB 3 stick at 5 Gb/s, with no manual GPIO setup. That test capped DRAM at 4 GiB to avoid the K1 DRAM sizing bug, which is now fixed in main by commit e6308cc14 ("spacemit: k1: drop the CS1 DRAM map on single-rank boards").

Changes in v2:
- Rebased on main.
- Added Zixian's Tested-by to 1/2.

v1: <[email protected]>

Quoted 7 lines

Hung-Chun Tseng (2):
usb: onboard-hub: Add support for VIA Labs VL817
configs: spacemit_k1: Enable onboard USB hub support

 common/usb_onboard_hub.c      | 14 +++++++++++++-
 configs/spacemit_k1_defconfig |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

The series looks good, with

Signature · 1 line
Yixun Lan (dlan)
maintainer Applied
#7 lore raw

Re: (subset) [PATCH v2 0/2] usb: onboard-hub: VL817 support for SpacemiT K1 boards

In reply to Hung-Chun Tseng
Quoted 8 lines · Hung-Chun Tseng

The Milk-V Jupiter and the Banana Pi BPI-F3 put a VIA Labs VL817 hub in front of all their USB ports. Its supply and reset are GPIOs, so usb start only finds the root hub until someone powers the hub by hand.

This adds the VL817 to the onboard hub driver and enables it for K1.

[...]

Applied, thanks! Queued in SpacemiT custodian tree, for-main branch

[2/2] configs: spacemit_k1: Enable onboard USB hub support

      https://git.u-boot-project.org/u-boot/custodians/u-boot-spacemit/-/commit/d28d5f8162865bf76d6fab677a926b3797a0ff8d

Best regards,

Signature · 1 line
Yixun Lan <[email protected]>