2 * TP-LINK TL-WA701ND v2 board support
4 * Copyright (C) 2015 Luigi Tarenga <luigi.tarenga@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>
13 #include <asm/mach-ath79/ath79.h>
16 #include "dev-gpio-buttons.h"
17 #include "dev-leds-gpio.h"
18 #include "dev-m25p80.h"
21 #include "machtypes.h"
23 #define TL_WA701NDV2_GPIO_LED_WLAN 0
24 #define TL_WA701NDV2_GPIO_LED_QSS 1
25 #define TL_WA701NDV2_GPIO_LED_LAN 17
26 #define TL_WA701NDV2_GPIO_LED_SYSTEM 27
28 #define TL_WA701NDV2_GPIO_BTN_RESET 11
29 #define TL_WA701NDV2_GPIO_BTN_QSS 26
31 #define TL_WA701NDV2_GPIO_USB_POWER 8
33 #define TL_WA701NDV2_KEYS_POLL_INTERVAL 20 /* msecs */
34 #define TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA701NDV2_KEYS_POLL_INTERVAL)
36 static const char *tl_wa701ndv2_part_probes
[] = {
41 static struct flash_platform_data tl_wa701ndv2_flash_data
= {
42 .part_probes
= tl_wa701ndv2_part_probes
,
45 static struct gpio_led tl_wa701ndv2_leds_gpio
[] __initdata
= {
47 .name
= "tp-link:green:wlan",
48 .gpio
= TL_WA701NDV2_GPIO_LED_WLAN
,
51 .name
= "tp-link:green:qss",
52 .gpio
= TL_WA701NDV2_GPIO_LED_QSS
,
55 .name
= "tp-link:green:lan",
56 .gpio
= TL_WA701NDV2_GPIO_LED_LAN
,
59 .name
= "tp-link:green:system",
60 .gpio
= TL_WA701NDV2_GPIO_LED_SYSTEM
,
65 static struct gpio_keys_button tl_wa701ndv2_gpio_keys
[] __initdata
= {
70 .debounce_interval
= TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL
,
71 .gpio
= TL_WA701NDV2_GPIO_BTN_RESET
,
76 .code
= KEY_WPS_BUTTON
,
77 .debounce_interval
= TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL
,
78 .gpio
= TL_WA701NDV2_GPIO_BTN_QSS
,
84 static void __init
tl_wa701ndv2_setup(void)
86 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
87 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
89 /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
90 ath79_setup_ar933x_phy4_switch(false, false);
92 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa701ndv2_leds_gpio
),
93 tl_wa701ndv2_leds_gpio
);
95 ath79_register_gpio_keys_polled(-1, TL_WA701NDV2_KEYS_POLL_INTERVAL
,
96 ARRAY_SIZE(tl_wa701ndv2_gpio_keys
),
97 tl_wa701ndv2_gpio_keys
);
99 gpio_request_one(TL_WA701NDV2_GPIO_USB_POWER
,
100 GPIOF_OUT_INIT_HIGH
| GPIOF_EXPORT_DIR_FIXED
,
102 ath79_register_usb();
104 ath79_register_m25p80(&tl_wa701ndv2_flash_data
);
105 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
106 /* ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); */
108 ath79_register_mdio(0, 0x0);
109 ath79_register_eth(0);
110 ath79_register_eth(1);
112 ath79_register_wmac(ee
, mac
);
115 MIPS_MACHINE(ATH79_MACH_TL_WA701ND_V2
, "TL-WA701ND-v2",
116 "TP-LINK TL-WA701ND v2", tl_wa701ndv2_setup
);