[PATCH 12/12] riscv: dts: thead: enable USB3 ports on Lichee Pi 4A

Icenowy Zheng zhengxingda at iscas.ac.cn
Tue Sep 1 11:32:28 PDT 2026


在 2026-05-07四的 16:17 +0800,Icenowy Zheng写道:
> The Lichee Pi 4A board features an onboard VIA VL817 hub connected to
> the SoC's USB3 as upstream and 4 USB-3.0-capable Type-A ports as
> downstream.
> 
> Enable SoC USB3 and the hub on Lichee Pi 4A.
> 
> Signed-off-by: Icenowy Zheng <zhengxingda at iscas.ac.cn>
> ---
>  .../dts/thead/th1520-lichee-module-4a.dtsi    |  15 ++
>  .../boot/dts/thead/th1520-lichee-pi-4a.dts    | 231
> ++++++++++++++++++
>  2 files changed, 246 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> index 8e76b63e0100a..bfda5a6b56b8f 100644
> --- a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> +++ b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> @@ -20,6 +20,16 @@ memory at 0 {
>  		device_type = "memory";
>  		reg = <0x0 0x00000000 0x2 0x00000000>;
>  	};
> +
> +	/* TODO: Switch to AON regulator when it's available. */
> +	avdd33_usb3: regulator-avdd33-usb3 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "AVDD33_USB3";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		/* Marked as always on on the schematics */
> +		regulator-always-on;
> +	};
>  };
>  
>  &osc {
> @@ -202,3 +212,8 @@ &sdio0 {
>  	max-frequency = <198000000>;
>  	status = "okay";
>  };
> +
> +&usb_phy {
> +	avdd33-usb3-supply = <&avdd33_usb3>;
> +	status = "okay";
> +};
> diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
> b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
> index 354f3893aa8cf..de38f1f457e6b 100644
> --- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
> +++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
> @@ -4,6 +4,7 @@
>   */
>  
>  #include "th1520-lichee-module-4a.dtsi"
> +#include <dt-bindings/gpio/gpio.h>
>  
>  / {
>  	model = "Sipeed Lichee Pi 4A";
> @@ -97,6 +98,141 @@ fan: pwm-fan {
>  		cooling-levels = <0 66 196 255>;
>  	};
>  
> +	hub_5v: regulator-hub-5v {
> +		compatible = "regulator-fixed";
> +		regulator-name = "HUB_5V";
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
> +		gpio = <&ioexp3 3 GPIO_ACTIVE_HIGH>;
> +		enable-active-high;
> +	};
> +
> +	vcc5v_usb: regulator-vcc5v-usb {
> +		compatible = "regulator-fixed";
> +		regulator-name = "VCC5V_USB";
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
> +		gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>;
> +		enable-active-high;
> +		/*
> +		 * Workaround for Linux currently being not able to
> power on
> +		 * Vbus for USB Type-A connectors.
> +		 */
> +		regulator-always-on;

OHHHHH onboard_usb_dev now matches "usb-a-connector" and is able to
power on the vbus-supply regulator.

This hack should be removable now.

Thanks,
Icenowy

> +	};
> +
> +	connector-usb-a-1 {
> +		compatible = "usb-a-connector";
> +		vbus-supply = <&vcc5v_usb>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port at 0 {
> +				reg = <0>;
> +
> +				usb_a_1_hs_ep: endpoint {
> +					remote-endpoint =
> <&hub_hs_port1_ep>;
> +				};
> +			};
> +
> +			port at 1 {
> +				reg = <1>;
> +
> +				usb_a_1_ss_ep: endpoint {
> +					remote-endpoint =
> <&hub_ss_port1_ep>;
> +				};
> +			};
> +		};
> +	};
> +
> +	connector-usb-a-2 {
> +		compatible = "usb-a-connector";
> +		vbus-supply = <&vcc5v_usb>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port at 0 {
> +				reg = <0>;
> +
> +				usb_a_2_hs_ep: endpoint {
> +					remote-endpoint =
> <&hub_hs_port2_ep>;
> +				};
> +			};
> +
> +			port at 1 {
> +				reg = <1>;
> +
> +				usb_a_2_ss_ep: endpoint {
> +					remote-endpoint =
> <&hub_ss_port2_ep>;
> +				};
> +			};
> +		};
> +	};
> +
> +	connector-usb-a-3 {
> +		compatible = "usb-a-connector";
> +		vbus-supply = <&vcc5v_usb>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port at 0 {
> +				reg = <0>;
> +
> +				usb_a_3_hs_ep: endpoint {
> +					remote-endpoint =
> <&hub_hs_port3_ep>;
> +				};
> +			};
> +
> +			port at 1 {
> +				reg = <1>;
> +
> +				usb_a_3_ss_ep: endpoint {
> +					remote-endpoint =
> <&hub_ss_port3_ep>;
> +				};
> +			};
> +		};
> +	};
> +
> +	connector-usb-a-4 {
> +		compatible = "usb-a-connector";
> +		vbus-supply = <&vcc5v_usb>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port at 0 {
> +				reg = <0>;
> +
> +				usb_a_4_hs_ep: endpoint {
> +					remote-endpoint =
> <&hub_hs_port4_ep>;
> +				};
> +			};
> +
> +			port at 1 {
> +				reg = <1>;
> +
> +				usb_a_4_ss_ep: endpoint {
> +					remote-endpoint =
> <&hub_ss_port4_ep>;
> +				};
> +			};
> +		};
> +	};
> +};
> +
> +&aogpio {
> +	/* Route USB2 to the onboard hub for normal operation */
> +	sel-usb-hub-hog {
> +		gpio-hog;
> +		gpios = <4 GPIO_ACTIVE_HIGH>;
> +		output-high;
> +	};
>  };
>  
>  &dpu {
> @@ -262,3 +398,98 @@ &uart0 {
>  	pinctrl-0 = <&uart0_pins>;
>  	status = "okay";
>  };
> +
> +&usb {
> +	dr_mode = "host";
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	status = "okay";
> +
> +	hub_hs: hub at 1 {
> +		compatible = "usb2109,2817";
> +		reg = <1>;
> +		peer-hub = <&hub_ss>;
> +		vdd-supply = <&hub_5v>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port at 1 {
> +				reg = <1>;
> +
> +				hub_hs_port1_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_1_hs_ep>;
> +				};
> +			};
> +
> +			port at 2 {
> +				reg = <2>;
> +
> +				hub_hs_port2_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_2_hs_ep>;
> +				};
> +			};
> +
> +			port at 3 {
> +				reg = <3>;
> +
> +				hub_hs_port3_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_3_hs_ep>;
> +				};
> +			};
> +
> +			port at 4 {
> +				reg = <4>;
> +
> +				hub_hs_port4_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_4_hs_ep>;
> +				};
> +			};
> +		};
> +	};
> +
> +	hub_ss: hub at 2 {
> +		compatible = "usb2109,817";
> +		reg = <2>;
> +		peer-hub = <&hub_hs>;
> +		vdd-supply = <&hub_5v>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port at 1 {
> +				reg = <1>;
> +
> +				hub_ss_port1_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_1_ss_ep>;
> +				};
> +			};
> +
> +			port at 2 {
> +				reg = <2>;
> +
> +				hub_ss_port2_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_2_ss_ep>;
> +				};
> +			};
> +
> +			port at 3 {
> +				reg = <3>;
> +
> +				hub_ss_port3_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_3_ss_ep>;
> +				};
> +			};
> +
> +			port at 4 {
> +				reg = <4>;
> +
> +				hub_ss_port4_ep: endpoint {
> +					remote-endpoint =
> <&usb_a_4_ss_ep>;
> +				};
> +			};
> +		};
> +	};
> +};




More information about the linux-phy mailing list