ramips: properly setup the FEATURES variable
[openwrt.git] / target / linux / ramips / files-3.7 / arch / mips / ralink / rt305x / mach-wl-330n3g.c
1 /*
2  *  Asus WL_330N3G board support
3  *
4  *  Copyright (C) 2012 Frederic Leroy <fredo@starox.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 WL_330N3G_GPIO_BUTTON_RESET     10
25 #define WL_330N3G_GPIO_BUTTON_WPS       0
26 #define WL_330N3G_GPIO_LED_3G_BLUE      9
27 #define WL_330N3G_GPIO_LED_3G_RED       13
28 #define WL_330N3G_GPIO_LED_POWER        11
29 #define WL_330N3G_KEYS_POLL_INTERVAL    20
30 #define WL_330N3G_KEYS_DEBOUNCE_INTERVAL (3 * WL_330N3G_KEYS_POLL_INTERVAL)
31
32 const struct flash_platform_data wl_330n3g_flash = {
33         .type           = "mx25l3205d",
34 };
35
36 struct spi_board_info wl_330n3g_spi_slave_info[] __initdata = {
37         {
38                 .modalias       = "m25p80",
39                 .platform_data  = &wl_330n3g_flash,
40                 .irq            = -1,
41                 .max_speed_hz   = 10000000,
42                 .bus_num        = 0,
43                 .chip_select    = 0,
44         },
45 };
46
47 static struct gpio_keys_button wl_330n3g_gpio_buttons[] __initdata = {
48         {
49                 .desc           = "reset",
50                 .type           = EV_KEY,
51                 .code           = KEY_RESTART,
52                 .debounce_interval = WL_330N3G_KEYS_DEBOUNCE_INTERVAL,
53                 .gpio           = WL_330N3G_GPIO_BUTTON_RESET,
54                 .active_low     = 1,
55         },
56         {
57                 .desc           = "wps",
58                 .type           = EV_KEY,
59                 .code           = KEY_RESTART,
60                 .debounce_interval = WL_330N3G_KEYS_DEBOUNCE_INTERVAL,
61                 .gpio           = WL_330N3G_GPIO_BUTTON_WPS,
62                 .active_low     = 1,
63         }
64 };
65
66 static struct gpio_led wl_330n3g_leds_gpio[] __initdata = {
67         {
68                 .name           = "asus:blue:3g",
69                 .gpio           = WL_330N3G_GPIO_LED_3G_BLUE,
70                 .active_low     = 1,
71         }, {
72                 .name           = "asus:red:3g",
73                 .gpio           = WL_330N3G_GPIO_LED_3G_RED,
74                 .active_low     = 1,
75         }, {
76                 .name           = "asus:blue:power",
77                 .gpio           = WL_330N3G_GPIO_LED_POWER,
78                 .active_low     = 1,
79         }
80 };
81
82 static void __init wl_330n3g_init(void)
83 {
84         rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
85         rt305x_register_spi(wl_330n3g_spi_slave_info,
86                             ARRAY_SIZE(wl_330n3g_spi_slave_info));
87         rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
88         rt305x_register_ethernet();
89         ramips_register_gpio_leds(-1, ARRAY_SIZE(wl_330n3g_leds_gpio),
90                                   wl_330n3g_leds_gpio);
91         ramips_register_gpio_buttons(-1, WL_330N3G_KEYS_POLL_INTERVAL,
92                                      ARRAY_SIZE(wl_330n3g_gpio_buttons),
93                                      wl_330n3g_gpio_buttons);
94         rt305x_register_wifi();
95         rt305x_register_usb();
96         rt305x_register_wdt();
97 }
98
99 MIPS_MACHINE(RAMIPS_MACH_WL_330N3G, "WL_330N3G", "Asus WL-330N3G",
100              wl_330n3g_init);