[OpenWrt-Devel] [PATCH] lantiq: use gpio_hog instead of gpio-export
Birger Koblitz
mail at birger-koblitz.de
Fri Aug 2 05:57:44 EDT 2019
lantiq: use gpio_hog instead of gpio-export
The `gpio-export` functionality is a hack for
missing kernel functionality, which was rejected in upstream kernel long
time
ago, for details see this email
http://lists.infradead.org/pipermail/openwrt-devel/2019-February/015772.html,
discussion in PR#1366 or
https://github.com/openwrt/openwrt/pull/1814#issuecomment-462942022.
This patch converts all remaining lantiq .dts(i) files which were
using export-gpio and not making use of the change-direction functionality
to using gpio_hog instead
Signed-off-by: Birger Koblitz <mail at birger-koblitz.de>
---
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
index e9c418e482..c597febeeb 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
@@ -110,15 +110,16 @@
};
/* is there another way to "reserve" the GPIO? */
- gpio_export {
- compatible = "gpio-export";
- #size-cells = <0>;
+};
- switch {
- gpio-export,name = "switch";
- gpio-export,output = <1>;
- gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
- };
+&gpio {
+ status = "okay";
+
+ switch {
+ gpio-hog;
+ line-name = "switch";
+ gpios = <19 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/ASL56026.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/ASL56026.dts
index 1c7f03c355..5d801d14ec 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/ASL56026.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/ASL56026.dts
@@ -58,16 +58,16 @@
gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
};
};
+};
- gpio_export {
- compatible = "gpio-export";
- #size-cells = <0>;
+&gpio {
+ status = "okay";
- power_led_blink {
- gpio-export,name = "power_led_blink";
- gpio-export,output = <0>;
- gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
- };
+ power_led_blink {
+ gpio-hog;
+ line-name = "power_led_blink";
+ gpios = <16 GPIO_ACTIVE_LOW>;
+ output-low;
};
};
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/DM200.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/DM200.dts
index 4796123c20..0b21b67504 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/DM200.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/DM200.dts
@@ -37,22 +37,6 @@
};
};
- gpio_export {
- compatible = "gpio-export";
- #size-cells = <0>;
-
- annexa {
- gpio-export,name = "annexa";
- gpio-export,output = <0>;
- gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
- };
- annexb {
- gpio-export,name = "annexb";
- gpio-export,output = <0>;
- gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
- };
- };
-
leds {
compatible = "gpio-leds";
@@ -85,6 +69,24 @@
};
};
+&gpio {
+ status = "okay";
+
+ annexa {
+ gpio-hog;
+ line-name = "annexa";
+ gpios = <12 GPIO_ACTIVE_HIGH>;
+ output-low;
+ };
+
+ annexb {
+ gpio-hog;
+ line-name = "annexb";
+ gpios = <15 GPIO_ACTIVE_HIGH>;
+ output-low;
+ };
+};
+
ð0 {
lantiq,phys = <&gphy1>;
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
index a9a5cbae2f..6b4ab7f918 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
@@ -28,17 +28,6 @@
};
};
- gpio_export {
- compatible = "gpio-export";
- #size-cells = <0>;
-
- switch {
- gpio-export,name = "switch";
- gpio-export,output = <1>;
- gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
- };
- };
-
usb_vbus: regulator-usb-vbus {
compatible = "regulator-fixed";
@@ -52,6 +41,17 @@
};
};
+&gpio {
+ status = "okay";
+
+ switch {
+ gpio-hog;
+ line-name = "switch";
+ gpios = <19 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+};
+
&gpio {
pinctrl-names = "default";
pinctrl-0 = <&state_default>;
@@ -64,10 +64,6 @@
};
};
-&gpios {
- status = "okay";
-};
-
&gsw {
phy-mode = "rmii";
};
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
index 9b640e0327..fe0e5af0c1 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
@@ -84,27 +84,6 @@
};
};
- gpio_export {
- compatible = "gpio-export";
- #size-cells = <0>;
-
- switch {
- gpio-export,name = "switch";
- gpio-export,output = <1>;
- gpios = <&gpio 38 GPIO_ACTIVE_HIGH>;
- };
- usb {
- gpio-export,name = "usb";
- gpio-export,output = <1>;
- gpios = <&gpio 28 GPIO_ACTIVE_HIGH>;
- };
- wifi {
- gpio-export,name = "wifi";
- gpio-export,output = <1>;
- gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
- };
- };
-
usb_vbus: regulator-usb-vbus {
compatible = "regulator-fixed";
@@ -118,6 +97,31 @@
};
};
+&gpio {
+ status = "okay";
+
+ switch {
+ gpio-hog;
+ line-name = "switch";
+ gpios = <38 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+
+ usb {
+ gpio-hog;
+ line-name = "usb";
+ gpios = <28 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+
+ wifi {
+ gpio-hog;
+ line-name = "wifi";
+ gpios = <7 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+};
+
&gpio {
pinctrl-names = "default";
pinctrl-0 = <&state_default>;
@@ -165,7 +169,6 @@
status = "okay";
};
-
&usb0 {
status = "okay";
vbus-supply = <&usb_vbus>;
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
index 62e5e70169..9abc5745e4 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
@@ -85,16 +85,16 @@
gpios = <&stp 10 GPIO_ACTIVE_LOW>;
};
};
+};
- gpio_export {
- compatible = "gpio-export";
- #size-cells = <0>;
+&gpio {
+ status = "okay";
- switch {
- gpio-export,name = "switch";
- gpio-export,output = <1>;
- gpios = <&gpio 50 GPIO_ACTIVE_HIGH>;
- };
+ switch {
+ gpio-hog;
+ line-name = "switch";
+ gpios = <50 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list