ramips: properly setup the FEATURES variable
[openwrt.git] / target / linux / ramips / files-3.7 / arch / mips / ralink / rt288x / mach-wli-tx4-ag300n.c
1 /*
2  *  Buffalo WLI-TX4-AG300N board support
3  *
4  *  Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
5  *
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.
9  */
10
11 #include <linux/init.h>
12 #include <linux/ethtool.h>
13 #include <linux/platform_device.h>
14
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>
21
22 #include "devices.h"
23
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
27
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
31
32 #define WLI_TX4_AG300N_KEYS_POLL_INTERVAL       20
33 #define WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL   (3 * WLI_TX4_AG300N_KEYS_POLL_INTERVAL)
34
35 static struct gpio_led wli_tx4_ag300n_leds_gpio[] __initdata = {
36         {
37                 .name           = "buffalo:blue:power",
38                 .gpio           = WLI_TX4_AG300N_GPIO_LED_POWER,
39                 .active_low     = 1,
40         },
41         {
42                 .name           = "buffalo:red:diag",
43                 .gpio           = WLI_TX4_AG300N_GPIO_LED_DIAG,
44                 .active_low     = 1,
45         },
46         {
47                 .name           = "buffalo:blue:security",
48                 .gpio           = WLI_TX4_AG300N_GPIO_LED_SECURITY,
49                 .active_low     = 0,
50         },
51 };
52
53 static struct gpio_keys_button wli_tx4_ag300n_gpio_buttons[] __initdata = {
54         {
55                 .desc           = "Reset button",
56                 .type           = EV_KEY,
57                 .code           = KEY_RESTART,
58                 .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL,
59                 .gpio           = WLI_TX4_AG300N_GPIO_BUTTON_RESET,
60                 .active_low     = 1,
61         },
62         {
63                 .desc           = "AOSS button",
64                 .type           = EV_KEY,
65                 .code           = KEY_WPS_BUTTON,
66                 .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL,
67                 .gpio           = WLI_TX4_AG300N_GPIO_BUTTON_AOSS,
68                 .active_low     = 1,
69         },
70         {
71                 .desc           = "Bandwidth switch",
72                 .type           = EV_KEY,
73                 .code           = BTN_0,
74                 .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL,
75                 .gpio           = WLI_TX4_AG300N_GPIO_BUTTON_BW_SWITCH,
76                 .active_low     = 0,
77         },
78 };
79
80 static void __init wli_tx4_ag300n_init(void)
81 {
82         rt288x_gpio_init(RT2880_GPIO_MODE_UART0);
83
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);
89
90         rt288x_register_flash(0);
91         rt288x_register_wifi();
92         rt288x_register_wdt();
93
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();
99 }
100
101 MIPS_MACHINE(RAMIPS_MACH_WLI_TX4_AG300N, "WLI-TX4-AG300N",
102              "Buffalo WLI-TX4-AG300N", wli_tx4_ag300n_init);