diff mbox series

[OpenWrt-Devel,5/5] apm821xx: clean up gpio-hogs

Message ID 5246431e3a13f715a4922e77f17ddf3362b474f3.1532858046.git.chunkeey@gmail.com
State Accepted
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel,1/5] ipq-wifi: add a note / reminder about upstreaming new board files | expand

Commit Message

Christian Lamparter July 29, 2018, 9:55 a.m. UTC
convert the usb and both sata port power related gpio-hogs to
what they really are: fixed-regulators.

The ethernet phy-reset gpio-hog is replaced by a proper
upstream (4.15+) reset-gpios property in the mdio-node.
So this will work eventually.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
 target/linux/apm821xx/dts/wd-mybooklive.dts | 59 ++++++++++-----------
 target/linux/apm821xx/sata/config-default   |  2 +
 2 files changed, 31 insertions(+), 30 deletions(-)
diff mbox series

Patch

diff --git a/target/linux/apm821xx/dts/wd-mybooklive.dts b/target/linux/apm821xx/dts/wd-mybooklive.dts
index aee0d3266d..4c61987119 100644
--- a/target/linux/apm821xx/dts/wd-mybooklive.dts
+++ b/target/linux/apm821xx/dts/wd-mybooklive.dts
@@ -59,14 +59,6 @@ 
 		#gpio-cells = <2>;
 		gpio-controller;
 
-		enable-phy {
-			/* toggle to reset EMAC PHY */
-			gpio-hog;
-			line-name = "enable EMAC PHY";
-			gpios = <0 GPIO_ACTIVE_LOW>;
-			output-low;
-		};
-
 		enable-button {
 			/* Defined in u-boot as: NOT_NOR
 			 * "enables features other than NOR
@@ -83,27 +75,6 @@ 
 			gpios = <1 GPIO_ACTIVE_HIGH>;
 			output-low;
 		};
-
-		enable-usb {
-			gpio-hog;
-			line-name = "Power USB Core";
-			gpios = <2 GPIO_ACTIVE_LOW>;
-			output-low;
-		};
-
-		enable-port1 {
-			gpio-hog;
-			line-name = "Power Drive Port 1";
-			gpios = <3 GPIO_ACTIVE_LOW>;
-			output-low;
-		};
-
-		enable-port0 {
-			gpio-hog;
-			line-name = "Power Drive Port 0";
-			gpios = <7 GPIO_ACTIVE_LOW>;
-			output-low;
-		};
 	};
 
 	GPIO2: gpio2@e0100000 {
@@ -135,7 +106,7 @@ 
 		};
 	};
 
-	gpio_keys_polled {
+	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -148,6 +119,32 @@ 
 			gpios = <&GPIO2 2 GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	usbpwr: usb-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "Power USB Core";
+		gpios = <&GPIO1 2 GPIO_ACTIVE_LOW>;
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+	};
+
+	sata1pwr: sata1-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "Power Drive Port 1";
+		gpios = <&GPIO1 3 GPIO_ACTIVE_LOW>;
+		regulator-min-microvolt = <12000000>;
+		regulator-max-microvolt = <12000000>;
+		regulator-always-on; /* needed to read OS from HDD */
+	};
+
+	sata0pwr: sata0-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "Power Drive Port 0";
+		gpios = <&GPIO1 7 GPIO_ACTIVE_LOW>;
+		regulator-min-microvolt = <12000000>;
+		regulator-max-microvolt = <12000000>;
+		regulator-always-on; /* needed to read OS from HDD */
+	};
 };
 
 &EMAC0 {
@@ -160,6 +157,7 @@ 
 	mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		reset-gpios = <&GPIO1 0 GPIO_ACTIVE_LOW>;
 
 		phy: phy@1 {
 			compatible = "ethernet-phy-ieee802.3-c22";
@@ -195,4 +193,5 @@ 
 &USBOTG0 {
 	status = "okay";
 	dr_mode = "host";
+	vbus-supply = <&usbpwr>;
 };
diff --git a/target/linux/apm821xx/sata/config-default b/target/linux/apm821xx/sata/config-default
index 4c7c655233..5af8c338f5 100644
--- a/target/linux/apm821xx/sata/config-default
+++ b/target/linux/apm821xx/sata/config-default
@@ -45,3 +45,5 @@  CONFIG_PPC_EARLY_DEBUG_44x=y
 # CONFIG_PPC_EARLY_DEBUG_MEMCONS is not set
 CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH=0x4
 CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW=0xef600300
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y