2 * TP-LINK TL-WA901N/ND v1 board support
4 * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2010 Pieter Hollants <pieter@hollants.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <asm/mach-ath79/ar71xx_regs.h>
13 #include <asm/mach-ath79/ath79.h>
16 #include "dev-ap9x-pci.h"
18 #include "dev-gpio-buttons.h"
19 #include "dev-leds-gpio.h"
20 #include "dev-m25p80.h"
21 #include "machtypes.h"
23 #define TL_WA901ND_GPIO_LED_QSS 0
24 #define TL_WA901ND_GPIO_LED_SYSTEM 1
25 #define TL_WA901ND_GPIO_LED_LAN 13
27 #define TL_WA901ND_GPIO_BTN_RESET 11
28 #define TL_WA901ND_GPIO_BTN_QSS 12
30 #define TL_WA901ND_KEYS_POLL_INTERVAL 20 /* msecs */
31 #define TL_WA901ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_KEYS_POLL_INTERVAL)
33 static const char *tl_wa901nd_part_probes[] = {
38 static struct flash_platform_data tl_wa901nd_flash_data = {
39 .part_probes = tl_wa901nd_part_probes,
42 static struct gpio_led tl_wa901nd_leds_gpio[] __initdata = {
44 .name = "tp-link:green:lan",
45 .gpio = TL_WA901ND_GPIO_LED_LAN,
48 .name = "tp-link:green:system",
49 .gpio = TL_WA901ND_GPIO_LED_SYSTEM,
52 .name = "tp-link:green:qss",
53 .gpio = TL_WA901ND_GPIO_LED_QSS,
58 static struct gpio_keys_button tl_wa901nd_gpio_keys[] __initdata = {
63 .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL,
64 .gpio = TL_WA901ND_GPIO_BTN_RESET,
70 .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL,
71 .gpio = TL_WA901ND_GPIO_BTN_QSS,
76 static void __init tl_wa901nd_setup(void)
78 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
79 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
81 ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
82 AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
83 AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
84 AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
85 AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
88 * ath79_eth0 would be the WAN port, but is not connected on
89 * the TL-WA901ND. ath79_eth1 connects to the internal switch chip,
90 * however we have a single LAN port only.
92 ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
93 ath79_register_mdio(0, 0x0);
94 ath79_register_eth(1);
96 ath79_register_m25p80(&tl_wa901nd_flash_data);
98 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_leds_gpio),
99 tl_wa901nd_leds_gpio);
101 ath79_register_gpio_keys_polled(-1, TL_WA901ND_KEYS_POLL_INTERVAL,
102 ARRAY_SIZE(tl_wa901nd_gpio_keys),
103 tl_wa901nd_gpio_keys);
105 ap91_pci_init(ee, mac);
108 MIPS_MACHINE(ATH79_MACH_TL_WA901ND, "TL-WA901ND", "TP-LINK TL-WA901ND",