[OpenWrt-Devel] [PATCH] ath79: use gpio_hog instead of gpio-export
Birger Koblitz
mail at birger-koblitz.de
Fri Aug 2 05:53:32 EDT 2019
ath79: 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 ath79 .dts files which were
using export-gpio to using gpio_hog instead
Signed-off-by: Birger Koblitz <mail at birger-koblitz.de>
---
diff --git a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts
b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts
index df22eb8dc4..822858aab7 100644
--- a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts
+++ b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts
@@ -121,16 +121,6 @@
};
};
- gpio-export {
- compatible = "gpio-export";
-
- gpio_usb_power {
- gpio-export,name = "buffalo:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
- };
- };
-
flash {
compatible = "mtd-concat";
@@ -173,6 +163,17 @@
};
};
+&gpio {
+ status = "okay";
+
+ usb {
+ gpio-hog;
+ line-name = "buffalo:power:usb";
+ gpios = <2 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+};
+
&usb_phy {
status = "okay";
};
diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi
b/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi
index 04403637b6..de0deb3f3c 100644
--- a/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi
+++ b/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi
@@ -3,15 +3,16 @@
#include "ar7241_tplink.dtsi"
/ {
- gpio-export {
- compatible = "gpio-export";
- #size-cells = <0>;
-
- gpio_usb_power {
- gpio-export,name = "tp-link:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
- };
+};
+
+&gpio {
+ status = "okay";
+
+ usb {
+ gpio-hog;
+ line-name = "tp-link:power:usb";
+ gpios = <6 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts
b/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts
index 282446b1e1..829f1fe0e7 100644
--- a/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts
+++ b/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts
@@ -66,15 +66,16 @@
linux,default-trigger = "phy0tpt";
};
};
+};
- gpio-export {
- compatible = "gpio-export";
+&gpio {
+ status = "okay";
- gpio_usb_power {
- gpio-export,name = "tp-link:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
- };
+ usb {
+ gpio-hog;
+ line-name = "tp-link:power:usb";
+ gpios = <6 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -155,10 +156,6 @@
mtd-mac-address-increment = <1>;
};
-&gpio {
- status = "okay";
-};
-
&uart {
status = "okay";
};
diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
index 70ce41b84d..aee37729b1 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
@@ -58,17 +58,6 @@
};
};
- gpio-export {
- compatible = "gpio-export";
- #size-cells = <0>;
-
- gpio_usb_power {
- gpio-export,name = "buffalo:usb-power";
- gpio-export,output = <1>;
- gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
- };
- };
-
virtual_flash {
compatible = "mtd-concat";
devices = <&flash0 &flash1>;
@@ -110,6 +99,17 @@
};
};
+&gpio {
+ status = "okay";
+
+ usb-power {
+ gpio-hog;
+ line-name = "buffalo:usb-power";
+ gpios = <16 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+};
+
&spi {
status = "okay";
cs-gpios = <0>, <0>;
diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
index 97bfd0f842..9f04025598 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
@@ -110,17 +110,6 @@
};
};
- gpio-export {
- compatible = "gpio-export";
- #size-cells = <0>;
-
- gpio_usb_power {
- gpio-export,name = "buffalo:usb-power";
- gpio-export,output = <1>;
- gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
- };
- };
-
virtual_flash {
compatible = "mtd-concat";
devices = <&flash0 &flash1>;
@@ -162,6 +151,17 @@
};
};
+&gpio {
+ status = "okay";
+
+ usb-power {
+ gpio-hog;
+ line-name = "buffalo:usb-power";
+ gpios = <13 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+};
+
&spi {
status = "okay";
cs-gpios = <0>, <0>;
diff --git a/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts
b/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts
index c7a251cbf1..f91f092d37 100644
--- a/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts
+++ b/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts
@@ -92,15 +92,16 @@
linux,default-trigger = "usbport";
};
};
+};
- gpio-export {
- compatible = "gpio-export";
+&gpio {
+ status = "okay";
- gpio_usb_power {
- gpio-export,name = "tp-link:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
- };
+ usb {
+ gpio-hog;
+ line-name = "tp-link:power:usb";
+ gpios = <4 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -112,10 +113,6 @@
status = "okay";
};
-&gpio {
- status = "okay";
-};
-
&spi {
num-cs = <1>;
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
index 6be197c0cf..a4659a9ec1 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
@@ -75,33 +75,37 @@
debounce-interval = <60>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
+&gpio {
+ status = "okay";
- gpio_usb1_power {
- gpio-export,name = "tp-link:power:usb1";
- gpio-export,output = <1>;
- gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
- };
+ usb1 {
+ gpio-hog;
+ line-name = "tp-link:power:usb1";
+ gpios = <22 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
- gpio_usb2_power {
- gpio-export,name = "tp-link:power:usb2";
- gpio-export,output = <1>;
- gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
+ usb2 {
+ gpio-hog;
+ line-name = "tp-link:power:usb2";
+ gpios = <21 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
- gpio_ext_lna0 {
- gpio-export,name = "tp-link:ext:lna0";
- gpio-export,output = <1>;
- gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
- };
+ lna0 {
+ gpio-hog;
+ line-name = "tp-link:ext:lna0";
+ gpios = <18 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
- gpio_ext_lna1 {
- gpio-export,name = "tp-link:ext:lna1";
- gpio-export,output = <1>;
- gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
- };
+ lna1 {
+ gpio-hog;
+ line-name = "tp-link:ext:lna1";
+ gpios = <19 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -113,10 +117,6 @@
status = "okay";
};
-&gpio {
- status = "okay";
-};
-
&spi {
num-cs = <1>;
diff --git a/target/linux/ath79/dts/qca9531_yuncore_a770.dts
b/target/linux/ath79/dts/qca9531_yuncore_a770.dts
index da5b6dc7db..18ad6307a1 100644
--- a/target/linux/ath79/dts/qca9531_yuncore_a770.dts
+++ b/target/linux/ath79/dts/qca9531_yuncore_a770.dts
@@ -8,7 +8,7 @@
/ {
model = "YunCore A770";
- compatible = "yuncore,a770", "qca,qca9531";
+ compatible = "yuncore,a770", "qca,qca9533";
aliases {
led-boot = &status;
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
index 2570eb7cea..0e4c97bd41 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
@@ -53,16 +53,16 @@
compatible = "gpio-beeper";
gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
};
+};
+&gpio {
+ status = "okay";
- gpio_export {
- compatible = "gpio-export";
-
- gpio_usb_power {
- gpio-export,name = "devolo:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
- };
+ usb {
+ gpio-hog;
+ line-name = "devolo:power:usb";
+ gpios = <11 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
index b6dc43fbfc..38b2d2750c 100644
--- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
+++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
@@ -51,21 +51,23 @@
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
- #size-cells = <0>;
+&gpio {
+ status = "okay";
- gpio_pa_dcdc {
- gpio-export,name = "om5pac:pa_dcdc";
- gpio-export,output = <1>;
- gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
- };
- gpio_pa_high {
- gpio-export,name = "om5pac:pa_high";
- gpio-export,output = <1>;
- gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
- };
+ pa_dcdc {
+ gpio-hog;
+ line-name = "om5pac:pa_dcdc";
+ gpios = <2 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+
+ pa_high {
+ gpio-hog;
+ line-name = "om5pac:pa_high";
+ gpios = <16 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi
b/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi
index 343d318e0b..095d7d759f 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi
@@ -63,22 +63,23 @@
debounce-interval = <60>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
-
- gpio_usb1_power {
- gpio-export,name = "tp-link:power:usb1";
- gpio-export,output = <1>;
- gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
+&gpio {
+ status = "okay";
- gpio_usb2_power {
- gpio-export,name = "tp-link:power:usb2";
- gpio-export,output = <1>;
- gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
- };
+ usb1 {
+ gpio-hog;
+ line-name = "tp-link:power:usb1";
+ gpios = <21 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
+ usb2 {
+ gpio-hog;
+ line-name = "tp-link:power:usb2";
+ gpios = <22 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -90,10 +91,6 @@
status = "okay";
};
-&gpio {
- status = "okay";
-};
-
&usb_phy0 {
status = "okay";
};
diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
index 3cc2d790d4..e1b6c6036c 100644
--- a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
@@ -76,21 +76,23 @@
debounce-interval = <60>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
+&gpio {
+ status = "okay";
- gpio_usb1_power {
- gpio-export,name = "tp-link:power:usb1";
- gpio-export,output = <1>;
- gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
+ usb1 {
+ gpio-hog;
+ line-name = "tp-link:power:usb1";
+ gpios = <21 GPIO_ACTIVE_HIGH>;
+ output-high;
+ };
- gpio_usb2_power {
- gpio-export,name = "tp-link:power:usb2";
- gpio-export,output = <1>;
- gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
- };
+ usb2 {
+ gpio-hog;
+ line-name = "tp-link:power:usb2";
+ gpios = <22 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
index 61d4aec624..6977869271 100644
--- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
+++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
@@ -63,16 +63,16 @@
debounce-interval = <60>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
- #size-cells = <0>;
+&gpio {
+ status = "okay";
- gpio_usb_power {
- gpio-export,name = "tp-link:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
+ usb {
+ gpio-hog;
+ line-name = "tp-link:power:usb";
+ gpios = <21 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -80,10 +80,6 @@
status = "okay";
};
-&gpio {
- status = "okay";
-};
-
&usb_phy0 {
status = "okay";
};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
index 6d32fa3fc4..378c87c9ee 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
@@ -54,22 +54,23 @@
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
-
- gpio_shift_register_oe {
- gpio-export,name = "tp-link:oe:sr";
- gpio-export,output = <0>;
- gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
- };
+&gpio {
+ status = "okay";
- gpio_shift_register_reset {
- gpio-export,name = "tp-link:reset:sr";
- gpio-export,output = <1>;
- gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
- };
+ sr {
+ gpio-hog;
+ line-name = "tp-link:oe:sr";
+ gpios = <16 GPIO_ACTIVE_HIGH>;
+ output-low;
+ };
+ sr {
+ gpio-hog;
+ line-name = "tp-link:reset:sr";
+ gpios = <19 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -77,10 +78,6 @@
status = "okay";
};
-&gpio {
- status = "okay";
-};
-
&pcie {
status = "okay";
};
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts
b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts
index 8bd9067afa..43f5b900ff 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts
@@ -62,16 +62,16 @@
debounce-interval = <60>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
- #size-cells = <0>;
+&gpio {
+ status = "okay";
- gpio_switch_reset {
- gpio-export,name = "dir-859-a1:reset:switch";
- gpio-export,output = <1>;
- gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
- };
+ switch {
+ gpio-hog;
+ line-name = "dir-859-a1:reset:switch";
+ gpios = <11 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -79,10 +79,6 @@
status = "okay";
};
-&gpio {
- status = "okay";
-};
-
&pcie {
status = "okay";
};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
index f4add2fe31..d892d0e960 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
@@ -41,22 +41,6 @@
};
};
- gpio-export {
- compatible = "gpio-export";
-
- gpio_shift_register_oe {
- gpio-export,name = "tp-link:oe:sr";
- gpio-export,output = <0>;
- gpios = <&gpio 1 GPIO_ACTIVE_LOW>; // 74HC595 /OE
(Output Enable)
- };
-
- gpio_shift_register_reset {
- gpio-export,name = "tp-link:reset:sr";
- gpio-export,output = <1>;
- gpios = <&gpio 21 GPIO_ACTIVE_LOW>; // 74HC595 /SRCLR
(Serial Clear)
- };
- };
-
leds {
compatible = "gpio-leds";
@@ -148,15 +132,29 @@
};
-&pcie {
+&gpio {
status = "okay";
+
+ sr {
+ gpio-hog;
+ line-name = "tp-link:oe:sr";
+ gpios = <1 GPIO_ACTIVE_LOW>;
+ output-low;
+ };
+
+ sr {
+ gpio-hog;
+ line-name = "tp-link:reset:sr";
+ gpios = <21 GPIO_ACTIVE_LOW>;
+ output-high;
+ };
};
-&uart {
+&pcie {
status = "okay";
};
-&gpio {
+&uart {
status = "okay";
};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi
b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi
index 324d831249..70313d7ce8 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi
@@ -92,15 +92,16 @@
debounce-interval = <60>;
};
};
+};
- gpio-export {
- compatible = "gpio-export";
+&gpio {
+ status = "okay";
- gpio_usb_power {
- gpio-export,name = "tp-link:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
- };
+ usb {
+ gpio-hog;
+ line-name = "tp-link:power:usb";
+ gpios = <19 GPIO_ACTIVE_HIGH>;
+ output-high;
};
};
@@ -112,10 +113,6 @@
status = "okay";
};
-&gpio {
- status = "okay";
-};
-
&usb_phy0 {
status = "okay";
};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts
b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts
index 07a7409886..bd7299362c 100644
--- a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts
@@ -6,16 +6,16 @@
/ {
compatible = "tplink,tl-wr1043nd-v4", "qca,qca9563";
model = "TP-Link TL-WR1043ND v4";
+};
- gpio-export {
- compatible = "gpio-export";
- #size-cells = <0>;
+&gpio {
+ status = "okay";
- gpio_usb_power {
- gpio-export,name = "tp-link:power:usb";
- gpio-export,output = <1>;
- gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
- };
+ usb {
+ gpio-hog;
+ line-name = "tp-link:power:usb";
+ gpios = <8 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