[openwrt/openwrt] ramips: mt7621: convert usb power to regulators

LEDE Commits lede-commits at lists.infradead.org
Sun Nov 3 11:08:22 PST 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/e612900ae0fd6c4624fa661e004536216409107f

commit e612900ae0fd6c4624fa661e004536216409107f
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Thu Oct 24 14:51:29 2024 -0700

    ramips: mt7621: convert usb power to regulators
    
    These things are regulators. Should silence dmesg messages about using
    dummy regulators.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/16804
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../linux/ramips/dts/mt7621_d-team_newifi-d2.dts   | 20 ++++++++++---------
 target/linux/ramips/dts/mt7621_humax_e10.dts       | 23 ++++++++++++----------
 .../dts/mt7621_mikrotik_routerboard-7xx.dtsi       | 17 +++++++++++-----
 .../ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi  | 19 ++++++++++++------
 .../ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi      | 19 ++++++++++++------
 .../linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts | 19 +++++++++---------
 .../linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts | 17 +++++++++++-----
 7 files changed, 84 insertions(+), 50 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts
index 9d426fb17d..00ff80e3ca 100644
--- a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts
+++ b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts
@@ -80,15 +80,13 @@
 		};
 	};
 
-	gpio_export {
-		compatible = "gpio-export";
-		#size-cells = <0>;
-
-		power_usb3 {
-			gpio-export,name = "power_usb3";
-			gpio-export,output = <1>;
-			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
-		};
+	reg_power_usb3: regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "power_usb3";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
 	};
 };
 
@@ -155,6 +153,10 @@
 	};
 };
 
+&xhci {
+	vbus-supply = <&reg_power_usb3>;
+};
+
 &pcie {
 	status = "okay";
 };
diff --git a/target/linux/ramips/dts/mt7621_humax_e10.dts b/target/linux/ramips/dts/mt7621_humax_e10.dts
index 39eac32d53..7ba772d5e5 100644
--- a/target/linux/ramips/dts/mt7621_humax_e10.dts
+++ b/target/linux/ramips/dts/mt7621_humax_e10.dts
@@ -19,16 +19,6 @@
 		label-mac-device = &gmac1;
 	};
 
-	gpio-export {
-		compatible = "gpio-export";
-
-		gpio-usb-power {
-			gpio-export,name = "power:usb";
-			gpio-export,output = <1>;
-			gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
-		};
-	};
-
 	leds {
 		compatible = "gpio-leds";
 
@@ -65,6 +55,15 @@
 			linux,code = <KEY_RESTART>;
 		};
 	};
+
+	reg_power_usb: regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "power:usb";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
 };
 
 &spi0 {
@@ -131,6 +130,10 @@
 	};
 };
 
+&xhci {
+	vbus-supply = <&reg_power_usb>;
+};
+
 &pcie {
 	status = "okay";
 };
diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi
index cdca47f8b8..4a3de8cfba 100644
--- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi
+++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi
@@ -13,15 +13,22 @@
 			gpio-export,output = <0>;
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 		};
+	};
 
-		usb_power {
-			gpio-export,name = "usb_power";
-			gpio-export,output = <1>;
-			gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
-		};
+	reg_usb_power: regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "usb_power";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
 	};
 };
 
+&xhci {
+	vbus-supply = <&reg_usb_power>;
+};
+
 &keys {
 	mode {
 		label = "mode";
diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi
index c3712fea7b..c70b3330e9 100644
--- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi
+++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi
@@ -48,6 +48,15 @@
 		};
 	};
 
+	reg_power_usb: regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "power_usb";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	watchdog {
 		compatible = "linux,wdt-gpio";
 		gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
@@ -72,15 +81,13 @@
 			gpio-export,output = <1>;
 			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		};
-
-		ext-usb {
-			gpio-export,name = "ext-usb";
-			gpio-export,output = <1>;
-			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
-		};
 	};
 };
 
+&xhci {
+	vbus-supply = <&reg_power_usb>;
+};
+
 &sdhci {
 	status = "okay";
 };
diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi
index dcad7b26d2..3e2a593ae7 100644
--- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi
+++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi
@@ -47,6 +47,15 @@
 		};
 	};
 
+	reg_power_usb: regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "power_usb";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	watchdog {
 		compatible = "linux,wdt-gpio";
 		gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
@@ -71,15 +80,13 @@
 			gpio-export,output = <1>;
 			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		};
-
-		ext-usb {
-			gpio-export,name = "ext-usb";
-			gpio-export,output = <1>;
-			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
-		};
 	};
 };
 
+&xhci {
+	vbus-supply = <&reg_power_usb>;
+};
+
 &sdhci {
 	status = "okay";
 };
diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts b/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts
index 9eed123157..88894325b5 100644
--- a/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts
+++ b/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts
@@ -96,17 +96,18 @@
 
 	};
 
+	reg_power_usb: regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "power_usb";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
 };
 
-&gpio {
-	status = "okay";
-
-	enable_usb_power {
-		gpio-hog;
-		line-name = "enable USB power";
-		gpios = <7 GPIO_ACTIVE_HIGH>;
-		output-high;
-	};
+&xhci {
+	vbus-supply = <&reg_power_usb>;
 };
 
 &nand {
diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts
index e121077b0a..e6ff5ecf6a 100644
--- a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts
+++ b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts
@@ -92,15 +92,22 @@
 			gpio-export,output = <0>;
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 		};
+	};
 
-		usb_power {
-			gpio-export,name = "usb_power";
-			gpio-export,output = <1>;
-			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
-		};
+	reg_usb_power: regulator {
+		compatible = "regulator-fixed";
+		reglator-name = "usb_power";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
 	};
 };
 
+&xhci {
+	vbus-supply = <&reg_usb_power>;
+};
+
 &nand {
 	status = "okay";
 




More information about the lede-commits mailing list