2 * ALFA Networks W502U board support
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
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.
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
14 #include <asm/mach-ralink/machine.h>
15 #include <asm/mach-ralink/dev-gpio-buttons.h>
16 #include <asm/mach-ralink/dev-gpio-leds.h>
17 #include <asm/mach-ralink/rt305x.h>
18 #include <asm/mach-ralink/rt305x_regs.h>
22 #define W502U_GPIO_LED_USB 13
23 #define W502U_GPIO_LED_WPS 14
25 #define W502U_GPIO_BUTTON_WPS 0
26 #define W502U_GPIO_BUTTON_RESET 10
28 #define W502U_KEYS_POLL_INTERVAL 20
29 #define W502U_KEYS_DEBOUNCE_INTERVAL (3 * W502U_KEYS_POLL_INTERVAL)
31 static struct gpio_led w502u_leds_gpio
[] __initdata
= {
33 .name
= "alfa:blue:usb",
34 .gpio
= W502U_GPIO_LED_USB
,
38 .name
= "alfa:blue:wps",
39 .gpio
= W502U_GPIO_LED_WPS
,
44 static struct gpio_keys_button w502u_gpio_buttons
[] __initdata
= {
46 .desc
= "Reset button",
49 .debounce_interval
= W502U_KEYS_DEBOUNCE_INTERVAL
,
50 .gpio
= W502U_GPIO_BUTTON_RESET
,
56 .code
= KEY_WPS_BUTTON
,
57 .debounce_interval
= W502U_KEYS_DEBOUNCE_INTERVAL
,
58 .gpio
= W502U_GPIO_BUTTON_WPS
,
63 static void __init
w502u_init(void)
65 rt305x_gpio_init((RT305X_GPIO_MODE_GPIO
<<
66 RT305X_GPIO_MODE_UART0_SHIFT
));
68 rt305x_register_flash(0);
70 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
71 rt305x_register_ethernet();
72 ramips_register_gpio_leds(-1, ARRAY_SIZE(w502u_leds_gpio
),
74 ramips_register_gpio_buttons(-1, W502U_KEYS_POLL_INTERVAL
,
75 ARRAY_SIZE(w502u_gpio_buttons
),
77 rt305x_register_wifi();
78 rt305x_register_wdt();
79 rt305x_register_usb();
82 MIPS_MACHINE(RAMIPS_MACH_W502U
, "W502U", "ALFA Networks W502U",