2 * Buffalo WLI-TX4-AG300N 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/init.h>
12 #include <linux/ethtool.h>
13 #include <linux/platform_device.h>
15 #include <asm/mach-ralink/machine.h>
16 #include <asm/mach-ralink/dev-gpio-buttons.h>
17 #include <asm/mach-ralink/dev-gpio-leds.h>
18 #include <asm/mach-ralink/rt288x.h>
19 #include <asm/mach-ralink/rt288x_regs.h>
20 #include <asm/mach-ralink/ramips_eth_platform.h>
24 #define WLI_TX4_AG300N_GPIO_LED_DIAG 10
25 #define WLI_TX4_AG300N_GPIO_LED_POWER 12
26 #define WLI_TX4_AG300N_GPIO_LED_SECURITY 13
28 #define WLI_TX4_AG300N_GPIO_BUTTON_AOSS 0
29 #define WLI_TX4_AG300N_GPIO_BUTTON_BW_SWITCH 8
30 #define WLI_TX4_AG300N_GPIO_BUTTON_RESET 9
32 #define WLI_TX4_AG300N_KEYS_POLL_INTERVAL 20
33 #define WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLI_TX4_AG300N_KEYS_POLL_INTERVAL)
35 static struct gpio_led wli_tx4_ag300n_leds_gpio
[] __initdata
= {
37 .name
= "buffalo:blue:power",
38 .gpio
= WLI_TX4_AG300N_GPIO_LED_POWER
,
42 .name
= "buffalo:red:diag",
43 .gpio
= WLI_TX4_AG300N_GPIO_LED_DIAG
,
47 .name
= "buffalo:blue:security",
48 .gpio
= WLI_TX4_AG300N_GPIO_LED_SECURITY
,
53 static struct gpio_keys_button wli_tx4_ag300n_gpio_buttons
[] __initdata
= {
55 .desc
= "Reset button",
58 .debounce_interval
= WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL
,
59 .gpio
= WLI_TX4_AG300N_GPIO_BUTTON_RESET
,
63 .desc
= "AOSS button",
65 .code
= KEY_WPS_BUTTON
,
66 .debounce_interval
= WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL
,
67 .gpio
= WLI_TX4_AG300N_GPIO_BUTTON_AOSS
,
71 .desc
= "Bandwidth switch",
74 .debounce_interval
= WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL
,
75 .gpio
= WLI_TX4_AG300N_GPIO_BUTTON_BW_SWITCH
,
80 static void __init
wli_tx4_ag300n_init(void)
82 rt288x_gpio_init(RT2880_GPIO_MODE_UART0
);
84 ramips_register_gpio_leds(-1, ARRAY_SIZE(wli_tx4_ag300n_leds_gpio
),
85 wli_tx4_ag300n_leds_gpio
);
86 ramips_register_gpio_buttons(-1, WLI_TX4_AG300N_KEYS_POLL_INTERVAL
,
87 ARRAY_SIZE(wli_tx4_ag300n_gpio_buttons
),
88 wli_tx4_ag300n_gpio_buttons
);
90 rt288x_register_flash(0);
91 rt288x_register_wifi();
92 rt288x_register_wdt();
94 rt288x_eth_data
.speed
= SPEED_100
;
95 rt288x_eth_data
.duplex
= DUPLEX_FULL
;
96 rt288x_eth_data
.tx_fc
= 1;
97 rt288x_eth_data
.rx_fc
= 1;
98 rt288x_register_ethernet();
101 MIPS_MACHINE(RAMIPS_MACH_WLI_TX4_AG300N
, "WLI-TX4-AG300N",
102 "Buffalo WLI-TX4-AG300N", wli_tx4_ag300n_init
);