2 * TP-LINK TL-WA750RE V1 / TP-LINK TL-WA850RE V1 board support
4 * Copyright (C) 2013 Martijn Zilverschoon <thefriedzombie@gmail.com>
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"
25 #define TL_WAX50RE_GPIO_LED_LAN 20
26 #define TL_WAX50RE_GPIO_LED_WLAN 13
27 #define TL_WAX50RE_GPIO_LED_RE 15
28 #define TL_WAX50RE_GPIO_LED_SIGNAL1 0
29 #define TL_WAX50RE_GPIO_LED_SIGNAL2 1
30 #define TL_WAX50RE_GPIO_LED_SIGNAL3 2
31 #define TL_WAX50RE_GPIO_LED_SIGNAL4 3
32 #define TL_WAX50RE_GPIO_LED_SIGNAL5 4
34 #define TL_WAX50RE_GPIO_BTN_RESET 17
35 #define TL_WAX50RE_GPIO_BTN_WPS 16
37 #define TL_WAX50RE_KEYS_POLL_INTERVAL 20 /* msecs */
38 #define TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL (3 * TL_WAX50RE_KEYS_POLL_INTERVAL)
40 static const char *tl_wax50re_part_probes
[] = {
45 static struct flash_platform_data tl_wax50re_flash_data
= {
46 .part_probes
= tl_wax50re_part_probes
,
49 static struct gpio_led tl_wa750re_leds_gpio
[] __initdata
= {
51 .name
= "tp-link:orange:lan",
52 .gpio
= TL_WAX50RE_GPIO_LED_LAN
,
55 .name
= "tp-link:orange:wlan",
56 .gpio
= TL_WAX50RE_GPIO_LED_WLAN
,
59 .name
= "tp-link:orange:re",
60 .gpio
= TL_WAX50RE_GPIO_LED_RE
,
63 .name
= "tp-link:orange:signal1",
64 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL1
,
67 .name
= "tp-link:orange:signal2",
68 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL2
,
71 .name
= "tp-link:orange:signal3",
72 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL3
,
75 .name
= "tp-link:orange:signal4",
76 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL4
,
79 .name
= "tp-link:orange:signal5",
80 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL5
,
85 static struct gpio_led tl_wa850re_leds_gpio
[] __initdata
= {
87 .name
= "tp-link:blue:lan",
88 .gpio
= TL_WAX50RE_GPIO_LED_LAN
,
91 .name
= "tp-link:blue:wlan",
92 .gpio
= TL_WAX50RE_GPIO_LED_WLAN
,
95 .name
= "tp-link:blue:re",
96 .gpio
= TL_WAX50RE_GPIO_LED_RE
,
99 .name
= "tp-link:blue:signal1",
100 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL1
,
103 .name
= "tp-link:blue:signal2",
104 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL2
,
107 .name
= "tp-link:blue:signal3",
108 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL3
,
111 .name
= "tp-link:blue:signal4",
112 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL4
,
115 .name
= "tp-link:blue:signal5",
116 .gpio
= TL_WAX50RE_GPIO_LED_SIGNAL5
,
122 static struct gpio_keys_button tl_wax50re_gpio_keys
[] __initdata
= {
124 .desc
= "Reset button",
127 .debounce_interval
= TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL
,
128 .gpio
= TL_WAX50RE_GPIO_BTN_RESET
,
133 .code
= KEY_WPS_BUTTON
,
134 .debounce_interval
= TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL
,
135 .gpio
= TL_WAX50RE_GPIO_BTN_WPS
,
140 static void __init
tl_ap123_setup(void)
142 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
143 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
145 ath79_register_m25p80(&tl_wax50re_flash_data
);
147 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP
);
149 ath79_register_mdio(1, 0x0);
151 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
153 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
154 ath79_eth0_data
.phy_mask
= BIT(0);
155 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
156 ath79_register_eth(0);
158 ath79_register_wmac(ee
, mac
);
161 static void __init
tl_wa750re_setup(void)
164 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa750re_leds_gpio
),
165 tl_wa750re_leds_gpio
);
167 ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL
,
168 ARRAY_SIZE(tl_wax50re_gpio_keys
),
169 tl_wax50re_gpio_keys
);
172 MIPS_MACHINE(ATH79_MACH_TL_WA750RE
, "TL-WA750RE", "TP-LINK TL-WA750RE",
175 static void __init
tl_wa850re_setup(void)
178 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa850re_leds_gpio
),
179 tl_wa850re_leds_gpio
);
181 ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL
,
182 ARRAY_SIZE(tl_wax50re_gpio_keys
),
183 tl_wax50re_gpio_keys
);
186 MIPS_MACHINE(ATH79_MACH_TL_WA850RE
, "TL-WA850RE", "TP-LINK TL-WA850RE",