Skip to contentSkip to conversation

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

PATCH Superseded Anand Moon 1 participant 4 messages Apr 3

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Anand Moon

author
#0 lore raw

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

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

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

Use this patch now we can enable USB hub
[2] https://lore.kernel.org/all/[email protected]/

check regulator_summary for more details

$ cat /sys/kernel/debug/regulator/regulator_summary 
 dc_in_12v                        3    2      0 unknown 12000mV     0mA 12000mV 12000mV
    vcc5v0_sys                    3    2      0 unknown  5000mV     0mA  5000mV  5000mV
       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
    vcc_4v                        1    0      0 unknown  4000mV     0mA  4000mV  4000mV

Thanks
-Anand

Anand Moon (3):
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 lable
riscv: dts: spacemit: k1-bananapi-f3: Correct USB hub power hierarchy

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

base-commit: cc13002a9f984d37906e9476f3e532a8cdd126f5

Signature · 1 line
2.53.0
author
#1 lore raw

PATCH 1/3 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.53.0
author
#2 lore raw

PATCH 2/3 riscv: dts: spacemit: k1-bananapi-f3: Update USB regulator on onboard usb and lable

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.53.0
author
#3 lore raw

PATCH 3/3 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.53.0