2 * TP-LINK TL-WR703N board support
4 * Copyright (C) 2011 dongyuqi <729650915@qq.com>
5 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
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 <linux/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
14 #include <linux/spi/flash.h>
15 #include <linux/gpio.h>
17 #include <asm/mach-ar71xx/ar71xx.h>
21 #include "dev-ar9xxx-wmac.h"
22 #include "dev-gpio-buttons.h"
23 #include "dev-leds-gpio.h"
24 #include "dev-m25p80.h"
27 #define TL_WR703N_GPIO_LED_SYSTEM 27
28 #define TL_WR703N_GPIO_BTN_RESET 11
30 #define TL_WR703N_GPIO_USB_POWER 8
32 #define TL_WR703N_KEYS_POLL_INTERVAL 20 /* msecs */
33 #define TL_WR703N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR703N_KEYS_POLL_INTERVAL)
35 #ifdef CONFIG_MTD_PARTITIONS
36 static struct mtd_partition tl_wr703n_parts[] = {
41 .mask_flags = MTD_WRITEABLE,
54 .mask_flags = MTD_WRITEABLE,
61 #define tl_wr703n_nr_parts ARRAY_SIZE(tl_wr703n_parts)
63 #define tl_wr703n_parts NULL
64 #define tl_wr703n_nr_parts 0
65 #endif /* CONFIG_MTD_PARTITIONS */
67 static struct flash_platform_data tl_wr703n_flash_data = {
68 .parts = tl_wr703n_parts,
69 .nr_parts = tl_wr703n_nr_parts,
72 static struct gpio_led tl_wr703n_leds_gpio[] __initdata = {
74 .name = "tl-wr703n:blue:system",
75 .gpio = TL_WR703N_GPIO_LED_SYSTEM,
80 static struct gpio_keys_button tl_wr703n_gpio_keys[] __initdata = {
85 .debounce_interval = TL_WR703N_KEYS_DEBOUNCE_INTERVAL,
86 .gpio = TL_WR703N_GPIO_BTN_RESET,
91 static void __init tl_wr703n_setup(void)
93 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
94 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
96 ar71xx_add_device_m25p80(&tl_wr703n_flash_data);
97 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr703n_leds_gpio),
99 ar71xx_register_gpio_keys_polled(-1, TL_WR703N_KEYS_POLL_INTERVAL,
100 ARRAY_SIZE(tl_wr703n_gpio_keys),
101 tl_wr703n_gpio_keys);
103 gpio_request(TL_WR703N_GPIO_USB_POWER, "USB power");
104 gpio_direction_output(TL_WR703N_GPIO_USB_POWER, 1);
105 ar71xx_add_device_usb();
107 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
109 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
110 ar71xx_eth0_data.speed = SPEED_100;
111 ar71xx_eth0_data.duplex = DUPLEX_FULL;
112 ar71xx_eth0_data.phy_mask = BIT(4);
114 ar71xx_add_device_mdio(0x0);
115 ar71xx_add_device_eth(0);
117 ar9xxx_add_device_wmac(ee, mac);
120 MIPS_MACHINE(AR71XX_MACH_TL_WR703N, "TL-WR703N", "TP-LINK TL-WR703N v1",