[ramips] move files to files-3.7
[openwrt/svn-archive/archive.git] / target / linux / ramips / files-3.7 / arch / mips / ralink / rt305x / mach-ur-336un.c
1 #include <linux/init.h>
2 #include <linux/platform_device.h>
3
4 #include <asm/mach-ralink/machine.h>
5 #include <asm/mach-ralink/dev-gpio-buttons.h>
6 #include <asm/mach-ralink/dev-gpio-leds.h>
7 #include <asm/mach-ralink/rt305x.h>
8 #include <asm/mach-ralink/rt305x_regs.h>
9
10 #include "devices.h"
11
12
13 #define UR_336UN_GPIO_LED_3G 9
14 #define UR_336UN_GPIO_LED_GATEWAY 11
15 #define UR_336UN_GPIO_LED_AP 12
16 #define UR_336UN_GPIO_LED_STATION 13
17 #define UR_336UN_GPIO_LED_WPS 14
18
19 #define UR_336UN_GPIO_BUTTON_RESET 10
20 #define UR_336UN_GPIO_BUTTON_CONNECT 7
21 #define UR_336UN_GPIO_BUTTON_WPS 0
22 #define UR_336UN_GPIO_BUTTON_WPS2 8
23
24 #define UR_336UN_KEYS_POLL_INTERVAL 20
25 #define UR_336UN_KEYS_DEBOUNCE_INTERVAL (3 * UR_336UN_KEYS_POLL_INTERVAL)
26
27 static struct gpio_led UR_336UN_leds_gpio[] __initdata = {
28 {
29 .name = "ur336:green:3g",
30 .gpio = UR_336UN_GPIO_LED_3G,
31 .active_low = 1,
32 }, {
33 .name = "ur336:green:gateway",
34 .gpio = UR_336UN_GPIO_LED_GATEWAY,
35 .active_low = 1,
36 }, {
37 .name = "ur336:green:ap",
38 .gpio = UR_336UN_GPIO_LED_AP,
39 .active_low = 1,
40 }, {
41 .name = "ur336:green:wps",
42 .gpio = UR_336UN_GPIO_LED_WPS,
43 .active_low = 1,
44 }, {
45 .name = "ur336:green:station",
46 .gpio = UR_336UN_GPIO_LED_STATION,
47 .active_low = 1,
48 }
49 };
50
51 static struct gpio_keys_button UR_336UN_gpio_buttons[] __initdata = {
52 {
53 .desc = "reset_wps",
54 .type = EV_KEY,
55 .code = KEY_RESTART,
56 .debounce_interval = UR_336UN_KEYS_DEBOUNCE_INTERVAL,
57 .gpio = UR_336UN_GPIO_BUTTON_RESET,
58 .active_low = 1,
59 }, {
60 .desc = "mode",
61 .type = EV_KEY,
62 .code = KEY_M,
63 .debounce_interval = UR_336UN_KEYS_DEBOUNCE_INTERVAL,
64 .gpio = UR_336UN_GPIO_BUTTON_CONNECT,
65 .active_low = 1,
66 }
67 };
68
69 #define UR_336UN_GPIO_MODE \
70 ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
71 RT305X_GPIO_MODE_MDIO)
72
73 static void __init UR_336UN_init(void)
74 {
75 rt305x_gpio_init(UR_336UN_GPIO_MODE);
76
77 rt305x_register_flash(0);
78
79 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
80 rt305x_register_ethernet();
81 ramips_register_gpio_leds(-1, ARRAY_SIZE(UR_336UN_leds_gpio),
82 UR_336UN_leds_gpio);
83 ramips_register_gpio_buttons(-1, UR_336UN_KEYS_POLL_INTERVAL,
84 ARRAY_SIZE(UR_336UN_gpio_buttons),
85 UR_336UN_gpio_buttons);
86 rt305x_register_wifi();
87 rt305x_register_wdt();
88 rt305x_register_usb();
89 }
90
91 MIPS_MACHINE(RAMIPS_MACH_UR_336UN, "UR-336UN", "UR-336UN Wireless N router",
92 UR_336UN_init);