usb: onboard-hub: VL817 support for SpacemiT K1 boards
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 with the K1 USB support now in main, 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. For that test, U-Boot was limited to 4 GiB of DRAM: on this 4 GB board it reports 8 GiB, and with the extra memory usb start hung after "efi_free_pool: illegal free 0x000000027fffa040". That is a separate K1 DRAM sizing bug; I will send a fix for it on its own.
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.43.0
PATCH 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
@@ -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.43.0
Re: [PATCH 1/2] usb: onboard-hub: Add support for VIA Labs VL817
Quoted 29 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.
Signed-off-by Hung-Chun Tseng <[email protected]>--- common/usb_onboard_hub.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)common/usb_onboard_hub.c +6
-1@@ -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 */
common/usb_onboard_hub.c static const struct onboard_hub_data usbhx3_data = { · line 309
Quoted 10 lines
common/usb_onboard_hub.c +7
-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 */
It’s similar to my local version :-)
Regards,
Zixian
Re: [PATCH 1/2] usb: onboard-hub: Add support for VIA Labs VL817
In reply to Hung-Chun TsengQuoted 23 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.
Signed-off-by Hung-Chun Tseng <[email protected]>--- common/usb_onboard_hub.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)common/usb_onboard_hub.c +3
-0@@ -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,
common/usb_onboard_hub.c static const struct onboard_hub_data usbhx3_data = { · line 303
Quoted 10 lines
common/usb_onboard_hub.c +7
-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 */
Please keep the list sorted.
[...]
Re: [PATCH 1/2] usb: onboard-hub: Add support for VIA Labs VL817
Hi Marek,
Quoted 9 lines · Marek Vasut
common/usb_onboard_hub.c static const struct onboard_hub_data usbhx3_data = { · line 303
Quoted 7 lines
static const struct udevice_id usb_onboard_hub_ids[] = { /* Use generic usbVID,PID dt-bindings (usb-device.yaml) */common/usb_onboard_hub.c +4
-1- { .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 */Please keep the list sorted.
I put the new entries first to keep the list in string order: the existing entries go usb3431, usb424, usb4b4, and "usb2109" sorts before all of them.
Did you mean sorting by vendor ID as a number instead (0x424, 0x4b4, 0x2109, 0x3431)? That moves the existing entries too, so I would do it in a separate patch before this one in v2.
Thanks,
Hung-Chun
Re: [PATCH 1/2] usb: onboard-hub: Add support for VIA Labs VL817
Quoted 13 lines · Hung-Chun Tseng
Hi Marek,
Quoted 9 lines · Marek Vasut
common/usb_onboard_hub.c static const struct onboard_hub_data usbhx3_data = { · line 303
Quoted 7 lines
static const struct udevice_id usb_onboard_hub_ids[] = { /* Use generic usbVID,PID dt-bindings (usb-device.yaml) */common/usb_onboard_hub.c +4
-1- { .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 */Please keep the list sorted.
Quoted 1 line
I put the new entries first to keep the list in string order
All right.
PATCH 2/2 configs: spacemit_k1: Enable onboard USB hub support
In reply to Hung-Chun TsengThe 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
@@ -116,4 +116,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.43.0