2 * TP-LINK TL-WR941N/ND v6 board support
4 * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/gpio.h>
12 #include <linux/platform_device.h>
14 #include <asm/mach-ath79/ath79.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
23 #include "machtypes.h"
26 #define TL_WR941ND_V6_GPIO_LED_QSS 3
27 #define TL_WR941ND_V6_GPIO_LED_WAN 14
28 #define TL_WR941ND_V6_GPIO_LED_WAN_RED 15
29 #define TL_WR941ND_V6_GPIO_LED_LAN1 7
30 #define TL_WR941ND_V6_GPIO_LED_LAN2 6
31 #define TL_WR941ND_V6_GPIO_LED_LAN3 5
32 #define TL_WR941ND_V6_GPIO_LED_LAN4 4
33 #define TL_WR941ND_V6_GPIO_LED_WLAN 8
34 #define TL_WR941ND_V6_GPIO_LED_SYSTEM 18
36 #define TL_WR941ND_V6_GPIO_BTN_RESET 1
37 #define TL_WR941ND_V6_GPIO_BTN_RFKILL 2
39 #define TL_WR941ND_V6_KEYS_POLL_INTERVAL 20
40 #define TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR941ND_V6_KEYS_POLL_INTERVAL)
43 static struct gpio_led tl_wr941nd_v6_leds_gpio[] __initdata = {
45 .name = "tp-link:blue:qss",
46 .gpio = TL_WR941ND_V6_GPIO_LED_QSS,
50 .name = "tp-link:blue:wan",
51 .gpio = TL_WR941ND_V6_GPIO_LED_WAN,
55 .name = "tp-link:red:wan",
56 .gpio = TL_WR941ND_V6_GPIO_LED_WAN_RED,
60 .name = "tp-link:blue:lan1",
61 .gpio = TL_WR941ND_V6_GPIO_LED_LAN1,
65 .name = "tp-link:blue:lan2",
66 .gpio = TL_WR941ND_V6_GPIO_LED_LAN2,
70 .name = "tp-link:blue:lan3",
71 .gpio = TL_WR941ND_V6_GPIO_LED_LAN3,
75 .name = "tp-link:blue:lan4",
76 .gpio = TL_WR941ND_V6_GPIO_LED_LAN4,
80 .name = "tp-link:blue:wlan",
81 .gpio = TL_WR941ND_V6_GPIO_LED_WLAN,
85 .name = "tp-link:blue:system",
86 .gpio = TL_WR941ND_V6_GPIO_LED_SYSTEM,
91 static struct gpio_keys_button tl_wr941nd_v6_gpio_keys[] __initdata = {
93 .desc = "Reset button",
96 .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL,
97 .gpio = TL_WR941ND_V6_GPIO_BTN_RESET,
100 .desc = "RFKILL button",
103 .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL,
104 .gpio = TL_WR941ND_V6_GPIO_BTN_RFKILL,
110 static const char *tl_wr941n_v6_part_probes[] = {
115 static struct flash_platform_data tl_wr941n_v6_flash_data = {
116 .part_probes = tl_wr941n_v6_part_probes,
120 static void __init tl_wr941nd_v6_setup(void)
122 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
123 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
125 ath79_register_m25p80(&tl_wr941n_v6_flash_data);
127 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_v6_leds_gpio),
128 tl_wr941nd_v6_leds_gpio);
130 ath79_register_gpio_keys_polled(-1, TL_WR941ND_V6_KEYS_POLL_INTERVAL,
131 ARRAY_SIZE(tl_wr941nd_v6_gpio_keys),
132 tl_wr941nd_v6_gpio_keys);
134 ath79_register_mdio(0, 0x0);
136 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
137 ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
139 ath79_switch_data.phy4_mii_en = 1;
141 ath79_register_eth(0);
142 ath79_register_eth(1);
144 ath79_register_wmac(ee, mac);
148 MIPS_MACHINE(ATH79_MACH_TL_WR941ND_V6, "TL-WR941ND-v6", "TP-LINK TL-WR941N/ND v6",
149 tl_wr941nd_v6_setup);