2 * TP-LINK TL-WR941ND board support
4 * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org>
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/platform_device.h>
13 #include <asm/mach-ath79/ath79.h>
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-m25p80.h"
21 #include "machtypes.h"
23 #define TL_WR941ND_GPIO_LED_SYSTEM 2
24 #define TL_WR941ND_GPIO_LED_QSS_RED 4
25 #define TL_WR941ND_GPIO_LED_QSS_GREEN 5
26 #define TL_WR941ND_GPIO_LED_WLAN 9
28 #define TL_WR941ND_GPIO_BTN_RESET 3
29 #define TL_WR941ND_GPIO_BTN_QSS 7
31 #define TL_WR941ND_KEYS_POLL_INTERVAL 20 /* msecs */
32 #define TL_WR941ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR941ND_KEYS_POLL_INTERVAL)
34 static const char *tl_wr941nd_part_probes[] = {
39 static struct flash_platform_data tl_wr941nd_flash_data = {
40 .part_probes = tl_wr941nd_part_probes,
43 static struct gpio_led tl_wr941nd_leds_gpio[] __initdata = {
45 .name = "tp-link:green:system",
46 .gpio = TL_WR941ND_GPIO_LED_SYSTEM,
49 .name = "tp-link:red:qss",
50 .gpio = TL_WR941ND_GPIO_LED_QSS_RED,
52 .name = "tp-link:green:qss",
53 .gpio = TL_WR941ND_GPIO_LED_QSS_GREEN,
55 .name = "tp-link:green:wlan",
56 .gpio = TL_WR941ND_GPIO_LED_WLAN,
61 static struct gpio_keys_button tl_wr941nd_gpio_keys[] __initdata = {
66 .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL,
67 .gpio = TL_WR941ND_GPIO_BTN_RESET,
72 .code = KEY_WPS_BUTTON,
73 .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL,
74 .gpio = TL_WR941ND_GPIO_BTN_QSS,
79 static struct dsa_chip_data tl_wr941nd_dsa_chip = {
80 .port_names[0] = "wan",
81 .port_names[1] = "lan1",
82 .port_names[2] = "lan2",
83 .port_names[3] = "lan3",
84 .port_names[4] = "lan4",
85 .port_names[5] = "cpu",
88 static struct dsa_platform_data tl_wr941nd_dsa_data = {
90 .chip = &tl_wr941nd_dsa_chip,
93 static void __init tl_wr941nd_setup(void)
95 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
96 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
98 ath79_register_mdio(0, 0x0);
100 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
101 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
102 ath79_eth0_data.speed = SPEED_100;
103 ath79_eth0_data.duplex = DUPLEX_FULL;
105 ath79_register_eth(0);
106 ath79_register_dsa(&ath79_eth0_device.dev, &ath79_mdio0_device.dev,
107 &tl_wr941nd_dsa_data);
109 ath79_register_m25p80(&tl_wr941nd_flash_data);
111 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_leds_gpio),
112 tl_wr941nd_leds_gpio);
114 ath79_register_gpio_keys_polled(-1, TL_WR941ND_KEYS_POLL_INTERVAL,
115 ARRAY_SIZE(tl_wr941nd_gpio_keys),
116 tl_wr941nd_gpio_keys);
117 ath79_register_wmac(eeprom, mac);
120 MIPS_MACHINE(ATH79_MACH_TL_WR941ND, "TL-WR941ND", "TP-LINK TL-WR941ND",