2 * TP-LINK TL-WA901ND v2 board support
4 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2010 Pieter Hollants <pieter@hollants.com>
6 * Copyright (C) 2011 Jonathan Bennett <jbscience87@gmail.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
16 #include <asm/mach-ar71xx/ar71xx.h>
20 #include "dev-m25p80.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23 #include "dev-ar9xxx-wmac.h"
25 #define TL_WA901ND_V2_GPIO_LED_QSS 4
26 #define TL_WA901ND_V2_GPIO_LED_SYSTEM 2
27 #define TL_WA901ND_V2_GPIO_LED_WLAN 9
30 #define TL_WA901ND_V2_GPIO_BTN_RESET 3
31 #define TL_WA901ND_V2_GPIO_BTN_QSS 7
33 #define TL_WA901ND_V2_KEYS_POLL_INTERVAL 20 /* msecs */
34 #define TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL \
35 (3 * TL_WA901ND_V2_KEYS_POLL_INTERVAL)
36 #ifdef CONFIG_MTD_PARTITIONS
37 static struct mtd_partition tl_wa901nd_v2_partitions[] = {
42 .mask_flags = MTD_WRITEABLE,
55 .mask_flags = MTD_WRITEABLE,
62 #endif /* CONFIG_MTD_PARTITIONS */
64 static struct flash_platform_data tl_wa901nd_v2_flash_data = {
65 #ifdef CONFIG_MTD_PARTITIONS
66 .parts = tl_wa901nd_v2_partitions,
67 .nr_parts = ARRAY_SIZE(tl_wa901nd_v2_partitions),
71 static struct gpio_led tl_wa901nd_v2_leds_gpio[] __initdata = {
73 .name = "tl-wa901nd-v2:green:system",
74 .gpio = TL_WA901ND_V2_GPIO_LED_SYSTEM,
77 .name = "tl-wa901nd-v2:green:qss",
78 .gpio = TL_WA901ND_V2_GPIO_LED_QSS,
80 .name = "tl-wa901nd-v2:green:wlan",
81 .gpio = TL_WA901ND_V2_GPIO_LED_WLAN,
86 static struct gpio_keys_button tl_wa901nd_v2_gpio_keys[] __initdata = {
91 .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL,
92 .gpio = TL_WA901ND_V2_GPIO_BTN_RESET,
97 .code = KEY_WPS_BUTTON,
98 .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL,
99 .gpio = TL_WA901ND_V2_GPIO_BTN_QSS,
104 static void __init tl_wa901nd_v2_setup(void)
106 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
107 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
109 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
111 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
112 ar71xx_eth0_data.phy_mask = 0x00001000;
113 ar71xx_add_device_mdio(0x0);
115 ar71xx_eth0_data.reset_bit = RESET_MODULE_GE0_MAC |
116 RESET_MODULE_GE0_PHY;
117 ar71xx_add_device_eth(0);
119 ar71xx_add_device_m25p80(&tl_wa901nd_v2_flash_data);
121 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_v2_leds_gpio),
122 tl_wa901nd_v2_leds_gpio);
124 ar71xx_register_gpio_keys_polled(-1, TL_WA901ND_V2_KEYS_POLL_INTERVAL,
125 ARRAY_SIZE(tl_wa901nd_v2_gpio_keys),
126 tl_wa901nd_v2_gpio_keys);
128 ar9xxx_add_device_wmac(eeprom, mac);
131 MIPS_MACHINE(AR71XX_MACH_TL_WA901ND_V2, "TL-WA901ND-v2",
132 "TP-LINK TL-WA901ND v2", tl_wa901nd_v2_setup);