2 * TP-LINK TL-WA7210N v2.1 board support
4 * Copyright (C) 2011 dongyuqi <729650915@qq.com>
5 * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2014 Nicolas Braud-Santoni <nicolas@braud-santoni.eu>
7 * Copyright (C) 2014 Alexander List <alex@graz.funkfeuer.at>
8 * Copyright (C) 2015 Hendrik Frenzel <hfrenzel@scunc.net>
10 * rebased on TL-WA7510Nv1 support,
11 * Copyright (C) 2012 Stefan Helmert <helst_listen@aol.de>
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License version 2 as published
15 * by the Free Software Foundation.
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/partitions.h>
20 #include <linux/platform_device.h>
21 #include <linux/gpio.h>
23 #include <asm/mach-ath79/ar71xx_regs.h>
24 #include <asm/mach-ath79/ath79.h>
28 #include "dev-gpio-buttons.h"
29 #include "dev-leds-gpio.h"
30 #include "dev-m25p80.h"
32 #include "machtypes.h"
37 #define TL_WA7210N_V2_GPIO_BTN_RESET 11
38 #define TL_WA7210N_V2_KEYS_POLL_INT 20
39 #define TL_WA7210N_V2_KEYS_DEBOUNCE_INT (3 * TL_WA7210N_V2_KEYS_POLL_INT)
41 #define TL_WA7210N_V2_GPIO_LED_LAN 17
42 #define TL_WA7210N_V2_GPIO_LED_SIG1 0
43 #define TL_WA7210N_V2_GPIO_LED_SIG2 1
44 #define TL_WA7210N_V2_GPIO_LED_SIG3 27
45 #define TL_WA7210N_V2_GPIO_LED_SIG4 26
47 #define TL_WA7210N_V2_GPIO_LNA_EN 28
49 static const char *tl_wa7210n_v2_part_probes
[] = {
54 static struct gpio_keys_button tl_wa7210n_v2_gpio_keys
[] __initdata
= {
59 .debounce_interval
= TL_WA7210N_V2_KEYS_DEBOUNCE_INT
,
60 .gpio
= TL_WA7210N_V2_GPIO_BTN_RESET
,
65 static struct gpio_led tl_wa7210n_v2_leds_gpio
[] __initdata
= {
67 .name
= "tp-link:green:lan",
68 .gpio
= TL_WA7210N_V2_GPIO_LED_LAN
,
71 .name
= "tp-link:green:signal1",
72 .gpio
= TL_WA7210N_V2_GPIO_LED_SIG1
,
75 .name
= "tp-link:green:signal2",
76 .gpio
= TL_WA7210N_V2_GPIO_LED_SIG2
,
79 .name
= "tp-link:green:signal3",
80 .gpio
= TL_WA7210N_V2_GPIO_LED_SIG3
,
83 .name
= "tp-link:green:signal4",
84 .gpio
= TL_WA7210N_V2_GPIO_LED_SIG4
,
89 static struct flash_platform_data tl_wa7210n_v2_flash_data
= {
90 .part_probes
= tl_wa7210n_v2_part_probes
,
93 static void __init
tl_wa7210n_v2_setup(void)
95 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
96 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
98 ath79_register_gpio_keys_polled(-1, TL_WA7210N_V2_KEYS_POLL_INT
,
99 ARRAY_SIZE(tl_wa7210n_v2_gpio_keys
),
100 tl_wa7210n_v2_gpio_keys
);
102 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa7210n_v2_leds_gpio
),
103 tl_wa7210n_v2_leds_gpio
);
105 ath79_gpio_function_enable(TL_WA7210N_V2_GPIO_LNA_EN
);
107 ath79_setup_ar933x_phy4_switch(false, false);
109 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, -1);
110 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 1);
112 ath79_register_eth(0);
113 ath79_register_eth(1);
115 ath79_register_mdio(0, 0x0);
117 ath79_register_wmac(ee
, mac
);
119 ath79_register_m25p80(&tl_wa7210n_v2_flash_data
);
121 ath79_register_pci();
124 MIPS_MACHINE(ATH79_MACH_TL_WA7210N_V2
, "TL-WA7210N-v2", "TP-LINK TL-WA7210N v2",
125 tl_wa7210n_v2_setup
);