public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] riscv: dts: spacemit: Add USB 3.0 support for K1
@ 2026-01-07 12:05 Ze Huang
  2026-01-07 12:05 ` [PATCH v2 1/3] riscv: dts: spacemit: Add USB2 PHY node " Ze Huang
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ze Huang @ 2026-01-07 12:05 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Yixun Lan
  Cc: devicetree, linux-riscv, spacemit, linux-kernel, Ze Huang,
	Aurelien Jarno

This patch series enables the DWC3 USB 3.0 host controller on the
Spacemit K1 SoC and enables it for the Banana Pi F3 board.

For testing, the following kernel configurations should be enabled:

CONFIG_PHY_SPACEMIT_K1_USB2=y
CONFIG_PHY_SPACEMIT_K1_PCIE=y
CONFIG_USB_DWC3=y
CONFIG_USB_ONBOARD_DEV=y

This series is based on the spacemit k1/for-next branch.

Link: https://github.com/spacemit-com/linux

Signed-off-by: Ze Huang <huang.ze@linux.dev>
---
Changes in v2:
- rebased on spacemit k1/for-next
- Link to v1: https://lore.kernel.org/all/20251101-k1-usb3dts-v1-0-dd2660e5740b@linux.dev/

---
Ze Huang (3):
      riscv: dts: spacemit: Add USB2 PHY node for K1
      riscv: dts: spacemit: Add DWC3 USB 3.0 controller node for K1
      riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3

 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi            | 32 +++++++++++++++++
 2 files changed, 80 insertions(+)
---
base-commit: 4f67c877a9069c60dfb1767038fba5180bc12d68
change-id: 20260107-k1-usb3dts-v2-220c0fa7702a

Best regards,
-- 
Ze Huang <huang.ze@linux.dev>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/3] riscv: dts: spacemit: Add USB2 PHY node for K1
  2026-01-07 12:05 [PATCH v2 0/3] riscv: dts: spacemit: Add USB 3.0 support for K1 Ze Huang
@ 2026-01-07 12:05 ` Ze Huang
  2026-01-07 12:05 ` [PATCH v2 2/3] riscv: dts: spacemit: Add DWC3 USB 3.0 controller " Ze Huang
  2026-01-07 12:05 ` [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3 Ze Huang
  2 siblings, 0 replies; 11+ messages in thread
From: Ze Huang @ 2026-01-07 12:05 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Yixun Lan
  Cc: devicetree, linux-riscv, spacemit, linux-kernel, Ze Huang,
	Aurelien Jarno

K1's DWC3 USB 3.0 controller requires two separate PHYs to function:
the USB 3.0 combophy (for SuperSpeed) and a USB 2.0 PHY (for High-Speed,
Full-Speed, etc.).

Add node for this second USB 2.0 PHY (usbphy2).

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Ze Huang <huang.ze@linux.dev>
---
 arch/riscv/boot/dts/spacemit/k1.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 86d1db14e2ee..b44149f4f076 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -424,6 +424,14 @@ i2c5: i2c@d4013800 {
 			status = "disabled";
 		};
 
+		usbphy2: phy@c0a30000 {
+			compatible = "spacemit,k1-usb2-phy";
+			reg = <0x0 0xc0a30000 0x0 0x200>;
+			clocks = <&syscon_apmu CLK_USB30>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
 		combo_phy: phy@c0b10000 {
 			compatible = "spacemit,k1-combo-phy";
 			reg = <0x0 0xc0b10000 0x0 0x1000>;

-- 
2.52.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/3] riscv: dts: spacemit: Add DWC3 USB 3.0 controller node for K1
  2026-01-07 12:05 [PATCH v2 0/3] riscv: dts: spacemit: Add USB 3.0 support for K1 Ze Huang
  2026-01-07 12:05 ` [PATCH v2 1/3] riscv: dts: spacemit: Add USB2 PHY node " Ze Huang
@ 2026-01-07 12:05 ` Ze Huang
  2026-01-07 12:05 ` [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3 Ze Huang
  2 siblings, 0 replies; 11+ messages in thread
From: Ze Huang @ 2026-01-07 12:05 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Yixun Lan
  Cc: devicetree, linux-riscv, spacemit, linux-kernel, Ze Huang,
	Aurelien Jarno

Add node for the Synopsys DWC3 USB 3.0 host controller on the K1 SoC.
The controller resides on the 'storage-bus' and uses its DMA
translations.

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Ze Huang <huang.ze@linux.dev>
---
 arch/riscv/boot/dts/spacemit/k1.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index b44149f4f076..f40c2ce6d0b8 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -1162,6 +1162,30 @@ storage-bus {
 			#size-cells = <2>;
 			dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x0 0x80000000>;
 
+			usb_dwc3: usb@c0a00000 {
+				compatible = "spacemit,k1-dwc3";
+				reg = <0x0 0xc0a00000 0x0 0x10000>;
+				clocks = <&syscon_apmu CLK_USB30>;
+				clock-names = "usbdrd30";
+				interrupts = <125>;
+				phys = <&usbphy2>, <&combo_phy PHY_TYPE_USB3>;
+				phy-names = "usb2-phy", "usb3-phy";
+				phy_type = "utmi";
+				resets = <&syscon_apmu RESET_USB30_AHB>,
+					 <&syscon_apmu RESET_USB30_VCC>,
+					 <&syscon_apmu RESET_USB30_PHY>;
+				reset-names = "ahb", "vcc", "phy";
+				reset-delay = <2>;
+				snps,hsphy_interface = "utmi";
+				snps,dis_enblslpm_quirk;
+				snps,dis-u2-freeclk-exists-quirk;
+				snps,dis-del-phy-power-chg-quirk;
+				snps,dis_u2_susphy_quirk;
+				snps,dis_u3_susphy_quirk;
+				snps,dis_rxdet_inp3_quirk;
+				status = "disabled";
+			};
+
 			emmc: mmc@d4281000 {
 				compatible = "spacemit,k1-sdhci";
 				reg = <0x0 0xd4281000 0x0 0x200>;

-- 
2.52.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-07 12:05 [PATCH v2 0/3] riscv: dts: spacemit: Add USB 3.0 support for K1 Ze Huang
  2026-01-07 12:05 ` [PATCH v2 1/3] riscv: dts: spacemit: Add USB2 PHY node " Ze Huang
  2026-01-07 12:05 ` [PATCH v2 2/3] riscv: dts: spacemit: Add DWC3 USB 3.0 controller " Ze Huang
@ 2026-01-07 12:05 ` Ze Huang
  2026-01-08  1:21   ` Yixun Lan
  2 siblings, 1 reply; 11+ messages in thread
From: Ze Huang @ 2026-01-07 12:05 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Yixun Lan
  Cc: devicetree, linux-riscv, spacemit, linux-kernel, Ze Huang,
	Aurelien Jarno

Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
Banana Pi F3 board.

The board utilizes a VLI VL817 hub, which requires two separate power
supplies: one VBUS and one for hub itself. Add two GPIO-controlled
fixed-regulators to manage this.

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Ze Huang <huang.ze@linux.dev>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 3f10efd925dc..013df91c6a4c 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
 		regulator-always-on;
 		vin-supply = <&reg_dc_in>;
 	};
+
+	usb3_vbus: regulator-vbus-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "USB30_VBUS";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	usb3_vhub: regulator-vhub-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "USB30_VHUB";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
 };
 
 &combo_phy {
@@ -67,6 +87,34 @@ &combo_phy {
 	status = "okay";
 };
 
+&usbphy2 {
+	status = "okay";
+};
+
+&usb_dwc3 {
+	dr_mode = "host";
+	vbus-supply = <&usb3_vbus>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	hub_2_0: hub@1 {
+		compatible = "usb2109,2817";
+		reg = <0x1>;
+		vdd-supply = <&usb3_vhub>;
+		peer-hub = <&hub_3_0>;
+		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
+	};
+
+	hub_3_0: hub@2 {
+		compatible = "usb2109,817";
+		reg = <0x2>;
+		vdd-supply = <&usb3_vhub>;
+		peer-hub = <&hub_2_0>;
+		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
+	};
+};
+
 &emmc {
 	bus-width = <8>;
 	mmc-hs400-1_8v;

-- 
2.52.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-07 12:05 ` [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3 Ze Huang
@ 2026-01-08  1:21   ` Yixun Lan
  2026-01-08 11:36     ` Yixun Lan
  2026-01-09  4:00     ` Ze Huang
  0 siblings, 2 replies; 11+ messages in thread
From: Yixun Lan @ 2026-01-08  1:21 UTC (permalink / raw)
  To: Ze Huang
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, devicetree,
	linux-riscv, spacemit, linux-kernel, Aurelien Jarno

Hi Ze,

  thanks for your patch, I have few comments, see below..

On 20:05 Wed 07 Jan     , Ze Huang wrote:
> Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
> Banana Pi F3 board.
> 
> The board utilizes a VLI VL817 hub, which requires two separate power
> supplies: one VBUS and one for hub itself. Add two GPIO-controlled
> fixed-regulators to manage this.
> 
> Tested-by: Aurelien Jarno <aurelien@aurel32.net>
> Signed-off-by: Ze Huang <huang.ze@linux.dev>
> ---
>  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> index 3f10efd925dc..013df91c6a4c 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> @@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
>  		regulator-always-on;
>  		vin-supply = <&reg_dc_in>;
>  	};
> +
> +	usb3_vbus: regulator-vbus-5v {
I've checked the schematics, the name is 5V_VBUS there, so for the consistency
with previous naming convention, let's change to:
	usb3_vbus_5v: usb3-vbus-5v 

> +		compatible = "regulator-fixed";
> +		regulator-name = "USB30_VBUS";
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
..
> +		regulator-always-on;
do you think the "always-on" property really necessary? it indicate the
power regulator is critical, and should never been disabled even during
suspend/resume state, for the case of USB, I think it should be totally
fine to poweroff once the device is not used(suspended) or even disabled

besides, the regulator is designed with a gpio enabling/disabling control
which means it can be powered to on/off state?

> +		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
> +		enable-active-high;
> +	};
> +
> +	usb3_vhub: regulator-vhub-5v {
why use vhub, but not hub? where does this name come from?

and for same reason, the name in schematics is VCC5V0_HUB, so how about
change it to:
	usb3_hub_5v: usb3-hub-5v 

> +		compatible = "regulator-fixed";
> +		regulator-name = "USB30_VHUB";
                                    ~~~need to fix too, if above is valid
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
..
> +		regulator-always-on;
ditto
> +		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
> +		enable-active-high;
> +	};
>  };
>  
>  &combo_phy {
> @@ -67,6 +87,34 @@ &combo_phy {
>  	status = "okay";
>  };
>  
..
> +&usbphy2 {
> +	status = "okay";
> +};
> +
> +&usb_dwc3 {
> +	dr_mode = "host";
> +	vbus-supply = <&usb3_vbus>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	status = "okay";
> +
> +	hub_2_0: hub@1 {
> +		compatible = "usb2109,2817";
> +		reg = <0x1>;
> +		vdd-supply = <&usb3_vhub>;
> +		peer-hub = <&hub_3_0>;
> +		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> +	};
> +
> +	hub_3_0: hub@2 {
> +		compatible = "usb2109,817";
> +		reg = <0x2>;
> +		vdd-supply = <&usb3_vhub>;
> +		peer-hub = <&hub_2_0>;
> +		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> +	};
> +};
> +
can you move these two after &uart0? I'd like to keep them sorted by 
label alphabet order..

>  &emmc {
>  	bus-width = <8>;
>  	mmc-hs400-1_8v;
> 
> -- 
> 2.52.0
> 

-- 
Yixun Lan (dlan)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-08  1:21   ` Yixun Lan
@ 2026-01-08 11:36     ` Yixun Lan
  2026-01-09  4:07       ` Ze Huang
  2026-01-09  4:00     ` Ze Huang
  1 sibling, 1 reply; 11+ messages in thread
From: Yixun Lan @ 2026-01-08 11:36 UTC (permalink / raw)
  To: Ze Huang
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, devicetree,
	linux-riscv, spacemit, linux-kernel, Aurelien Jarno

Hi Ze,

I've done a quick check of the "regulator-always-on" issue, 
it's ok to drop the one from hub, but not the vbus one..

On 09:21 Thu 08 Jan     , Yixun Lan wrote:
> Hi Ze,
> 
>   thanks for your patch, I have few comments, see below..
> 
> On 20:05 Wed 07 Jan     , Ze Huang wrote:
> > Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
> > Banana Pi F3 board.
> > 
> > The board utilizes a VLI VL817 hub, which requires two separate power
> > supplies: one VBUS and one for hub itself. Add two GPIO-controlled
> > fixed-regulators to manage this.
> > 
> > Tested-by: Aurelien Jarno <aurelien@aurel32.net>
> > Signed-off-by: Ze Huang <huang.ze@linux.dev>
> > ---
> >  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> > 
> > diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > index 3f10efd925dc..013df91c6a4c 100644
> > --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > @@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
> >  		regulator-always-on;
> >  		vin-supply = <&reg_dc_in>;
> >  	};
> > +
> > +	usb3_vbus: regulator-vbus-5v {
> I've checked the schematics, the name is 5V_VBUS there, so for the consistency
> with previous naming convention, let's change to:
> 	usb3_vbus_5v: usb3-vbus-5v 
> 
> > +		compatible = "regulator-fixed";
> > +		regulator-name = "USB30_VBUS";
> > +		regulator-min-microvolt = <5000000>;
> > +		regulator-max-microvolt = <5000000>;
> ..
> > +		regulator-always-on;
> do you think the "always-on" property really necessary? it indicate the
> power regulator is critical, and should never been disabled even during
> suspend/resume state, for the case of USB, I think it should be totally
> fine to poweroff once the device is not used(suspended) or even disabled
> 
> besides, the regulator is designed with a gpio enabling/disabling control
> which means it can be powered to on/off state?
> 
not ok to drop, see comment below at &usb_dwc3 

> > +		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
> > +		enable-active-high;
> > +	};
> > +
> > +	usb3_vhub: regulator-vhub-5v {
> why use vhub, but not hub? where does this name come from?
> 
> and for same reason, the name in schematics is VCC5V0_HUB, so how about
> change it to:
> 	usb3_hub_5v: usb3-hub-5v 
> 
> > +		compatible = "regulator-fixed";
> > +		regulator-name = "USB30_VHUB";
>                                     ~~~need to fix too, if above is valid
> > +		regulator-min-microvolt = <5000000>;
> > +		regulator-max-microvolt = <5000000>;
> ..
> > +		regulator-always-on;
> ditto
ok to drop, as it's already handled at drivers/usb/misc/onboard_usb_dev.c
which will explicitly request the regulator and enable it

> > +		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
> > +		enable-active-high;
> > +	};
> >  };
> >  
> >  &combo_phy {
> > @@ -67,6 +87,34 @@ &combo_phy {
> >  	status = "okay";
> >  };
> >  
> ..
> > +&usbphy2 {
> > +	status = "okay";
> > +};
> > +
> > +&usb_dwc3 {
> > +	dr_mode = "host";
> > +	vbus-supply = <&usb3_vbus>;
due to drivers/usb/dwc3/dwc3-generic-plat.c has no handler to request regulator
there will be problem if "regulator-always-on" property is removed..

> > +	#address-cells = <1>;
> > +	#size-cells = <0>;
> > +	status = "okay";
> > +

-- 
Yixun Lan (dlan)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-08  1:21   ` Yixun Lan
  2026-01-08 11:36     ` Yixun Lan
@ 2026-01-09  4:00     ` Ze Huang
  1 sibling, 0 replies; 11+ messages in thread
From: Ze Huang @ 2026-01-09  4:00 UTC (permalink / raw)
  To: Yixun Lan, Ze Huang
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, devicetree,
	linux-riscv, spacemit, linux-kernel, Aurelien Jarno

On Thu, Jan 08, 2026 at 09:21:57AM +0800, Yixun Lan wrote:
> Hi Ze,
> 
>   thanks for your patch, I have few comments, see below..
> 
> On 20:05 Wed 07 Jan     , Ze Huang wrote:
> > Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
> > Banana Pi F3 board.
> > 
> > The board utilizes a VLI VL817 hub, which requires two separate power
> > supplies: one VBUS and one for hub itself. Add two GPIO-controlled
> > fixed-regulators to manage this.
> > 
> > Tested-by: Aurelien Jarno <aurelien@aurel32.net>
> > Signed-off-by: Ze Huang <huang.ze@linux.dev>
> > ---
> >  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> > 
> > diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > index 3f10efd925dc..013df91c6a4c 100644
> > --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > @@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
> >  		regulator-always-on;
> >  		vin-supply = <&reg_dc_in>;
> >  	};
> > +
> > +	usb3_vbus: regulator-vbus-5v {
> I've checked the schematics, the name is 5V_VBUS there, so for the consistency
> with previous naming convention, let's change to:
> 	usb3_vbus_5v: usb3-vbus-5v 

Agreed. I will rename it to match the schematic.

> 
> > +		compatible = "regulator-fixed";
> > +		regulator-name = "USB30_VBUS";
> > +		regulator-min-microvolt = <5000000>;
> > +		regulator-max-microvolt = <5000000>;
> ..
> > +		regulator-always-on;
> do you think the "always-on" property really necessary? it indicate the
> power regulator is critical, and should never been disabled even during
> suspend/resume state, for the case of USB, I think it should be totally
> fine to poweroff once the device is not used(suspended) or even disabled
> 
> besides, the regulator is designed with a gpio enabling/disabling control
> which means it can be powered to on/off state?
> 

As you pointed out in the following email, dwc3-generic-plat did not manage any
regulator. So, either keep "always-on" here, or manage vbus in dwc3-generic-plat.

> > +		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
> > +		enable-active-high;
> > +	};
> > +
> > +	usb3_vhub: regulator-vhub-5v {
> why use vhub, but not hub? where does this name come from?
> 
> and for same reason, the name in schematics is VCC5V0_HUB, so how about
> change it to:
> 	usb3_hub_5v: usb3-hub-5v 
> 

I previously used 'vhub' just to align with the 'vbus'. However, using the
schematic name is better. I will update it to usb3_hub_5v.

> > +		compatible = "regulator-fixed";
> > +		regulator-name = "USB30_VHUB";
>                                     ~~~need to fix too, if above is valid
> > +		regulator-min-microvolt = <5000000>;
> > +		regulator-max-microvolt = <5000000>;
> ..
> > +		regulator-always-on;
> ditto
> > +		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
> > +		enable-active-high;
> > +	};
> >  };
> >  
> >  &combo_phy {
> > @@ -67,6 +87,34 @@ &combo_phy {
> >  	status = "okay";
> >  };
> >  
> ..
> > +&usbphy2 {
> > +	status = "okay";
> > +};
> > +
> > +&usb_dwc3 {
> > +	dr_mode = "host";
> > +	vbus-supply = <&usb3_vbus>;
> > +	#address-cells = <1>;
> > +	#size-cells = <0>;
> > +	status = "okay";
> > +
> > +	hub_2_0: hub@1 {
> > +		compatible = "usb2109,2817";
> > +		reg = <0x1>;
> > +		vdd-supply = <&usb3_vhub>;
> > +		peer-hub = <&hub_3_0>;
> > +		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> > +	};
> > +
> > +	hub_3_0: hub@2 {
> > +		compatible = "usb2109,817";
> > +		reg = <0x2>;
> > +		vdd-supply = <&usb3_vhub>;
> > +		peer-hub = <&hub_2_0>;
> > +		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> > +	};
> > +};
> > +
> can you move these two after &uart0? I'd like to keep them sorted by 
> label alphabet order..
> 

OK

> >  &emmc {
> >  	bus-width = <8>;
> >  	mmc-hs400-1_8v;
> > 
> > -- 
> > 2.52.0
> > 
> 
> -- 
> Yixun Lan (dlan)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-08 11:36     ` Yixun Lan
@ 2026-01-09  4:07       ` Ze Huang
  2026-01-09  5:21         ` Samuel Holland
  0 siblings, 1 reply; 11+ messages in thread
From: Ze Huang @ 2026-01-09  4:07 UTC (permalink / raw)
  To: Yixun Lan, Ze Huang
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, devicetree,
	linux-riscv, spacemit, linux-kernel, Aurelien Jarno

On Thu, Jan 08, 2026 at 07:36:05PM +0800, Yixun Lan wrote:
> Hi Ze,
> 
> I've done a quick check of the "regulator-always-on" issue, 
> it's ok to drop the one from hub, but not the vbus one..
> 

Thanks for your double check

> On 09:21 Thu 08 Jan     , Yixun Lan wrote:
> > Hi Ze,
> > 
> >   thanks for your patch, I have few comments, see below..
> > 
> > On 20:05 Wed 07 Jan     , Ze Huang wrote:
> > > Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
> > > Banana Pi F3 board.
> > > 
> > > The board utilizes a VLI VL817 hub, which requires two separate power
> > > supplies: one VBUS and one for hub itself. Add two GPIO-controlled
> > > fixed-regulators to manage this.
> > > 
> > > Tested-by: Aurelien Jarno <aurelien@aurel32.net>
> > > Signed-off-by: Ze Huang <huang.ze@linux.dev>
> > > ---
> > >  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
> > >  1 file changed, 48 insertions(+)
> > > 
> > > diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > > index 3f10efd925dc..013df91c6a4c 100644
> > > --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > > +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > > @@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
> > >  		regulator-always-on;
> > >  		vin-supply = <&reg_dc_in>;
> > >  	};
> > > +
> > > +	usb3_vbus: regulator-vbus-5v {
> > I've checked the schematics, the name is 5V_VBUS there, so for the consistency
> > with previous naming convention, let's change to:
> > 	usb3_vbus_5v: usb3-vbus-5v 
> > 
> > > +		compatible = "regulator-fixed";
> > > +		regulator-name = "USB30_VBUS";
> > > +		regulator-min-microvolt = <5000000>;
> > > +		regulator-max-microvolt = <5000000>;
> > ..
> > > +		regulator-always-on;
> > do you think the "always-on" property really necessary? it indicate the
> > power regulator is critical, and should never been disabled even during
> > suspend/resume state, for the case of USB, I think it should be totally
> > fine to poweroff once the device is not used(suspended) or even disabled
> > 
> > besides, the regulator is designed with a gpio enabling/disabling control
> > which means it can be powered to on/off state?
> > 


> not ok to drop, see comment below at &usb_dwc3 

> 
> > > +		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
> > > +		enable-active-high;
> > > +	};
> > > +
> > > +	usb3_vhub: regulator-vhub-5v {
> > why use vhub, but not hub? where does this name come from?
> > 
> > and for same reason, the name in schematics is VCC5V0_HUB, so how about
> > change it to:
> > 	usb3_hub_5v: usb3-hub-5v 
> > 
> > > +		compatible = "regulator-fixed";
> > > +		regulator-name = "USB30_VHUB";
> >                                     ~~~need to fix too, if above is valid
> > > +		regulator-min-microvolt = <5000000>;
> > > +		regulator-max-microvolt = <5000000>;
> > ..
> > > +		regulator-always-on;
> > ditto

> ok to drop, as it's already handled at drivers/usb/misc/onboard_usb_dev.c
> which will explicitly request the regulator and enable it

> 
> > > +		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
> > > +		enable-active-high;
> > > +	};
> > >  };
> > >  
> > >  &combo_phy {
> > > @@ -67,6 +87,34 @@ &combo_phy {
> > >  	status = "okay";
> > >  };
> > >  
> > ..
> > > +&usbphy2 {
> > > +	status = "okay";
> > > +};
> > > +
> > > +&usb_dwc3 {
> > > +	dr_mode = "host";
> > > +	vbus-supply = <&usb3_vbus>;
> due to drivers/usb/dwc3/dwc3-generic-plat.c has no handler to request regulator
> there will be problem if "regulator-always-on" property is removed..

On the BananaPi-F3 and to Jupiter, the VL817 hub setup uses two distinct controls:

GPIO97  controls the physical VBUS supply.
GPIO123 controls the VCC5V0_HUB supply for the hub logic.

(Note: This differs from the Orange Pi RV2, where only GPIO123 is used to
control the VBUS supply).

dwc3-generic-plat can not currently handle the regulator request explicitly,
keeping "regulator-always-on" forces the VBUS to remain active even when
suspended, which consumes unnecessary power.

I prefer to drop regulator-always-on in the DTS to accurately describe the
hardware capability, and let the driver manage the VBUS state. This ensures
better power management.

If anyone have other ideas, please let me know.

> 
> > > +	#address-cells = <1>;
> > > +	#size-cells = <0>;
> > > +	status = "okay";
> > > +
> 
> -- 
> Yixun Lan (dlan)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-09  4:07       ` Ze Huang
@ 2026-01-09  5:21         ` Samuel Holland
  2026-01-10 12:04           ` Ze Huang
  0 siblings, 1 reply; 11+ messages in thread
From: Samuel Holland @ 2026-01-09  5:21 UTC (permalink / raw)
  To: Ze Huang, Yixun Lan
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, devicetree,
	linux-riscv, spacemit, linux-kernel, Aurelien Jarno

Hi Ze,

On 2026-01-08 10:07 PM, Ze Huang wrote:
> On Thu, Jan 08, 2026 at 07:36:05PM +0800, Yixun Lan wrote:
>> Hi Ze,
>>
>> I've done a quick check of the "regulator-always-on" issue, 
>> it's ok to drop the one from hub, but not the vbus one..
>>
> 
> Thanks for your double check
> 
>> On 09:21 Thu 08 Jan     , Yixun Lan wrote:
>>> Hi Ze,
>>>
>>>   thanks for your patch, I have few comments, see below..
>>>
>>> On 20:05 Wed 07 Jan     , Ze Huang wrote:
>>>> Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
>>>> Banana Pi F3 board.
>>>>
>>>> The board utilizes a VLI VL817 hub, which requires two separate power
>>>> supplies: one VBUS and one for hub itself. Add two GPIO-controlled
>>>> fixed-regulators to manage this.
>>>>
>>>> Tested-by: Aurelien Jarno <aurelien@aurel32.net>
>>>> Signed-off-by: Ze Huang <huang.ze@linux.dev>
>>>> ---
>>>>  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
>>>>  1 file changed, 48 insertions(+)
>>>>
>>>> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
>>>> index 3f10efd925dc..013df91c6a4c 100644
>>>> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
>>>> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
>>>> @@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
>>>>  		regulator-always-on;
>>>>  		vin-supply = <&reg_dc_in>;
>>>>  	};
>>>> +
>>>> +	usb3_vbus: regulator-vbus-5v {
>>> I've checked the schematics, the name is 5V_VBUS there, so for the consistency
>>> with previous naming convention, let's change to:
>>> 	usb3_vbus_5v: usb3-vbus-5v 
>>>
>>>> +		compatible = "regulator-fixed";
>>>> +		regulator-name = "USB30_VBUS";
>>>> +		regulator-min-microvolt = <5000000>;
>>>> +		regulator-max-microvolt = <5000000>;
>>> ..
>>>> +		regulator-always-on;
>>> do you think the "always-on" property really necessary? it indicate the
>>> power regulator is critical, and should never been disabled even during
>>> suspend/resume state, for the case of USB, I think it should be totally
>>> fine to poweroff once the device is not used(suspended) or even disabled
>>>
>>> besides, the regulator is designed with a gpio enabling/disabling control
>>> which means it can be powered to on/off state?
>>>
> 
> 
>> not ok to drop, see comment below at &usb_dwc3 
> 
>>
>>>> +		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
>>>> +		enable-active-high;
>>>> +	};
>>>> +
>>>> +	usb3_vhub: regulator-vhub-5v {
>>> why use vhub, but not hub? where does this name come from?
>>>
>>> and for same reason, the name in schematics is VCC5V0_HUB, so how about
>>> change it to:
>>> 	usb3_hub_5v: usb3-hub-5v 
>>>
>>>> +		compatible = "regulator-fixed";
>>>> +		regulator-name = "USB30_VHUB";
>>>                                     ~~~need to fix too, if above is valid
>>>> +		regulator-min-microvolt = <5000000>;
>>>> +		regulator-max-microvolt = <5000000>;
>>> ..
>>>> +		regulator-always-on;
>>> ditto
> 
>> ok to drop, as it's already handled at drivers/usb/misc/onboard_usb_dev.c
>> which will explicitly request the regulator and enable it
> 
>>
>>>> +		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
>>>> +		enable-active-high;
>>>> +	};
>>>>  };
>>>>  
>>>>  &combo_phy {
>>>> @@ -67,6 +87,34 @@ &combo_phy {
>>>>  	status = "okay";
>>>>  };
>>>>  
>>> ..
>>>> +&usbphy2 {
>>>> +	status = "okay";
>>>> +};
>>>> +
>>>> +&usb_dwc3 {
>>>> +	dr_mode = "host";
>>>> +	vbus-supply = <&usb3_vbus>;
>> due to drivers/usb/dwc3/dwc3-generic-plat.c has no handler to request regulator
>> there will be problem if "regulator-always-on" property is removed..
> 
> On the BananaPi-F3 and to Jupiter, the VL817 hub setup uses two distinct controls:
> 
> GPIO97  controls the physical VBUS supply.
> GPIO123 controls the VCC5V0_HUB supply for the hub logic.
> 
> (Note: This differs from the Orange Pi RV2, where only GPIO123 is used to
> control the VBUS supply).
> 
> dwc3-generic-plat can not currently handle the regulator request explicitly,
> keeping "regulator-always-on" forces the VBUS to remain active even when
> suspended, which consumes unnecessary power.
> 
> I prefer to drop regulator-always-on in the DTS to accurately describe the
> hardware capability, and let the driver manage the VBUS state. This ensures
> better power management.
> 
> If anyone have other ideas, please let me know.

If a USB device requires board-level resources to function, then the USB device
itself (not the controller) needs a DT node that references these resources.
This is the purpose of the usb-device.yaml binding. For the VL817 hub, there is
a specific binding that links the highspeed and superspeed hubs together. See
Documentation/devicetree/bindings/usb/vialab,vl817.yaml. These nodes are matched
with the Linux usb-onboard-hub driver.

Regards,
Samuel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-09  5:21         ` Samuel Holland
@ 2026-01-10 12:04           ` Ze Huang
  2026-01-10 12:32             ` Yixun Lan
  0 siblings, 1 reply; 11+ messages in thread
From: Ze Huang @ 2026-01-10 12:04 UTC (permalink / raw)
  To: Samuel Holland, Ze Huang, Yixun Lan
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, devicetree,
	linux-riscv, spacemit, linux-kernel, Aurelien Jarno

On Thu, Jan 08, 2026 at 11:21:48PM -0600, Samuel Holland wrote:
> Hi Ze,
> 
> On 2026-01-08 10:07 PM, Ze Huang wrote:
> > On Thu, Jan 08, 2026 at 07:36:05PM +0800, Yixun Lan wrote:
> >> Hi Ze,
> >>
> >> I've done a quick check of the "regulator-always-on" issue, 
> >> it's ok to drop the one from hub, but not the vbus one..
> >>
> > 
> > Thanks for your double check
> > 
> >> On 09:21 Thu 08 Jan     , Yixun Lan wrote:
> >>> Hi Ze,
> >>>
> >>>   thanks for your patch, I have few comments, see below..
> >>>
> >>> On 20:05 Wed 07 Jan     , Ze Huang wrote:
> >>>> Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
> >>>> Banana Pi F3 board.
> >>>>
> >>>> The board utilizes a VLI VL817 hub, which requires two separate power
> >>>> supplies: one VBUS and one for hub itself. Add two GPIO-controlled
> >>>> fixed-regulators to manage this.
> >>>>
> >>>> Tested-by: Aurelien Jarno <aurelien@aurel32.net>
> >>>> Signed-off-by: Ze Huang <huang.ze@linux.dev>
> >>>> ---
> >>>>  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
> >>>>  1 file changed, 48 insertions(+)
> >>>>
> >>>> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> >>>> index 3f10efd925dc..013df91c6a4c 100644
> >>>> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> >>>> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> >>>> @@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
> >>>>  		regulator-always-on;
> >>>>  		vin-supply = <&reg_dc_in>;
> >>>>  	};
> >>>> +
> >>>> +	usb3_vbus: regulator-vbus-5v {
> >>> I've checked the schematics, the name is 5V_VBUS there, so for the consistency
> >>> with previous naming convention, let's change to:
> >>> 	usb3_vbus_5v: usb3-vbus-5v 
> >>>
> >>>> +		compatible = "regulator-fixed";
> >>>> +		regulator-name = "USB30_VBUS";
> >>>> +		regulator-min-microvolt = <5000000>;
> >>>> +		regulator-max-microvolt = <5000000>;
> >>> ..
> >>>> +		regulator-always-on;
> >>> do you think the "always-on" property really necessary? it indicate the
> >>> power regulator is critical, and should never been disabled even during
> >>> suspend/resume state, for the case of USB, I think it should be totally
> >>> fine to poweroff once the device is not used(suspended) or even disabled
> >>>
> >>> besides, the regulator is designed with a gpio enabling/disabling control
> >>> which means it can be powered to on/off state?
> >>>
> > 
> > 
> >> not ok to drop, see comment below at &usb_dwc3 
> > 
> >>
> >>>> +		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
> >>>> +		enable-active-high;
> >>>> +	};
> >>>> +
> >>>> +	usb3_vhub: regulator-vhub-5v {
> >>> why use vhub, but not hub? where does this name come from?
> >>>
> >>> and for same reason, the name in schematics is VCC5V0_HUB, so how about
> >>> change it to:
> >>> 	usb3_hub_5v: usb3-hub-5v 
> >>>
> >>>> +		compatible = "regulator-fixed";
> >>>> +		regulator-name = "USB30_VHUB";
> >>>                                     ~~~need to fix too, if above is valid
> >>>> +		regulator-min-microvolt = <5000000>;
> >>>> +		regulator-max-microvolt = <5000000>;
> >>> ..
> >>>> +		regulator-always-on;
> >>> ditto
> > 
> >> ok to drop, as it's already handled at drivers/usb/misc/onboard_usb_dev.c
> >> which will explicitly request the regulator and enable it
> > 
> >>
> >>>> +		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
> >>>> +		enable-active-high;
> >>>> +	};
> >>>>  };
> >>>>  
> >>>>  &combo_phy {
> >>>> @@ -67,6 +87,34 @@ &combo_phy {
> >>>>  	status = "okay";
> >>>>  };
> >>>>  
> >>> ..
> >>>> +&usbphy2 {
> >>>> +	status = "okay";
> >>>> +};
> >>>> +
> >>>> +&usb_dwc3 {
> >>>> +	dr_mode = "host";
> >>>> +	vbus-supply = <&usb3_vbus>;
> >> due to drivers/usb/dwc3/dwc3-generic-plat.c has no handler to request regulator
> >> there will be problem if "regulator-always-on" property is removed..
> > 
> > On the BananaPi-F3 and to Jupiter, the VL817 hub setup uses two distinct controls:
> > 
> > GPIO97  controls the physical VBUS supply.
> > GPIO123 controls the VCC5V0_HUB supply for the hub logic.
> > 
> > (Note: This differs from the Orange Pi RV2, where only GPIO123 is used to
> > control the VBUS supply).
> > 
> > dwc3-generic-plat can not currently handle the regulator request explicitly,
> > keeping "regulator-always-on" forces the VBUS to remain active even when
> > suspended, which consumes unnecessary power.
> > 
> > I prefer to drop regulator-always-on in the DTS to accurately describe the
> > hardware capability, and let the driver manage the VBUS state. This ensures
> > better power management.
> > 
> > If anyone have other ideas, please let me know.
> 
> If a USB device requires board-level resources to function, then the USB device
> itself (not the controller) needs a DT node that references these resources.
> This is the purpose of the usb-device.yaml binding. For the VL817 hub, there is
> a specific binding that links the highspeed and superspeed hubs together. See
> Documentation/devicetree/bindings/usb/vialab,vl817.yaml. These nodes are matched
> with the Linux usb-onboard-hub driver.
> 

Hi Samuel,

Thank you for the guidance. I agree that VBUS control is a board-level
resource and handling it at host controller level is not appropriate.

I noticed Marco Felsch's patch series "[PATCH v4 0/5] Add onboard-dev
USB hub host managed vbus handling support", which adds support for
optional vbus-supply at the USB port level. This matches our hardware
situation perfectly.

To avoid dependencies on unmerged code, I plan to stick with the
"regulator-always-on" approach in the next version (v3). Once Marco's
series is merged into the kernel, I will follow up with a patch to switch
to the port-based VBUS supply method.

Link: https://lore.kernel.org/all/20250911-v6-16-topic-usb-onboard-dev-v4-0-1af288125d74@pengutronix.de/

Best regards, Ze

> Regards,
> Samuel
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
  2026-01-10 12:04           ` Ze Huang
@ 2026-01-10 12:32             ` Yixun Lan
  0 siblings, 0 replies; 11+ messages in thread
From: Yixun Lan @ 2026-01-10 12:32 UTC (permalink / raw)
  To: Ze Huang
  Cc: Samuel Holland, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	devicetree, linux-riscv, spacemit, linux-kernel, Aurelien Jarno

Hi Ze,

On 20:04 Sat 10 Jan     , Ze Huang wrote:
> On Thu, Jan 08, 2026 at 11:21:48PM -0600, Samuel Holland wrote:
> > Hi Ze,
> > 
> > On 2026-01-08 10:07 PM, Ze Huang wrote:
> > > On Thu, Jan 08, 2026 at 07:36:05PM +0800, Yixun Lan wrote:
> > >> Hi Ze,
> > >>
> > >> I've done a quick check of the "regulator-always-on" issue, 
> > >> it's ok to drop the one from hub, but not the vbus one..
> > >>
> > > 
> > > Thanks for your double check
> > > 
> > >> On 09:21 Thu 08 Jan     , Yixun Lan wrote:
> > >>> Hi Ze,
> > >>>
> > >>>   thanks for your patch, I have few comments, see below..
> > >>>
> > >>> On 20:05 Wed 07 Jan     , Ze Huang wrote:
> > >>>> Enable the DWC3 USB 3.0 controller and its associated usbphy2 on the
> > >>>> Banana Pi F3 board.
> > >>>>
> > >>>> The board utilizes a VLI VL817 hub, which requires two separate power
> > >>>> supplies: one VBUS and one for hub itself. Add two GPIO-controlled
> > >>>> fixed-regulators to manage this.
> > >>>>
> > >>>> Tested-by: Aurelien Jarno <aurelien@aurel32.net>
> > >>>> Signed-off-by: Ze Huang <huang.ze@linux.dev>
> > >>>> ---
> > >>>>  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 48 +++++++++++++++++++++++++
> > >>>>  1 file changed, 48 insertions(+)
> > >>>>
> > >>>> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > >>>> index 3f10efd925dc..013df91c6a4c 100644
> > >>>> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > >>>> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > >>>> @@ -59,6 +59,26 @@ reg_vcc_4v: vcc-4v {
> > >>>>  		regulator-always-on;
> > >>>>  		vin-supply = <&reg_dc_in>;
> > >>>>  	};
> > >>>> +
> > >>>> +	usb3_vbus: regulator-vbus-5v {
> > >>> I've checked the schematics, the name is 5V_VBUS there, so for the consistency
> > >>> with previous naming convention, let's change to:
> > >>> 	usb3_vbus_5v: usb3-vbus-5v 
> > >>>
> > >>>> +		compatible = "regulator-fixed";
> > >>>> +		regulator-name = "USB30_VBUS";
> > >>>> +		regulator-min-microvolt = <5000000>;
> > >>>> +		regulator-max-microvolt = <5000000>;
> > >>> ..
> > >>>> +		regulator-always-on;
> > >>> do you think the "always-on" property really necessary? it indicate the
> > >>> power regulator is critical, and should never been disabled even during
> > >>> suspend/resume state, for the case of USB, I think it should be totally
> > >>> fine to poweroff once the device is not used(suspended) or even disabled
> > >>>
> > >>> besides, the regulator is designed with a gpio enabling/disabling control
> > >>> which means it can be powered to on/off state?
> > >>>
> > > 
> > > 
> > >> not ok to drop, see comment below at &usb_dwc3 
> > > 
> > >>
> > >>>> +		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
> > >>>> +		enable-active-high;
> > >>>> +	};
> > >>>> +
> > >>>> +	usb3_vhub: regulator-vhub-5v {
> > >>> why use vhub, but not hub? where does this name come from?
> > >>>
> > >>> and for same reason, the name in schematics is VCC5V0_HUB, so how about
> > >>> change it to:
> > >>> 	usb3_hub_5v: usb3-hub-5v 
> > >>>
> > >>>> +		compatible = "regulator-fixed";
> > >>>> +		regulator-name = "USB30_VHUB";
> > >>>                                     ~~~need to fix too, if above is valid
> > >>>> +		regulator-min-microvolt = <5000000>;
> > >>>> +		regulator-max-microvolt = <5000000>;
> > >>> ..
> > >>>> +		regulator-always-on;
> > >>> ditto
> > > 
> > >> ok to drop, as it's already handled at drivers/usb/misc/onboard_usb_dev.c
> > >> which will explicitly request the regulator and enable it
> > > 
> > >>
> > >>>> +		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
> > >>>> +		enable-active-high;
> > >>>> +	};
> > >>>>  };
> > >>>>  
> > >>>>  &combo_phy {
> > >>>> @@ -67,6 +87,34 @@ &combo_phy {
> > >>>>  	status = "okay";
> > >>>>  };
> > >>>>  
> > >>> ..
> > >>>> +&usbphy2 {
> > >>>> +	status = "okay";
> > >>>> +};
> > >>>> +
> > >>>> +&usb_dwc3 {
> > >>>> +	dr_mode = "host";
> > >>>> +	vbus-supply = <&usb3_vbus>;
> > >> due to drivers/usb/dwc3/dwc3-generic-plat.c has no handler to request regulator
> > >> there will be problem if "regulator-always-on" property is removed..
> > > 
> > > On the BananaPi-F3 and to Jupiter, the VL817 hub setup uses two distinct controls:
> > > 
> > > GPIO97  controls the physical VBUS supply.
> > > GPIO123 controls the VCC5V0_HUB supply for the hub logic.
> > > 
> > > (Note: This differs from the Orange Pi RV2, where only GPIO123 is used to
> > > control the VBUS supply).
> > > 
> > > dwc3-generic-plat can not currently handle the regulator request explicitly,
> > > keeping "regulator-always-on" forces the VBUS to remain active even when
> > > suspended, which consumes unnecessary power.
> > > 
> > > I prefer to drop regulator-always-on in the DTS to accurately describe the
> > > hardware capability, and let the driver manage the VBUS state. This ensures
> > > better power management.
> > > 
> > > If anyone have other ideas, please let me know.
> > 
> > If a USB device requires board-level resources to function, then the USB device
> > itself (not the controller) needs a DT node that references these resources.
> > This is the purpose of the usb-device.yaml binding. For the VL817 hub, there is
> > a specific binding that links the highspeed and superspeed hubs together. See
> > Documentation/devicetree/bindings/usb/vialab,vl817.yaml. These nodes are matched
> > with the Linux usb-onboard-hub driver.
> > 
> 
> Hi Samuel,
> 
> Thank you for the guidance. I agree that VBUS control is a board-level
> resource and handling it at host controller level is not appropriate.
> 
> I noticed Marco Felsch's patch series "[PATCH v4 0/5] Add onboard-dev
> USB hub host managed vbus handling support", which adds support for
> optional vbus-supply at the USB port level. This matches our hardware
> situation perfectly.
> 
thanks for digging this, the patch looks exactly what we need..

> To avoid dependencies on unmerged code, I plan to stick with the
> "regulator-always-on" approach in the next version (v3). Once Marco's
> series is merged into the kernel, I will follow up with a patch to switch
> to the port-based VBUS supply method.
> 
going forward with "regulator-always-on" approach currently is kind of acceptable,
I wouldn't consider there is break if we switch to more proper solution later on,
and thanks for pushing this

> Link: https://lore.kernel.org/all/20250911-v6-16-topic-usb-onboard-dev-v4-0-1af288125d74@pengutronix.de/
> 
> Best regards, Ze
> 
> > Regards,
> > Samuel
> > 
> 

-- 
Yixun Lan (dlan)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-01-10 12:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 12:05 [PATCH v2 0/3] riscv: dts: spacemit: Add USB 3.0 support for K1 Ze Huang
2026-01-07 12:05 ` [PATCH v2 1/3] riscv: dts: spacemit: Add USB2 PHY node " Ze Huang
2026-01-07 12:05 ` [PATCH v2 2/3] riscv: dts: spacemit: Add DWC3 USB 3.0 controller " Ze Huang
2026-01-07 12:05 ` [PATCH v2 3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3 Ze Huang
2026-01-08  1:21   ` Yixun Lan
2026-01-08 11:36     ` Yixun Lan
2026-01-09  4:07       ` Ze Huang
2026-01-09  5:21         ` Samuel Holland
2026-01-10 12:04           ` Ze Huang
2026-01-10 12:32             ` Yixun Lan
2026-01-09  4:00     ` Ze Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox