1 #include <linux/init.h>
2 #include <linux/platform_device.h>
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>
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
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
24 #define UR_336UN_KEYS_POLL_INTERVAL 20
25 #define UR_336UN_KEYS_DEBOUNCE_INTERVAL (3 * UR_336UN_KEYS_POLL_INTERVAL)
27 static struct gpio_led UR_336UN_leds_gpio[] __initdata = {
29 .name = "ur336:green:3g",
30 .gpio = UR_336UN_GPIO_LED_3G,
33 .name = "ur336:green:gateway",
34 .gpio = UR_336UN_GPIO_LED_GATEWAY,
37 .name = "ur336:green:ap",
38 .gpio = UR_336UN_GPIO_LED_AP,
41 .name = "ur336:green:wps",
42 .gpio = UR_336UN_GPIO_LED_WPS,
45 .name = "ur336:green:station",
46 .gpio = UR_336UN_GPIO_LED_STATION,
51 static struct gpio_keys_button UR_336UN_gpio_buttons[] __initdata = {
56 .debounce_interval = UR_336UN_KEYS_DEBOUNCE_INTERVAL,
57 .gpio = UR_336UN_GPIO_BUTTON_RESET,
63 .debounce_interval = UR_336UN_KEYS_DEBOUNCE_INTERVAL,
64 .gpio = UR_336UN_GPIO_BUTTON_CONNECT,
69 #define UR_336UN_GPIO_MODE \
70 ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
71 RT305X_GPIO_MODE_MDIO)
73 static void __init UR_336UN_init(void)
75 rt305x_gpio_init(UR_336UN_GPIO_MODE);
77 rt305x_register_flash(0);
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),
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();
91 MIPS_MACHINE(RAMIPS_MACH_UR_336UN, "UR-336UN", "UR-336UN Wireless N router",