This patch was written by the example of similar platforms TP-LINK
Applying this patch, will unload the module leds_gpio, in order to use
additional GPIOs (13-17) for other purposes.

Ticket:
https://dev.openwrt.org/ticket/12732
The formatted html version of diff:
https://dev.openwrt.org/attachment/ticket/12732/enable-lan0-lan4-led.patch

---
Index: target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr3x20.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr3x20.c	(revision 34914)
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr3x20.c	(working copy)
@@ -11,7 +11,9 @@
 #include <linux/gpio.h>
 
 #include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
 
+#include "common.h"
 #include "dev-eth.h"
 #include "dev-ap9x-pci.h"
 #include "dev-gpio-buttons.h"
@@ -23,6 +25,11 @@
 #define TL_MR3X20_GPIO_LED_QSS		0
 #define TL_MR3X20_GPIO_LED_SYSTEM	1
 #define TL_MR3X20_GPIO_LED_3G		8
+#define TL_MR3X20_GPIO_LED_LAN1		13
+#define TL_MR3X20_GPIO_LED_LAN2		14
+#define TL_MR3X20_GPIO_LED_LAN3		15
+#define TL_MR3X20_GPIO_LED_LAN4		16
+#define TL_MR3X20_GPIO_LED_WAN		17
 
 #define TL_MR3X20_GPIO_BTN_RESET	11
 #define TL_MR3X20_GPIO_BTN_QSS		12
@@ -51,6 +58,26 @@
 		.gpio		= TL_MR3X20_GPIO_LED_QSS,
 		.active_low	= 1,
 	}, {
+		.name		= "tp-link:green:lan1",
+		.gpio		= TL_MR3X20_GPIO_LED_LAN1,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:lan2",
+		.gpio		= TL_MR3X20_GPIO_LED_LAN2,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:lan3",
+		.gpio		= TL_MR3X20_GPIO_LED_LAN3,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:lan4",
+		.gpio		= TL_MR3X20_GPIO_LED_LAN4,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:wan",
+		.gpio		= TL_MR3X20_GPIO_LED_WAN,
+		.active_low	= 1,
+	}, {
 		.name		= "tp-link:green:3g",
 		.gpio		= TL_MR3X20_GPIO_LED_3G,
 		.active_low	= 1,
@@ -97,6 +124,12 @@
 	ath79_register_eth(0);
 
 	ap91_pci_init(ee, mac);
+
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
 }
 
 static void __init tl_mr3x20_usb_setup(void)
Index: target/linux/ar71xx/base-files/etc/uci-defaults/leds
===================================================================
--- target/linux/ar71xx/base-files/etc/uci-defaults/leds	(revision 34914)
+++ target/linux/ar71xx/base-files/etc/uci-defaults/leds	(working copy)
@@ -115,6 +115,11 @@
 
 tl-mr3220 | \
 tl-mr3420 )
+	ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
+	ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02"
+	ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x04"
+	ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x08"
+	ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10"
 	ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
 	;;
 
@@ -142,6 +147,7 @@
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:blue:wlan2g" "phy0tpt"
 	;;
 
+tl-wr841n-v7 | \
 tl-wr741nd)
 	ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
 	ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02"
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to