2 * TP-LINK TL-MR3220/3420 board support
4 * Copyright (C) 2010 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-m25p80.h"
18 #include "dev-ap91-pci.h"
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
23 #define TL_MR3X20_GPIO_LED_QSS 0
24 #define TL_MR3X20_GPIO_LED_SYSTEM 1
25 #define TL_MR3X20_GPIO_LED_3G 8
27 #define TL_MR3X20_GPIO_BTN_RESET 11
28 #define TL_MR3X20_GPIO_BTN_QSS 12
30 #define TL_MR3X20_GPIO_USB_POWER 6
32 #define TL_MR3X20_KEYS_POLL_INTERVAL 20 /* msecs */
33 #define TL_MR3X20_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR3X20_KEYS_POLL_INTERVAL)
35 static const char *tl_mr3x20_part_probes[] = {
40 static struct flash_platform_data tl_mr3x20_flash_data = {
41 .part_probes = tl_mr3x20_part_probes,
44 static struct gpio_led tl_mr3x20_leds_gpio[] __initdata = {
46 .name = "tp-link:green:system",
47 .gpio = TL_MR3X20_GPIO_LED_SYSTEM,
50 .name = "tp-link:green:qss",
51 .gpio = TL_MR3X20_GPIO_LED_QSS,
54 .name = "tp-link:green:3g",
55 .gpio = TL_MR3X20_GPIO_LED_3G,
60 static struct gpio_keys_button tl_mr3x20_gpio_keys[] __initdata = {
65 .debounce_interval = TL_MR3X20_KEYS_DEBOUNCE_INTERVAL,
66 .gpio = TL_MR3X20_GPIO_BTN_RESET,
71 .code = KEY_WPS_BUTTON,
72 .debounce_interval = TL_MR3X20_KEYS_DEBOUNCE_INTERVAL,
73 .gpio = TL_MR3X20_GPIO_BTN_QSS,
78 static void __init tl_mr3x20_setup(void)
80 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
81 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
83 /* enable power for the USB port */
84 gpio_request(TL_MR3X20_GPIO_USB_POWER, "USB power");
85 gpio_direction_output(TL_MR3X20_GPIO_USB_POWER, 1);
87 ar71xx_add_device_m25p80(&tl_mr3x20_flash_data);
89 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio),
92 ar71xx_register_gpio_keys_polled(-1, TL_MR3X20_KEYS_POLL_INTERVAL,
93 ARRAY_SIZE(tl_mr3x20_gpio_keys),
96 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 1);
97 ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac, -1);
99 ar71xx_add_device_mdio(0, 0x0);
102 ar71xx_add_device_eth(1);
104 ar71xx_add_device_eth(0);
106 ar71xx_add_device_usb();
108 ap91_pci_init(ee, mac);
111 static void __init tl_mr3220_setup(void)
114 ap91_pci_setup_wmac_led_pin(1);
117 MIPS_MACHINE(AR71XX_MACH_TL_MR3220, "TL-MR3220", "TP-LINK TL-MR3220",
120 static void __init tl_mr3420_setup(void)
123 ap91_pci_setup_wmac_led_pin(0);
126 MIPS_MACHINE(AR71XX_MACH_TL_MR3420, "TL-MR3420", "TP-LINK TL-MR3420",