2 * TP-LINK TL-WR741ND v4 board support
4 * Copyright (C) 2011 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/gpio.h>
13 #include <asm/mach-ar71xx/ar71xx.h>
17 #include "dev-ar9xxx-wmac.h"
18 #include "dev-gpio-buttons.h"
19 #include "dev-leds-gpio.h"
20 #include "dev-m25p80.h"
22 #define TL_WR741NDV4_GPIO_BTN_RESET 11
23 #define TL_WR741NDV4_GPIO_BTN_WPS 26
25 #define TL_WR741NDV4_GPIO_LED_WLAN 0
26 #define TL_WR741NDV4_GPIO_LED_QSS 1
27 #define TL_WR741NDV4_GPIO_LED_SYSTEM 27
29 #define TL_WR741NDV4_KEYS_POLL_INTERVAL 20 /* msecs */
30 #define TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR741NDV4_KEYS_POLL_INTERVAL)
32 static const char *tl_wr741ndv4_part_probes[] = {
37 static struct flash_platform_data tl_wr741ndv4_flash_data = {
38 .part_probes = tl_wr741ndv4_part_probes,
41 static struct gpio_led tl_wr741ndv4_leds_gpio[] __initdata = {
43 .name = "tp-link:green:system",
44 .gpio = TL_WR741NDV4_GPIO_LED_SYSTEM,
47 .name = "tp-link:green:qss",
48 .gpio = TL_WR741NDV4_GPIO_LED_QSS,
51 .name = "tp-link:green:wlan",
52 .gpio = TL_WR741NDV4_GPIO_LED_WLAN,
57 static struct gpio_keys_button tl_wr741ndv4_gpio_keys[] __initdata = {
62 .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL,
63 .gpio = TL_WR741NDV4_GPIO_BTN_RESET,
68 .code = KEY_WPS_BUTTON,
69 .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL,
70 .gpio = TL_WR741NDV4_GPIO_BTN_WPS,
75 static void __init tl_wr741ndv4_gmac_setup(void)
80 base = ioremap(AR933X_GMAC_BASE, AR933X_GMAC_SIZE);
82 t = __raw_readl(base + AR933X_GMAC_REG_ETH_CFG);
83 t |= (AR933X_ETH_CFG_SW_PHY_SWAP | AR933X_ETH_CFG_SW_PHY_ADDR_SWAP);
84 __raw_writel(t, base + AR933X_GMAC_REG_ETH_CFG);
89 static void __init tl_wr741ndv4_setup(void)
91 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
92 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
94 tl_wr741ndv4_gmac_setup();
96 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr741ndv4_leds_gpio),
97 tl_wr741ndv4_leds_gpio);
99 ar71xx_register_gpio_keys_polled(1, TL_WR741NDV4_KEYS_POLL_INTERVAL,
100 ARRAY_SIZE(tl_wr741ndv4_gpio_keys),
101 tl_wr741ndv4_gpio_keys);
103 ar71xx_add_device_m25p80(&tl_wr741ndv4_flash_data);
104 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
105 ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac, 1);
107 ar71xx_add_device_mdio(0, 0x0);
108 ar71xx_add_device_eth(1);
109 ar71xx_add_device_eth(0);
111 ar9xxx_add_device_wmac(ee, mac);
114 MIPS_MACHINE(AR71XX_MACH_TL_WR741ND_V4, "TL-WR741ND-v4",
115 "TP-LINK TL-WR741ND v4", tl_wr741ndv4_setup);