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_ap99_setup(void)
80 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
81 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
83 ar71xx_add_device_m25p80(&tl_mr3x20_flash_data
);
85 ar71xx_register_gpio_keys_polled(-1, TL_MR3X20_KEYS_POLL_INTERVAL
,
86 ARRAY_SIZE(tl_mr3x20_gpio_keys
),
89 ar71xx_init_mac(ar71xx_eth0_data
.mac_addr
, mac
, 1);
90 ar71xx_init_mac(ar71xx_eth1_data
.mac_addr
, mac
, -1);
92 ar71xx_add_device_mdio(0, 0x0);
95 ar71xx_add_device_eth(1);
97 ar71xx_add_device_eth(0);
99 ap91_pci_init(ee
, mac
);
102 static void __init
tl_mr3x20_usb_setup(void)
104 /* enable power for the USB port */
105 gpio_request(TL_MR3X20_GPIO_USB_POWER
, "USB power");
106 gpio_direction_output(TL_MR3X20_GPIO_USB_POWER
, 1);
108 ar71xx_add_device_usb();
111 static void __init
tl_mr3220_setup(void)
115 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio
),
116 tl_mr3x20_leds_gpio
);
117 ap91_pci_setup_wmac_led_pin(1);
118 tl_mr3x20_usb_setup();
121 MIPS_MACHINE(AR71XX_MACH_TL_MR3220
, "TL-MR3220", "TP-LINK TL-MR3220",
124 static void __init
tl_mr3420_setup(void)
128 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio
),
129 tl_mr3x20_leds_gpio
);
130 ap91_pci_setup_wmac_led_pin(0);
131 tl_mr3x20_usb_setup();
134 MIPS_MACHINE(AR71XX_MACH_TL_MR3420
, "TL-MR3420", "TP-LINK TL-MR3420",
137 static void __init
tl_wr841n_v7_setup(void)
141 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio
) - 1,
142 tl_mr3x20_leds_gpio
);
143 ap91_pci_setup_wmac_led_pin(0);
146 MIPS_MACHINE(AR71XX_MACH_TL_WR841N_V7
, "TL-WR841N-v7",
147 "TP-LINK TL-WR841N/ND v7", tl_wr841n_v7_setup
);