ramips: properly setup the FEATURES variable
[openwrt.git] / target / linux / ramips / files-3.7 / arch / mips / ralink / rt305x / mach-br6425.c
1 /*
2  *  Edimax BR-6425 board support
3  *
4  *  Copyright (C) 2012 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/platform_device.h>
13 #include <linux/spi/spi.h>
14 #include <linux/spi/flash.h>
15
16 #include <asm/mach-ralink/machine.h>
17 #include <asm/mach-ralink/dev-gpio-buttons.h>
18 #include <asm/mach-ralink/dev-gpio-leds.h>
19 #include <asm/mach-ralink/rt305x.h>
20 #include <asm/mach-ralink/rt305x_regs.h>
21
22 #include "devices.h"
23
24 #define BR6425_GPIO_LED_POWER           9
25 #define BR6425_GPIO_BUTTON_RESET        12
26 #define BR6425_GPIO_SWITCH_RFKILL       13
27 #define BR6425_GPIO_LED_WLAN            14
28 #define BR6425_KEYS_POLL_INTERVAL       20
29 #define BR6425_KEYS_DEBOUNCE_INTERVAL   (3 * BR6425_KEYS_POLL_INTERVAL)
30
31 static struct gpio_keys_button br6425_gpio_buttons[] __initdata = {
32         {
33                 .desc           = "reset_wps",
34                 .type           = EV_KEY,
35                 .code           = KEY_RESTART,
36                 .debounce_interval = BR6425_KEYS_DEBOUNCE_INTERVAL,
37                 .gpio           = BR6425_GPIO_BUTTON_RESET,
38                 .active_low     = 1,
39         },
40         {
41                 .desc           = "RFKILL switch",
42                 .type           = EV_SW,
43                 .code           = KEY_RFKILL,
44                 .debounce_interval = BR6425_KEYS_DEBOUNCE_INTERVAL,
45                 .gpio           = BR6425_GPIO_SWITCH_RFKILL,
46                 .active_low     = 1,
47         },
48 };
49
50 static struct gpio_led br6425_leds_gpio[] __initdata = {
51         {
52                 .name           = "edimax:green:power",
53                 .gpio           = BR6425_GPIO_LED_POWER,
54                 .active_low     = 1,
55         }, {
56                 .name           = "edimax:orange:wlan",
57                 .gpio           = BR6425_GPIO_LED_WLAN,
58                 .active_low     = 1,
59         },
60 };
61
62 static void __init br6425_init(void)
63 {
64         rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
65         rt305x_register_flash(0);
66         rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
67         rt305x_register_ethernet();
68         ramips_register_gpio_leds(-1, ARRAY_SIZE(br6425_leds_gpio),
69                                   br6425_leds_gpio);
70         ramips_register_gpio_buttons(-1, BR6425_KEYS_POLL_INTERVAL,
71                                      ARRAY_SIZE(br6425_gpio_buttons),
72                                      br6425_gpio_buttons);
73         rt305x_register_wifi();
74         rt305x_register_wdt();
75 }
76
77 MIPS_MACHINE(RAMIPS_MACH_BR6425, "BR-6425", "Edimax BR-6425",
78              br6425_init);