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_BUTTONS_POLL_INTERVAL 20
35 #ifdef CONFIG_MTD_PARTITIONS
36 static struct mtd_partition tl_wa901nd_v2_partitions
[] = {
41 .mask_flags
= MTD_WRITEABLE
,
54 .mask_flags
= MTD_WRITEABLE
,
61 #endif /* CONFIG_MTD_PARTITIONS */
63 static struct flash_platform_data tl_wa901nd_v2_flash_data
= {
64 #ifdef CONFIG_MTD_PARTITIONS
65 .parts
= tl_wa901nd_v2_partitions
,
66 .nr_parts
= ARRAY_SIZE(tl_wa901nd_v2_partitions
),
70 static struct gpio_led tl_wa901nd_v2_leds_gpio
[] __initdata
= {
72 .name
= "tl-wa901nd-v2:green:system",
73 .gpio
= TL_WA901ND_V2_GPIO_LED_SYSTEM
,
76 .name
= "tl-wa901nd-v2:green:qss",
77 .gpio
= TL_WA901ND_V2_GPIO_LED_QSS
,
79 .name
= "tl-wa901nd-v2:green:wlan",
80 .gpio
= TL_WA901ND_V2_GPIO_LED_WLAN
,
85 static struct gpio_button tl_wa901nd_v2_gpio_buttons
[] __initdata
= {
91 .gpio
= TL_WA901ND_V2_GPIO_BTN_RESET
,
96 .code
= KEY_WPS_BUTTON
,
98 .gpio
= TL_WA901ND_V2_GPIO_BTN_QSS
,
103 static void __init
tl_wa901nd_v2_setup(void)
105 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
106 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff1000);
108 ar71xx_init_mac(ar71xx_eth0_data
.mac_addr
, mac
, 0);
110 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
111 ar71xx_eth0_data
.phy_mask
= 0x00001000;
112 ar71xx_add_device_mdio(0x0);
114 ar71xx_eth0_data
.reset_bit
= RESET_MODULE_GE0_MAC
|
115 RESET_MODULE_GE0_PHY
;
116 ar71xx_add_device_eth(0);
118 ar71xx_add_device_m25p80(&tl_wa901nd_v2_flash_data
);
120 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_v2_leds_gpio
),
121 tl_wa901nd_v2_leds_gpio
);
123 ar71xx_add_device_gpio_buttons(-1, TL_WA901ND_V2_BUTTONS_POLL_INTERVAL
,
124 ARRAY_SIZE(tl_wa901nd_v2_gpio_buttons
),
125 tl_wa901nd_v2_gpio_buttons
);
127 ar9xxx_add_device_wmac(eeprom
, mac
);
130 MIPS_MACHINE(AR71XX_MACH_TL_WA901ND_V2
, "TL-WA901ND-v2",
131 "TP-LINK TL-WA901ND v2", tl_wa901nd_v2_setup
);