Skip to contentSkip to conversation

spacemit: k1-bananapi-f3: Fix the power source of USB3 nodes

PATCH In review Anand Moon 3 participants 20 messages May 2 – May 13

Subsystems (3)
lore
Share & tools
lore

Anand Moon

author
#0 lore raw

v2 cover spacemit: k1-bananapi-f3: Fix the power source of USB3 nodes

Following changes fix the power source of USB 3 and pcie on K1-Bananapi-F3 development board.

Bananapi F3 schematics.
[1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view (page 24)

v1: https://lore.kernel.org/all/[email protected]/

v2: Add pcie vin for pcie regulator.

To verify check regulator_summary for more details

$ cat /sys/kernel/debug/regulator/regulator_summary
 dc_in_12v                        3    2      0 unknown 12000mV     0mA 12000mV 12000mV
    vcc_4v                        1    0      0 unknown  4000mV     0mA  4000mV  4000mV
    vcc5v0_sys                    4    3      0 unknown  5000mV     0mA  5000mV  5000mV
       PCIE_VCC3V3                3    2      0 unknown  3300mV     0mA  3300mV  3300mV
          ca800000.pcie-vpcie3v3   1                                 0mA     0mV     0mV
          ca400000.pcie-vpcie3v3   1                                 0mA     0mV     0mV
       5V_VBUS                    2    1      0 unknown  5000mV     0mA  5000mV  5000mV
          c0a00000.usb:hub@1-vdd   1                                 0mA     0mV     0mV
       VCC5V0_HUB                 2    1      0 unknown  5000mV     0mA  5000mV  5000mV
          c0a00000.usb-vbus       1                                 0mA     0mV     0mV

Thanks
-Anand

Anand Moon (4):
riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for
Banana Pi F3
riscv: dts: spacemit: k1-bananapi-f3: Update USB regulator on onboard
usb and label
riscv: dts: spacemit: k1-bananapi-f3: Correct USB hub power hierarchy
riscv: dts: spacemit: k1-bananapi-f3: Add vin-supply for PCIe 3.3V
regulator

 .../boot/dts/spacemit/k1-bananapi-f3.dts      | 25 +++++++++++++++----
 1 file changed, 20 insertions(+), 5 deletions(-)

base-commit: f1a5e78a55ebf2b05777fd5eb738038ddae609d6

Signature · 1 line
2.50.1
author
#1 lore raw

PATCH v2 1/4 riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for Banana Pi F3

Define the system 5V fixed regulator (vcc5v0_sys) supplied by the DC input. As per the schematics, vcc5v0_sys is the input power source for the VCC5V0_HUB and 5V_VBUS reglators. Update these regulators to correctly reference vcc5v0_sys as their parent (vin-supply).

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +12 -0
index 5790d927b93d..9727ecdd9f6b 100644
@@ -50,6 +50,16 @@ reg_dc_in: regulator-dc-in-12v {
 		regulator-always-on;
 	};
 
+	reg_vcc5v0_sys: regulator-vcc5v0-sys {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc5v0_sys";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-boot-on;
+		regulator-always-on;
+		vin-supply = <&reg_dc_in>;
+	};
+
 	reg_vcc_4v: regulator-vcc-4v {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc_4v";
@@ -66,6 +76,7 @@ regulator-usb3-vbus-5v {
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 		regulator-always-on;
+		vin-supply = <&reg_vcc5v0_sys>;
 		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
@@ -75,6 +86,7 @@ usb3_hub_5v: regulator-usb3-hub-5v {
 		regulator-name = "USB30_HUB";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
+		vin-supply = <&reg_vcc5v0_sys>;
 		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
Signature · 1 line
2.50.1
author
#8 lore raw

PATCH v2 2/4 riscv: dts: spacemit: k1-bananapi-f3: Update USB regulator on onboard usb and label

In reply to Anand Moon

Update the USB regulator labels to align with the board schematics and power hierarchy. This change renames the regulator to reg_5v_vbus and its name to 5V_VBUS. Additionally, it fixes the vdd-supply references for both the USB 2.0 and 3.0 hub nodes to ensure they correctly point to the 5V_VBUS input source as per the board schematics.

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +4 -4
index 9727ecdd9f6b..c35f4763c800 100644
@@ -70,9 +70,9 @@ reg_vcc_4v: regulator-vcc-4v {
 		vin-supply = <&reg_dc_in>;
 	};
 
-	regulator-usb3-vbus-5v {
+	reg_5v_vbus: regulator-usb3-vbus-5v {
 		compatible = "regulator-fixed";
-		regulator-name = "USB30_VBUS";
+		regulator-name = "5V_VBUS";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 		regulator-always-on;
@@ -366,7 +366,7 @@ &usb_dwc3 {
 	hub_2_0: hub@1 {
 		compatible = "usb2109,2817";
 		reg = <0x1>;
-		vdd-supply = <&usb3_hub_5v>;
+		vdd-supply = <&reg_5v_vbus>;
 		peer-hub = <&hub_3_0>;
 		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
 	};
@@ -374,7 +374,7 @@ hub_2_0: hub@1 {
 	hub_3_0: hub@2 {
 		compatible = "usb2109,817";
 		reg = <0x2>;
-		vdd-supply = <&usb3_hub_5v>;
+		vdd-supply = <&reg_5v_vbus>;
 		peer-hub = <&hub_2_0>;
 		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
 	};
Signature · 1 line
2.50.1
author
#12 lore raw

PATCH v2 3/4 riscv: dts: spacemit: k1-bananapi-f3: Correct USB hub power hierarchy

In reply to Anand Moon

Link the usb3_hub_5v regulator to the USB controller’s vbus-supply to ensure the USB 3.0 stack is properly powered as per the schematics. In addition, align the USB hub regulator with the board schematics by renaming it to VCC5V0_HUB and marking it as regulator-always-on to maintain power stability.

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +3 -1
index c35f4763c800..3dbdf53b6d8e 100644
@@ -83,9 +83,10 @@ reg_5v_vbus: regulator-usb3-vbus-5v {
 
 	usb3_hub_5v: regulator-usb3-hub-5v {
 		compatible = "regulator-fixed";
-		regulator-name = "USB30_HUB";
+		regulator-name = "VCC5V0_HUB";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
 		vin-supply = <&reg_vcc5v0_sys>;
 		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
 		enable-active-high;
@@ -361,6 +362,7 @@ &usb_dwc3 {
 	dr_mode = "host";
 	#address-cells = <1>;
 	#size-cells = <0>;
+	vbus-supply = <&usb3_hub_5v>;
 	status = "okay";
 
 	hub_2_0: hub@1 {
Signature · 1 line
2.50.1
author
#16 lore raw

PATCH v2 4/4 riscv: dts: spacemit: k1-bananapi-f3: Add vin-supply for PCIe 3.3V regulator

In reply to Anand Moon

The PCIe 3.3V fixed regulator node (pcie_vcc_3v3) lacked a parent supply reference. Wire it to the 5V system rail (reg_vcc5v0_sys) via the vin-supply property to reflect the actual board power tree. This ensures correct regulator hierarchy in DTS and allows drivers to resolve supply dependencies cleanly during probe.

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>

---
v2: new patch in this series.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
index 3dbdf53b6d8e..6c06480ba100 100644
@@ -39,6 +39,7 @@ pcie_vcc_3v3: regulator-pcie-vcc3v3 {
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 		regulator-always-on;
+		vin-supply = <&reg_vcc5v0_sys>;
 	};
 
 	reg_dc_in: regulator-dc-in-12v {
Signature · 1 line
2.50.1
maintainer
#2 lore raw

Re: [PATCH v2 1/4] riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for Banana Pi F3

In reply to Anand Moon

Hi Anand,

Quoted 18 lines · Anand Moon

Define the system 5V fixed regulator (vcc5v0_sys) supplied by the DC input. As per the schematics, vcc5v0_sys is the input power source for the VCC5V0_HUB and 5V_VBUS reglators. Update these regulators to correctly reference vcc5v0_sys as their parent (vin-supply).

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 5790d927b93d..9727ecdd9f6b 100644

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_dc_in: regulator-dc-in-12v { · line 53

Quoted 4 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -50,6 +50,16 @@ reg_dc_in: regulator-dc-in-12v {
 		regulator-always-on;
 	};
 
+	reg_vcc5v0_sys: regulator-vcc5v0-sys {

This will fall into the catogery of "non-controllable & serve no devices" see similar comment for 'reg_dc_in' which raised by Krzysztof

https://lore.kernel.org/all/[email protected]/

or should I ask, what's the real problem if regulator has no vin-supply? Any probe failure or something bad happen? (besides /sys/../regulator_summay)

Quoted 31 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +11 -0
+		compatible = "regulator-fixed";
+		regulator-name = "vcc5v0_sys";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-boot-on;
+		regulator-always-on;
+		vin-supply = <&reg_dc_in>;
+	};
+
 	reg_vcc_4v: regulator-vcc-4v {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc_4v";
@@ -66,6 +76,7 @@ regulator-usb3-vbus-5v {
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 		regulator-always-on;
+		vin-supply = <&reg_vcc5v0_sys>;
 		gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
@@ -75,6 +86,7 @@ usb3_hub_5v: regulator-usb3-hub-5v {
 		regulator-name = "USB30_HUB";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
+		vin-supply = <&reg_vcc5v0_sys>;
 		gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
Signature · 1 line
2.50.1
Signature · 1 line
Yixun Lan (dlan)
#9 lore raw

Re: [PATCH v2 2/4] riscv: dts: spacemit: k1-bananapi-f3: Update USB regulator on onboard usb and label

In reply to Anand Moon

Hi,

Quoted 10 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
@@ -366,7 +366,7 @@ &usb_dwc3 {
 	hub_2_0: hub@1 {
 		compatible = "usb2109,2817";
 		reg = <0x1>;
-		vdd-supply = <&usb3_hub_5v>;
+		vdd-supply = <&reg_5v_vbus>;
 		peer-hub = <&hub_3_0>;
 		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
 	};

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts hub_2_0: hub@1 { · line 380

Quoted 8 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
@@ -374,7 +374,7 @@ hub_2_0: hub@1 {
 	hub_3_0: hub@2 {
 		compatible = "usb2109,817";
 		reg = <0x2>;
-		vdd-supply = <&usb3_hub_5v>;
+		vdd-supply = <&reg_5v_vbus>;
 		peer-hub = <&hub_2_0>;
 		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
 	};

This is incorrect. The hub is powered by vcc5v0_hub. According to the schematic, 5v_vbus provides the VBUS for the USB3 ports.

#13 lore raw

Re: [PATCH v2 4/4] riscv: dts: spacemit: k1-bananapi-f3: Add vin-supply for PCIe 3.3V regulator

In reply to Anand Moon

Hi,

Review pcie_vcc_3v3: regulator-pcie-vcc3v3 { · line 43

Quoted 6 lines
(quoted diff) +1 -0
@@ -39,6 +39,7 @@ pcie_vcc_3v3: regulator-pcie-vcc3v3 {
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 		regulator-always-on;
+		vin-supply = <&reg_vcc5v0_sys>;
 	};

This is incorrect. pcie_vcc3v3 is driven by usbvbus (dc_in).

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

#14 lore raw

Re: [PATCH v2 3/4] riscv: dts: spacemit: k1-bananapi-f3: Correct USB hub power hierarchy

In reply to Anand Moon

Hi,

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_5v_vbus: regulator-usb3-vbus-5v { · line 86

Quoted 4 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
 	usb3_hub_5v: regulator-usb3-hub-5v {
 		compatible = "regulator-fixed";
-		regulator-name = "USB30_HUB";
+		regulator-name = "VCC5V0_HUB";

Suggested changes:

	vcc5v0_hub: regulator-vcc5v0-hub {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_hub";

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_5v_vbus: regulator-usb3-vbus-5v { · line 89

Quoted 3 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
+		regulator-always-on;

Why always on?

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &usb_dwc3 { · line 366

Quoted 6 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -361,6 +362,7 @@ &usb_dwc3 {
 	dr_mode = "host";
 	#address-cells = <1>;
 	#size-cells = <0>;
+	vbus-supply = <&usb3_hub_5v>;
 	status = "okay";

This is incorrect. See the previous reply.

author
#3 lore raw

Re: [PATCH v2 1/4] riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for Banana Pi F3

In reply to Yixun Lan

Hi Yixun,

Thanks for your review comments.

Quoted 25 lines · Yixun Lan

Hi Anand,

Quoted 21 lines · Anand Moon

Define the system 5V fixed regulator (vcc5v0_sys) supplied by the DC input. As per the schematics, vcc5v0_sys is the input power source for the VCC5V0_HUB and 5V_VBUS reglators. Update these regulators to correctly reference vcc5v0_sys as their parent (vin-supply).

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 5790d927b93d..9727ecdd9f6b 100644
@@ -50,6 +50,16 @@ reg_dc_in: regulator-dc-in-12v {
              regulator-always-on;
      };
 
Quoted 7 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_dc_in: regulator-dc-in-12v { · line 53

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
+     reg_vcc5v0_sys: regulator-vcc5v0-sys {

This will fall into the catogery of "non-controllable & serve no devices" see similar comment for 'reg_dc_in' which raised by Krzysztof

https://lore.kernel.org/all/[email protected]/

or should I ask, what's the real problem if regulator has no vin-supply?

If the device tree is not configured with the correct power source it will affect performance.

Quoted 1 line

Any probe failure or something bad happen? (besides /sys/../regulator_summay)

Not really; the regulator summary just confirms the PMIC used the correct power source.
with te device ip blocks.

Bananapi F3 schematics.
[1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
(page 24)

Please check the shematics VCC5V0_SYS page 4 VCC5V0_SYS->USB_VCC5V0->HDMI_VCC5V0->FAN_VCC5V0->VCC3V3_SYS

Please check the shematics VCC5V0_SYS page 24 VCC5V0_SYS input for VCC5V0_HUB and 5V_VBUS give the USB hub, which is enabled by USB3_PWREN (gpio pin)>

Plese check power tree page 4
USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

So, this series tries to fix the vin source for USB 3.0 and PCIe nodes.

Thanks
-Anand

Quoted 35 lines
Quoted 30 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +11 -1
+             compatible = "regulator-fixed";
+             regulator-name = "vcc5v0_sys";
+             regulator-min-microvolt = <5000000>;
+             regulator-max-microvolt = <5000000>;
+             regulator-boot-on;
+             regulator-always-on;
+             vin-supply = <&reg_dc_in>;
+     };
+
      reg_vcc_4v: regulator-vcc-4v {
              compatible = "regulator-fixed";
              regulator-name = "vcc_4v";
@@ -66,6 +76,7 @@ regulator-usb3-vbus-5v {
              regulator-min-microvolt = <5000000>;
              regulator-max-microvolt = <5000000>;
              regulator-always-on;
+             vin-supply = <&reg_vcc5v0_sys>;
              gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>;
              enable-active-high;
      };
@@ -75,6 +86,7 @@ usb3_hub_5v: regulator-usb3-hub-5v {
              regulator-name = "USB30_HUB";
              regulator-min-microvolt = <5000000>;
              regulator-max-microvolt = <5000000>;
+             vin-supply = <&reg_vcc5v0_sys>;
              gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>;
              enable-active-high;
      };
--
Quoted 2 lines

2.50.1

--
Yixun Lan (dlan)

author
#10 lore raw

Re: [PATCH v2 2/4] riscv: dts: spacemit: k1-bananapi-f3: Update USB regulator on onboard usb and label

In reply to Chukun Pan

Hi Chukun,

Thanks for your review comments.

Quoted 16 lines · Chukun Pan

Hi,

Quoted 13 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
@@ -366,7 +366,7 @@ &usb_dwc3 {
      hub_2_0: hub@1 {
              compatible = "usb2109,2817";
              reg = <0x1>;
-             vdd-supply = <&usb3_hub_5v>;
+             vdd-supply = <&reg_5v_vbus>;
              peer-hub = <&hub_3_0>;
              reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
      };
@@ -374,7 +374,7 @@ hub_2_0: hub@1 {
      hub_3_0: hub@2 {
              compatible = "usb2109,817";
              reg = <0x2>;
Quoted 8 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts hub_2_0: hub@1 { · line 380

Quoted 5 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
-             vdd-supply = <&usb3_hub_5v>;
+             vdd-supply = <&reg_5v_vbus>;
              peer-hub = <&hub_2_0>;
              reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
      };

This is incorrect. The hub is powered by vcc5v0_hub. According to the schematic, 5v_vbus provides the VBUS for the USB3 ports.

As per the schematics USB3_PWREN (GPIO97) pin is used to power the USB hub ports 5V_VBUS, please check this again.

VCC5V0_SYS -> USB3_PWREN -> 5V_VBUS

5V_VBUS is used to power all the USB3_TypeA_Dual ports.

Thanks
-Anand

author
#15 lore raw

Re: [PATCH v2 3/4] riscv: dts: spacemit: k1-bananapi-f3: Correct USB hub power hierarchy

In reply to Chukun Pan

Hi Chukun,

Thanks for your review comments.

Quoted 8 lines · Chukun Pan

Hi,

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_5v_vbus: regulator-usb3-vbus-5v { · line 86

Quoted 4 lines
      usb3_hub_5v: regulator-usb3-hub-5v {
              compatible = "regulator-fixed";
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
-             regulator-name = "USB30_HUB";
+             regulator-name = "VCC5V0_HUB";
Quoted 5 lines

Suggested changes:

        vcc5v0_hub: regulator-vcc5v0-hub {
                compatible = "regulator-fixed";
                regulator-name = "vcc5v0_hub";

Ok will update this if there is a positive response.

Quoted 5 lines
Quoted 3 lines
              regulator-min-microvolt = <5000000>;
              regulator-max-microvolt = <5000000>;

+ regulator-always-on;

Why always on?

The driver side does not manage enabling / disabling this regulator.

Quoted 9 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts &usb_dwc3 { · line 366

Quoted 7 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -361,6 +362,7 @@ &usb_dwc3 {
      dr_mode = "host";
      #address-cells = <1>;
      #size-cells = <0>;
+     vbus-supply = <&usb3_hub_5v>;
      status = "okay";

This is incorrect. See the previous reply.

I replied in the previous email.

Thanks
-Anand

author
#17 lore raw

Re: [PATCH v2 4/4] riscv: dts: spacemit: k1-bananapi-f3: Add vin-supply for PCIe 3.3V regulator

In reply to Anand Moon

Hi All,

Quoted 7 lines · Anand Moon

The PCIe 3.3V fixed regulator node (pcie_vcc_3v3) lacked a parent supply reference. Wire it to the 5V system rail (reg_vcc5v0_sys) via the vin-supply property to reflect the actual board power tree. This ensures correct regulator hierarchy in DTS and allows drivers to resolve supply dependencies cleanly during probe.

Plese check power tree page 4

USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

USBVBUS is power source from the typec port.

Thanks
-Anand

Quoted 25 lines
Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>

---
v2: new patch in this series.

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
index 3dbdf53b6d8e..6c06480ba100 100644
@@ -39,6 +39,7 @@ pcie_vcc_3v3: regulator-pcie-vcc3v3 {
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                regulator-always-on;
+               vin-supply = <&reg_vcc5v0_sys>;
        };
 
        reg_dc_in: regulator-dc-in-12v {
--

2.50.1

maintainer
#4 lore raw

Re: [PATCH v2 1/4] riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for Banana Pi F3

In reply to Anand Moon

Hi Anand,

Quoted 34 lines · Anand Moon

Hi Yixun,

Thanks for your review comments.

Quoted 29 lines · Yixun Lan

Hi Anand,

Quoted 18 lines · Anand Moon

Define the system 5V fixed regulator (vcc5v0_sys) supplied by the DC input. As per the schematics, vcc5v0_sys is the input power source for the VCC5V0_HUB and 5V_VBUS reglators. Update these regulators to correctly reference vcc5v0_sys as their parent (vin-supply).

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 5790d927b93d..9727ecdd9f6b 100644

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_dc_in: regulator-dc-in-12v { · line 53

Quoted 4 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -50,6 +50,16 @@ reg_dc_in: regulator-dc-in-12v {
              regulator-always-on;
      };
 
+     reg_vcc5v0_sys: regulator-vcc5v0-sys {

This will fall into the catogery of "non-controllable & serve no devices" see similar comment for 'reg_dc_in' which raised by Krzysztof

Quoted 7 lines
Quoted 3 lines

https://lore.kernel.org/all/[email protected]/

or should I ask, what's the real problem if regulator has no vin-supply?

If the device tree is not configured with the correct power source it will affect performance.

Please elaborate, or provide enough evidence to prove this, because the conclusion you gave here contradicts with what Krzysztof pointed out

Quoted 6 lines
Quoted 1 line

Any probe failure or something bad happen? (besides /sys/../regulator_summay)

Not really; the regulator summary just confirms the PMIC used the correct power source.
with te device ip blocks.

then I see it's unnecessary to add this

Quoted 7 lines

Bananapi F3 schematics.
[1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
(page 24)

Please check the shematics VCC5V0_SYS page 4 VCC5V0_SYS->USB_VCC5V0->HDMI_VCC5V0->FAN_VCC5V0->VCC3V3_SYS

Quoted 9 lines

Please check the shematics VCC5V0_SYS page 24 VCC5V0_SYS input for VCC5V0_HUB and 5V_VBUS give the USB hub, which is enabled by USB3_PWREN (gpio pin)>

Plese check power tree page 4
USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

So, this series tries to fix the vin source for USB 3.0 and PCIe nodes.

This is not what I ask..

Signature · 1 line
Yixun Lan (dlan)
author
#5 lore raw

Re: [PATCH v2 1/4] riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for Banana Pi F3

Hi Yixun,

Quoted 40 lines · Yixun Lan

Hi Anand,

Quoted 36 lines · Anand Moon

Hi Yixun,

Thanks for your review comments.

Quoted 31 lines · Yixun Lan

Hi Anand,

Quoted 18 lines · Anand Moon

Define the system 5V fixed regulator (vcc5v0_sys) supplied by the DC input. As per the schematics, vcc5v0_sys is the input power source for the VCC5V0_HUB and 5V_VBUS reglators. Update these regulators to correctly reference vcc5v0_sys as their parent (vin-supply).

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 5790d927b93d..9727ecdd9f6b 100644

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_dc_in: regulator-dc-in-12v { · line 53

Quoted 4 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -50,6 +50,16 @@ reg_dc_in: regulator-dc-in-12v {
              regulator-always-on;
      };
 
+     reg_vcc5v0_sys: regulator-vcc5v0-sys {

This will fall into the catogery of "non-controllable & serve no devices" see similar comment for 'reg_dc_in' which raised by Krzysztof

https://lore.kernel.org/all/[email protected]/

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

or should I ask, what's the real problem if regulator has no vin-supply?

If the device tree is not configured with the correct power source it will affect performance.

Please elaborate, or provide enough evidence to prove this, because the conclusion you gave here contradicts with what Krzysztof pointed out

I don’t have the schematic for that board, so I skipped replying.

Please refer to the POWER TREE diagram, which provides a clear visualization of the power sources.

This board accepts two primary power sources: a 12 V DC input and USB Type‑C power.
From the schematic’s power tree (page 4):

Type‑C → DC_IN→ SY8386J (Uxxx) → PI PMIC

According to the block diagram, the SY8386J regulator IC is responsible for generating the VCC5V0_SYS rail VCC4V0_SYS (see page 13).

USBVBUS → SY8386J → VCC5V0_SYS
USBVBUS → SY8386J → VCC4V0_SYS

USBVBUS ( TypeC port) --> DC_IN--> 12V

In this design, the SY8386J operates as a step‑down converter, supplying both VCC4V0_SYS and VCC5V0_SYS rails and P! PMIC.

SY8386 is a high-efficiency synchronous step-down DC/DC regulator capable of delivering up to 6A with wide input voltage support and multiple protection features.
Datasheet [1] https://datasheet4u.com/download_new.php?id=1604744

I have tried to elaborate as clearly as I can.

Quoted 20 lines
Quoted 7 lines
Quoted 2 lines

Any probe failure or something bad happen? (besides /sys/../regulator_summay)

Not really; the regulator summary just confirms the PMIC used the correct power source.
with te device ip blocks.

then I see it's unnecessary to add this

Quoted 11 lines

Bananapi F3 schematics.
[1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
(page 24)

Please check the shematics VCC5V0_SYS page 4 VCC5V0_SYS->USB_VCC5V0->HDMI_VCC5V0->FAN_VCC5V0->VCC3V3_SYS

Please check the shematics VCC5V0_SYS page 24 VCC5V0_SYS input for VCC5V0_HUB and 5V_VBUS give the USB hub, which is enabled by USB3_PWREN (gpio pin)>

Quoted 6 lines
Quoted 5 lines

Plese check power tree page 4
USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

So, this series tries to fix the vin source for USB 3.0 and PCIe nodes.

This is not what I ask..

Opps, I tried, but I wasn’t able to clearly elaborate on how the power sources are distributed across the various peripherals.

Quoted 3 lines

--
Yixun Lan (dlan)

Thanks
-Anand

maintainer
#6 lore raw

Re: [PATCH v2 1/4] riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for Banana Pi F3

Hi Anand,

Quoted 43 lines · Anand Moon

Hi Yixun,

Quoted 40 lines · Yixun Lan

Hi Anand,

Quoted 36 lines · Anand Moon

Hi Yixun,

Thanks for your review comments.

Quoted 31 lines · Yixun Lan

Hi Anand,

Quoted 18 lines · Anand Moon

Define the system 5V fixed regulator (vcc5v0_sys) supplied by the DC input. As per the schematics, vcc5v0_sys is the input power source for the VCC5V0_HUB and 5V_VBUS reglators. Update these regulators to correctly reference vcc5v0_sys as their parent (vin-supply).

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 5790d927b93d..9727ecdd9f6b 100644

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_dc_in: regulator-dc-in-12v { · line 53

Quoted 4 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -50,6 +50,16 @@ reg_dc_in: regulator-dc-in-12v {
              regulator-always-on;
      };
 
+     reg_vcc5v0_sys: regulator-vcc5v0-sys {

This will fall into the catogery of "non-controllable & serve no devices" see similar comment for 'reg_dc_in' which raised by Krzysztof

https://lore.kernel.org/all/[email protected]/

Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

or should I ask, what's the real problem if regulator has no vin-supply?

If the device tree is not configured with the correct power source it will affect performance.

Please elaborate, or provide enough evidence to prove this, because the conclusion you gave here contradicts with what Krzysztof pointed out

I don’t have the schematic for that board, so I skipped replying.

No, you didn't answer my question, I was asking why "affect performance", and you just gave me the opposite conclusion

Let me elaborate, the reg_vcc5v0_sys is a regulator which has no software or GPIO control, so no need software control from kernel/driver perspective, which also mean it will be automatically enabled from hardware perspective once the board power up - "non-controllable" in Krzysztof's reply

the reg_vcc5v0_sys currently only serve as vin for other regulator which is not a device (e.g not USB, PCIe, eMMC..) - "serve no devices" in Krzysztof's reply..

and by introducing reg_vcc5v0_sys, kernel driver need to do additional work to go through probe procedure and register the regulator device, consumer depend on it need to wait, this will hurt performance, slow down system boot and even consume more memory..

By dropping reg_vcc5v0_sys, it will result as a stripped power source tree, this is only downside I can see, but doesn't really hurt..

Quoted 18 lines

Please refer to the POWER TREE diagram, which provides a clear visualization of the power sources.

This board accepts two primary power sources: a 12 V DC input and USB Type‑C power.
From the schematic’s power tree (page 4):

Type‑C → DC_IN→ SY8386J (Uxxx) → PI PMIC

According to the block diagram, the SY8386J regulator IC is responsible for generating the VCC5V0_SYS rail VCC4V0_SYS (see page 13).

USBVBUS → SY8386J → VCC5V0_SYS
USBVBUS → SY8386J → VCC4V0_SYS

USBVBUS ( TypeC port) --> DC_IN--> 12V

Quoted 7 lines

In this design, the SY8386J operates as a step‑down converter, supplying both VCC4V0_SYS and VCC5V0_SYS rails and P! PMIC.

SY8386 is a high-efficiency synchronous step-down DC/DC regulator capable of delivering up to 6A with wide input voltage support and multiple protection features.
Datasheet [1] https://datasheet4u.com/download_new.php?id=1604744

so right, SY8386 is a passive device which need no software control, non-controllable..

Quoted 22 lines

I have tried to elaborate as clearly as I can.

Quoted 20 lines
Quoted 7 lines
Quoted 2 lines

Any probe failure or something bad happen? (besides /sys/../regulator_summay)

Not really; the regulator summary just confirms the PMIC used the correct power source.
with te device ip blocks.

then I see it's unnecessary to add this

Quoted 11 lines

Bananapi F3 schematics.
[1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
(page 24)

Please check the shematics VCC5V0_SYS page 4 VCC5V0_SYS->USB_VCC5V0->HDMI_VCC5V0->FAN_VCC5V0->VCC3V3_SYS

Please check the shematics VCC5V0_SYS page 24 VCC5V0_SYS input for VCC5V0_HUB and 5V_VBUS give the USB hub, which is enabled by USB3_PWREN (gpio pin)>

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

Plese check power tree page 4
USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

So, this series tries to fix the vin source for USB 3.0 and PCIe nodes.

This is not what I ask..

Opps, I tried, but I wasn’t able to clearly elaborate on how the power sources are distributed across the various peripherals.

Hope I make it clear this time..

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

Re: [PATCH v2 1/4] riscv: dts: spacemit: k1-bananapi-f3: Add vcc5v0_sys regulator for Banana Pi F3

Hi Yixun,

Quoted 52 lines · Yixun Lan

Hi Anand,

Quoted 48 lines · Anand Moon

Hi Yixun,

Quoted 45 lines · Yixun Lan

Hi Anand,

Quoted 41 lines · Anand Moon

Hi Yixun,

Thanks for your review comments.

Quoted 25 lines · Yixun Lan

Hi Anand,

Quoted 21 lines · Anand Moon

Define the system 5V fixed regulator (vcc5v0_sys) supplied by the DC input. As per the schematics, vcc5v0_sys is the input power source for the VCC5V0_HUB and 5V_VBUS reglators. Update these regulators to correctly reference vcc5v0_sys as their parent (vin-supply).

Cc Han Gao <[email protected]>
Cc Ze Huang <[email protected]>
Cc Chukun Pan <[email protected]>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +0 -0
index 5790d927b93d..9727ecdd9f6b 100644
@@ -50,6 +50,16 @@ reg_dc_in: regulator-dc-in-12v {
              regulator-always-on;
      };
 
Quoted 7 lines

arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts reg_dc_in: regulator-dc-in-12v { · line 53

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
+     reg_vcc5v0_sys: regulator-vcc5v0-sys {

This will fall into the catogery of "non-controllable & serve no devices" see similar comment for 'reg_dc_in' which raised by Krzysztof

https://lore.kernel.org/all/[email protected]/

or should I ask, what's the real problem if regulator has no vin-supply?

If the device tree is not configured with the correct power source it will affect performance.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Please elaborate, or provide enough evidence to prove this, because the conclusion you gave here contradicts with what Krzysztof pointed out

I don’t have the schematic for that board, so I skipped replying.

No, you didn't answer my question, I was asking why "affect performance", and you just gave me the opposite conclusion

I tried to justify my changes according to the schematic I understood.

Quoted 9 lines

Let me elaborate, the reg_vcc5v0_sys is a regulator that has no software or GPIO control, so no need software control from the kernel/driver perspective, which also mean it will be automatically enabled from hardware perspective once the board power up - "non-controllable" in Krzysztof's reply

the reg_vcc5v0_sys currently only serve as vin for other regulator which is not a device (e.g not USB, PCIe, eMMC..) - "serve no devices" in Krzysztof's reply..

Many development boards follow a similar regulator structure, with fixed regulators assigned to USB, PCIe, and other internal subsystems. This design is consistent with the semantics diagram, so I’m not introducing anything new.

Quoted 5 lines

and by introducing reg_vcc5v0_sys, kernel driver need to do additional work to go through probe procedure and register the regulator device, consumer depend on it need to wait, this will hurt performance, slow down system boot and even consume more memory..

No, it simply defines the power hierarchy to ensure that each device receives the appropriate power source.

Quoted 3 lines

By dropping reg_vcc5v0_sys, it will result as a stripped power source tree, this is only downside I can see, but doesn't really hurt..

No issue. If my changes are breaking your development board, please drop this.

Quoted 21 lines
Quoted 21 lines

Please refer to the POWER TREE diagram, which provides a clear visualization of the power sources.

This board accepts two primary power sources: a 12 V DC input and USB Type‑C power.
From the schematic’s power tree (page 4):

Type‑C → DC_IN→ SY8386J (Uxxx) → PI PMIC

According to the block diagram, the SY8386J regulator IC is responsible for generating the VCC5V0_SYS rail VCC4V0_SYS (see page 13).

USBVBUS → SY8386J → VCC5V0_SYS
USBVBUS → SY8386J → VCC4V0_SYS

USBVBUS ( TypeC port) --> DC_IN--> 12V

In this design, the SY8386J operates as a step‑down converter, supplying both VCC4V0_SYS and VCC5V0_SYS rails and P! PMIC.

Quoted 7 lines
Quoted 4 lines

SY8386 is a high-efficiency synchronous step-down DC/DC regulator capable of delivering up to 6A with wide input voltage support and multiple protection features.
Datasheet [1] https://datasheet4u.com/download_new.php?id=1604744

so right, SY8386 is a passive device which need no software control, non-controllable..

Not all regulators are software-controlled.
If the K1 P1 power management IC provides 5 V rails, these can be utilized to supply internal peripherals

Quoted 25 lines
Quoted 25 lines

I have tried to elaborate as clearly as I can.

Quoted 23 lines
Quoted 7 lines
Quoted 2 lines

Any probe failure or something bad happen? (besides /sys/../regulator_summay)

Not really; the regulator summary just confirms the PMIC used the correct power source.
with te device ip blocks.

then I see it's unnecessary to add this

Quoted 14 lines

Bananapi F3 schematics.
[1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
(page 24)

Please check the shematics VCC5V0_SYS page 4 VCC5V0_SYS->USB_VCC5V0->HDMI_VCC5V0->FAN_VCC5V0->VCC3V3_SYS

Please check the shematics VCC5V0_SYS page 24 VCC5V0_SYS input for VCC5V0_HUB and 5V_VBUS give the USB hub, which is enabled by USB3_PWREN (gpio pin)>

Plese check power tree page 4
USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

So, this series tries to fix the vin source for USB 3.0 and PCIe nodes.

This is not what I ask..

Opps, I tried, but I wasn’t able to clearly elaborate on how the power sources are distributed across the various peripherals.

Hope I make it clear this time..

I tried to elaborate, but wasn’t successful.

Quoted 3 lines

--
Yixun Lan (dlan)

Thanks
-Anand

#11 lore raw

Re: [PATCH v2 2/4] riscv: dts: spacemit: k1-bananapi-f3: Update USB regulator on onboard usb and label

In reply to Anand Moon

Hi,

Quoted 9 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-             vdd-supply = <&usb3_hub_5v>;
+             vdd-supply = <&reg_5v_vbus>;

As per the schematics USB3_PWREN (GPIO97) pin is used to power the USB hub ports 5V_VBUS, please check this again.

VCC5V0_SYS -> USB3_PWREN -> 5V_VBUS

5V_VBUS is used to power all the USB3_TypeA_Dual ports.

This is correct, so shouldn't 5V_VBUS be for vbus-supply? VCC5V0_HUB powers the VL817 chip.

#18 lore raw

Re: [PATCH v2 4/4] riscv: dts: spacemit: k1-bananapi-f3: Add vin-supply for PCIe 3.3V regulator

In reply to Anand Moon

Hi,

Quoted 9 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -39,6 +39,7 @@ pcie_vcc_3v3: regulator-pcie-vcc3v3 {
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 		regulator-always-on;
+		vin-supply = <&reg_vcc5v0_sys>;
 	};
 

Plese check power tree page 4

Quoted 3 lines

USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

USBVBUS is power source from the typec port.

So this isn't from VCC5V0_SYS. USBVBUS and DC_IN can be considered as the same power source.

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

author
#19 lore raw

Re: [PATCH v2 4/4] riscv: dts: spacemit: k1-bananapi-f3: Add vin-supply for PCIe 3.3V regulator

Hi Chukun

Quoted 10 lines · Chukun Pan

Hi,

Quoted 6 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -0
@@ -39,6 +39,7 @@ pcie_vcc_3v3: regulator-pcie-vcc3v3 {
              regulator-min-microvolt = <3300000>;
              regulator-max-microvolt = <3300000>;
              regulator-always-on;
+             vin-supply = <&reg_vcc5v0_sys>;
      };
Quoted 8 lines
Quoted 5 lines

Plese check power tree page 4

USBVBUS->SY8386J UXXX -> PCIE_VCC3V3 for pcie vin source

USBVBUS is power source from the typec port.

So this isn't from VCC5V0_SYS. USBVBUS and DC_IN can be considered as the same power source.

I am not the hardware person. USBVBUS supplies 12V, and VCC5V0_SYS supplies 5V As I understand it, SY8386J UXXX serves as a step-down DC/DC regulator for your PCI device.

[1] https://datasheet4u.com/download_new.php?id=1604744

USBVBUS is the input for the PCIe source, so this should be vin-supply = <&rreg_dc_in>;
It is as per the schematic

Thanks
-Anand