Sfoglia il codice sorgente

econet: en7528: add GPIO and LED support for DASAN H660GM-A

Enable the Airoha EN7523 GPIO driver for EN7528 and add GPIO
controller nodes to the EN7528 DTSI. Add LED, button and GPIO
definitions for the DASAN H660GM-A board.

Signed-off-by: Ahmed Naseef <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <[email protected]>
Ahmed Naseef 1 settimana fa
parent
commit
a14d81d465

+ 20 - 0
target/linux/econet/dts/en7528.dtsi

@@ -57,6 +57,26 @@
 		interrupts = <2>;
 	};
 
+	gpio0: gpio@1fbf0200 {
+		compatible = "airoha,en7523-gpio";
+		reg = <0x1fbf0204 0x4>,
+		      <0x1fbf0200 0x4>,
+		      <0x1fbf0220 0x4>,
+		      <0x1fbf0214 0x4>;
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+
+	gpio1: gpio@1fbf0270 {
+		compatible = "airoha,en7523-gpio";
+		reg = <0x1fbf0270 0x4>,
+		      <0x1fbf0260 0x4>,
+		      <0x1fbf0264 0x4>,
+		      <0x1fbf0278 0x4>;
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+
 	scu: system-controller@1fb00000 {
 		compatible = "airoha,en7523-scu";
 		reg = <0x1fa20000 0x400>,

+ 125 - 0
target/linux/econet/dts/en7528_dasan_h660gm-a.dts

@@ -3,10 +3,21 @@
 
 #include "en7528.dtsi"
 
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
 / {
 	model = "DASAN H660GM-A";
 	compatible = "dasan,h660gm-a", "econet,en7528";
 
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
 	memory@0 {
 		device_type = "memory";
 		reg = <0x00000000 0x10000000>;
@@ -16,6 +27,120 @@
 		stdout-path = "/serial@1fbf0000:115200";
 		linux,usable-memory-range = <0x00020000 0x0ffe0000>;
 	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_power: pwr {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_POWER;
+			gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
+		};
+
+		led_pon_green: pon-green {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_STATUS;
+			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
+		};
+
+		led_pon_red: pon-red {
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_STATUS;
+			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
+		};
+
+		led_auth: auth {
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_INDICATOR;
+			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+		};
+
+		led_internet: internet {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_WAN;
+			gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
+		};
+
+		led_tel: tel {
+			label = "green:tel";
+			gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
+		};
+
+		led_wps: wps {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_WPS;
+			gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
+		};
+
+		led_lan1: lan1 {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_LAN;
+			function-enumerator = <1>;
+			gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
+		};
+
+		led_lan2: lan2 {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_LAN;
+			function-enumerator = <2>;
+			gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
+		};
+
+		led_lan3: lan3 {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_LAN;
+			function-enumerator = <3>;
+			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
+		};
+
+		led_lan4: lan4 {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_LAN;
+			function-enumerator = <4>;
+			gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
+		};
+
+		led_wlan24: wlan2g {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_WLAN_2GHZ;
+			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy0tpt";
+		};
+
+		led_wlan5: wlan5g {
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_WLAN_5GHZ;
+			gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy1tpt";
+		};
+	};
+
+	gpio_export {
+		compatible = "gpio-export";
+
+		usb-power {
+			gpio-export,name = "usb-power";
+			gpio-export,output = <1>;
+			gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys-polled";
+		poll-interval = <100>;
+
+		key-reset {
+			label = "reset";
+			gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		key-wps {
+			label = "wps";
+			gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+	};
 };
 
 &gmac0 {

+ 2 - 1
target/linux/econet/en751221/config-6.12

@@ -75,6 +75,7 @@ CONFIG_GENERIC_SCHED_CLOCK=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GPIO_CDEV=y
+# CONFIG_GPIO_EN7523 is not set
 CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
@@ -146,7 +147,6 @@ CONFIG_RATIONAL=y
 CONFIG_RESET_CONTROLLER=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RPS=y
-CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES=y
 # CONFIG_SERIAL_8250_AIROHA is not set
 CONFIG_SERIAL_MCTRL_GPIO=y
 CONFIG_SERIAL_OF_PLATFORM=y
@@ -168,6 +168,7 @@ CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_MIPS16=y
 CONFIG_SYS_SUPPORTS_SMP=y
 CONFIG_SYS_SUPPORTS_ZBOOT=y

+ 4 - 0
target/linux/econet/en7528/config-6.12

@@ -77,7 +77,10 @@ CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SCHED_CLOCK=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GPIOLIB_IRQCHIP=y
 CONFIG_GPIO_CDEV=y
+CONFIG_GPIO_EN7523=y
+CONFIG_GPIO_GENERIC=y
 CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
@@ -92,6 +95,7 @@ CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_MIPS_CPU=y
 CONFIG_IRQ_WORK=y
 # CONFIG_JFFS2_FS is not set
+CONFIG_LEDS_GPIO=y
 CONFIG_LIBFDT=y
 CONFIG_LOCK_DEBUGGING_SUPPORT=y
 CONFIG_LZO_COMPRESS=y

+ 2 - 0
target/linux/econet/en7528/target.mk

@@ -6,6 +6,8 @@ BOARDNAME:=EN7528 based boards
 CPU_TYPE:=24kc
 KERNELNAME:=vmlinuz.bin
 
+DEFAULT_PACKAGES += kmod-leds-gpio kmod-gpio-button-hotplug
+
 define Target/Description
 	Build firmware images for EcoNet EN7528 based boards.
 endef

+ 17 - 0
target/linux/econet/patches-6.12/320-gpio-en7523-enable-for-econet-mips.patch

@@ -0,0 +1,17 @@
+gpio: en7523: enable for EcoNet MIPS platform
+
+The Airoha EN7523 GPIO controller is also found on EcoNet EN7528
+MIPS SoC. Allow building the driver when ECONET is selected.
+
+Signed-off-by: Ahmed Naseef <[email protected]>
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -271,7 +271,7 @@ config GPIO_EM
+ 
+ config GPIO_EN7523
+ 	tristate "Airoha GPIO support"
+-	depends on ARCH_AIROHA
++	depends on ARCH_AIROHA || ECONET
+ 	default ARCH_AIROHA
+ 	select GPIO_GENERIC
+ 	select GPIOLIB_IRQCHIP