[source] ar71xx: add support for TL-WR1041N(v2) LAN/WAN LEDs.

LEDE Commits lede-commits at lists.infradead.org
Mon Sep 4 23:16:24 PDT 2017


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/69323a0c070523fb7193486c4f89546668a72de8

commit 69323a0c070523fb7193486c4f89546668a72de8
Author: Kuang Rufan <master at a1983.com.cn>
AuthorDate: Fri Aug 25 20:45:19 2017 +0800

    ar71xx: add support for TL-WR1041N(v2) LAN/WAN LEDs.
    
    1. Add support to LAN/WAN LEDs attached to ar8327.
    2. Fix the problem that LAN/WAN LEDs does not blink in hardware (auto)
       mode when connected to 10M/100M ethernet.
    
    Signed-off-by: Kuang Rufan <master at a1983.com.cn>
---
 .../files/arch/mips/ath79/mach-tl-wr1041n-v2.c      | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1041n-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1041n-v2.c
index fa8c474..f79f155 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1041n-v2.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1041n-v2.c
@@ -74,6 +74,22 @@ static struct gpio_keys_button tl_wr1041nv2_gpio_keys[] __initdata = {
 	}
 };
 
+static const struct ar8327_led_info tl_wr1041n_leds_ar8327[] = {
+	AR8327_LED_INFO(PHY0_0, HW, "tp-link:green:wan"),
+	AR8327_LED_INFO(PHY1_0, HW, "tp-link:green:lan1"),
+	AR8327_LED_INFO(PHY2_0, HW, "tp-link:green:lan2"),
+	AR8327_LED_INFO(PHY3_0, HW, "tp-link:green:lan3"),
+	AR8327_LED_INFO(PHY4_0, HW, "tp-link:green:lan4"),
+};
+
+static struct ar8327_led_cfg wr1041n_v2_ar8327_led_cfg = {
+	.led_ctrl0 = 0xcf35cf35,	/* LED0: blink at 10/100/1000M */
+	.led_ctrl1 = 0xcf35cf35,	/* LED1: blink at 10/100/1000M: anyway, no LED1 on tl-wr1041n */
+	.led_ctrl2 = 0xcf35cf35,	/* LED2: blink at 10/100/1000M: anyway, no LED2 on tl-wr1041n */
+	.led_ctrl3 = 0x03ffff00,	/* Pattern enabled for LED 0-2 of port 1-3 */
+	.open_drain = true,
+};
+
 static struct ar8327_pad_cfg db120_ar8327_pad0_cfg = {
 	.mode = AR8327_PAD_MAC_RGMII,
 	.txclk_delay_en = true,
@@ -90,7 +106,10 @@ static struct ar8327_platform_data db120_ar8327_data = {
 		.duplex = 1,
 		.txpause = 1,
 		.rxpause = 1,
-	}
+	},
+	.led_cfg = &wr1041n_v2_ar8327_led_cfg,
+	.num_leds = ARRAY_SIZE(tl_wr1041n_leds_ar8327),
+	.leds = tl_wr1041n_leds_ar8327
 };
 
 static struct mdio_board_info db120_mdio0_info[] = {



More information about the lede-commits mailing list