[openwrt/openwrt] mpc85xx: utilize dt-binding definitions for keys + gpios

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 19 11:15:33 PST 2022


chunkeey pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/256e1dbc7d09b165bcfadb373cde963f5d7f7fca

commit 256e1dbc7d09b165bcfadb373cde963f5d7f7fca
Author: Christian Lamparter <chunkeey at gmail.com>
AuthorDate: Sun Feb 13 13:14:03 2022 +0100

    mpc85xx: utilize dt-binding definitions for keys + gpios
    
    include the device-tree binding headers that provide definitions
    for keys codes and gpios in the device-tree files.
    
    Random bonus: merge tl-wdr4900-v1's uboot with the nvmem-node.
    
    Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 .../files/arch/powerpc/boot/dts/hiveap-330.dts     |  6 ++--
 .../mpc85xx/files/arch/powerpc/boot/dts/panda.dts  | 17 ++++++----
 .../files/arch/powerpc/boot/dts/red-15w-rev1.dts   | 12 ++++---
 .../files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts  | 37 +++++++++++-----------
 .../files/arch/powerpc/boot/dts/ws-ap3710i.dts     | 17 ++++++----
 5 files changed, 50 insertions(+), 39 deletions(-)

diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts
index 166342759c..bb2f2d0827 100644
--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts
@@ -10,6 +10,8 @@
  */
 
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
 
 /include/ "fsl/p1020si-pre.dtsi"
 / {
@@ -283,8 +285,8 @@
 
 		reset {
 			label = "Reset button";
-			gpios = <&gpio0 8 1>; /* active low */
-			linux,code = <0x198>; /* KEY_RESTART */
+			gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
 		};
 	};
 };
diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/panda.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/panda.dts
index f0fafa1b57..baaa4a43fd 100644
--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/panda.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/panda.dts
@@ -1,5 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-or-later or MIT
 
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
 /include/ "fsl/p1020si-pre.dtsi"
 / {
 	model = "OCEDO Panda";
@@ -223,30 +226,30 @@
 		compatible = "gpio-leds";
 
 		power {
-			gpios = <&gpio0 0 0>;
+			gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
 			label = "panda:green:power";
 			default-state = "on";
 		};
 
 		wlan0 {
-			gpios = <&gpio0 3 0>;
+			gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
 			label = "panda:yellow:wlan0";
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan1 {
-			gpios = <&gpio0 2 0>;
+			gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
 			label = "panda:red:wlan1";
 			linux,default-trigger = "phy1tpt";
 		};
 
 		tbd_orange {
-			gpios = <&gpio0 1 0>;
+			gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
 			label = "panda:orange:tbd";
 		};
 
 		system_blue: system {
-			gpios = <&gpio0 4 0>;
+			gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
 			label = "panda:blue:system";
 		};
 	};
@@ -256,8 +259,8 @@
 
 		reset {
 			label = "Reset button";
-			gpios = <&gpio0 6 1>;
-			linux,code = <0x198>;
+			gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
 		};
 	};
 };
diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/red-15w-rev1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/red-15w-rev1.dts
index 40b8014a53..1fd6a4aa49 100644
--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/red-15w-rev1.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/red-15w-rev1.dts
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later or MIT
 
+#include <dt-bindings/gpio/gpio.h>
+
 /include/ "fsl/p1010si-pre.dtsi"
 
 / {
@@ -21,27 +23,27 @@
 		compatible = "gpio-leds";
 
 		system_green: system_green {
-			gpios = <&gpio0 7 0>;
+			gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
 			label = "red-15w-rev1:green:system";
 		};
 
 		system_red: system_red {
-			gpios = <&gpio0 3 0>;
+			gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
 			label = "red-15w-rev1:red:system";
 		};
 
 		router {
-			gpios = <&gpio0 5 1>;
+			gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
 			label = "red-15w-rev1:green:router";
 		};
 
 		internet {
-			gpios = <&gpio0 4 1>;
+			gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
 			label = "red-15w-rev1:green:internet";
 		};
 
 		tunnel {
-			gpios = <&gpio0 8 1>;
+			gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
 			label = "red-15w-rev1:green:tunnel";
 		};
 	};
diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
index 1976b4af96..e165e0b81f 100644
--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
@@ -9,6 +9,9 @@
  * option) any later version.
  */
 
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
 /include/ "fsl/p1010si-pre.dtsi"
 
 / {
@@ -53,6 +56,14 @@
 						reg = <0x0 0x0050000>;
 						label = "u-boot";
 						read-only;
+
+						compatible = "nvmem-cells";
+						#address-cells = <1>;
+						#size-cells = <1>;
+
+						macaddr_uboot_4fc00: macaddr at 4fc00 {
+							reg = <0x4fc00 0x6>;
+						};
 					};
 
 					partition at 50000 {
@@ -199,22 +210,22 @@
 		compatible = "gpio-leds";
 
 		system_green: system {
-			gpios = <&gpio0 2 1>; /* active low */
+			gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
 			label = "tp-link:blue:system";
 		};
 
 		usb1 {
-			gpios = <&gpio0 3 1>; /* active low */
+			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
 			label = "tp-link:green:usb1";
 		};
 
 		usb2 {
-			gpios = <&gpio0 4 1>; /* active low */
+			gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
 			label = "tp-link:green:usb2";
 		};
 
 		usbpower {
-			gpios = <&gpio0 10 1>; /* active low */
+			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
 			label = "tp-link:usb:power";
 		};
 	};
@@ -224,14 +235,14 @@
 
 		reset {
 			label = "Reset button";
-			gpios = <&gpio0 5 1>; /* active low */
-			linux,code = <0x198>; /* KEY_RESTART */
+			gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
 		};
 
 		rfkill {
 			label = "RFKILL switch";
-			gpios = <&gpio0 11 1>; /* active low */
-			linux,code = <0xf7>; /* RFKill */
+			gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RFKill>;
 		};
 	};
 };
@@ -291,13 +302,3 @@
 		/delete-node/ crypto at 30000; /* Pulled in by p1010si-post */
 	};
 };
-
-&uboot {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_uboot_4fc00: macaddr at 4fc00 {
-		reg = <0x4fc00 0x6>;
-	};
-};
diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts
index ebaac417eb..c5588d8027 100644
--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts
@@ -1,5 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-or-later or MIT
 
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
 /include/ "fsl/p1020si-pre.dtsi"
 / {
 	model = "Enterasys WS-AP3710i";
@@ -21,24 +24,24 @@
 		compatible = "gpio-leds";
 
 		wifi1 {
-			gpios = <&gpio0 3 0>;
+			gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
 			label = "ws-ap3710i:green:radio1";
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wifi2 {
-			gpios = <&gpio0 4 0>;
+			gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
 			label = "ws-ap3710i:green:radio2";
 			linux,default-trigger = "phy1tpt";
 		};
 
 		led_power_green: power_green {
-			gpios = <&gpio0 8 0>;
+			gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
 			label = "ws-ap3710i:green:power";
 		};
 
 		led_power_red: power_red {
-			gpios = <&gpio0 9 0>;
+			gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
 			label = "ws-ap3710i:red:power";
 		};
 	};
@@ -48,8 +51,8 @@
 
 		reset {
 			label = "Reset button";
-			gpios = <&gpio0 1 1>; /* active low */
-			linux,code = <0x198>; /* KEY_RESTART */
+			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
 		};
 	};
 
@@ -112,7 +115,7 @@
 		mdio at 24000 {
 			phy4: ethernet-phy at 4 {
 				reg = <0x4>;
-				reset-gpios = <&gpio0 2 1>;
+				reset-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
 			};
 		};
 



More information about the lede-commits mailing list