2 * Sitecom WL341v3 board support
4 * Copyright (C) 2012 Marco Antonio Mauro <marcus90@gmail.com>
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 WL341V3_GPIO_LED_FIRST_AMBER 9
23 #define WL341V3_GPIO_LED_FIRST_BLUE 13
24 #define WL341V3_GPIO_LED_THIRD_AMBER 11
25 #define WL341V3_GPIO_LED_THIRD_BLUE 14
26 #define WL341V3_GPIO_LED_FOURTH_BLUE 10
27 #define WL341V3_GPIO_LED_FIFTH_AMBER 12
28 #define WL341V3_GPIO_LED_FIFTH_BLUE 8
30 #define WL341V3_GPIO_BUTTON_WPS 5 /* active low */
31 #define WL341V3_GPIO_BUTTON_RESET 7 /* active low */
33 #define WL341V3_KEYS_POLL_INTERVAL 20
34 #define WL341V3_KEYS_DEBOUNCE_INTERVAL (3 * WL341V3_KEYS_POLL_INTERVAL)
36 static struct gpio_led wl341v3_leds_gpio
[] __initdata
= {
38 .name
= "wl341v3:amber:first",
39 .gpio
= WL341V3_GPIO_LED_FIRST_AMBER
,
42 .name
= "wl341v3:blue:first",
43 .gpio
= WL341V3_GPIO_LED_FIRST_BLUE
,
46 .name
= "wl341v3:amber:third",
47 .gpio
= WL341V3_GPIO_LED_THIRD_AMBER
,
50 .name
= "wl341v3:blue:third",
51 .gpio
= WL341V3_GPIO_LED_THIRD_BLUE
,
54 .name
= "wl341v3:blue:fourth",
55 .gpio
= WL341V3_GPIO_LED_FOURTH_BLUE
,
58 .name
= "wl341v3:amber:fifth",
59 .gpio
= WL341V3_GPIO_LED_FIFTH_AMBER
,
62 .name
= "wl341v3:blue:fifth",
63 .gpio
= WL341V3_GPIO_LED_FIFTH_BLUE
,
68 static struct gpio_keys_button wl341v3_gpio_buttons
[] __initdata
= {
73 .debounce_interval
= WL341V3_KEYS_DEBOUNCE_INTERVAL
,
74 .gpio
= WL341V3_GPIO_BUTTON_RESET
,
79 .code
= KEY_WPS_BUTTON
,
80 .debounce_interval
= WL341V3_KEYS_DEBOUNCE_INTERVAL
,
81 .gpio
= WL341V3_GPIO_BUTTON_WPS
,
86 static void __init
wl341v3_init(void)
88 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
90 rt305x_register_flash(0);
92 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
93 rt305x_register_ethernet();
94 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio
),
96 ramips_register_gpio_buttons(-1, WL341V3_KEYS_POLL_INTERVAL
,
97 ARRAY_SIZE(wl341v3_gpio_buttons
),
98 wl341v3_gpio_buttons
);
99 rt305x_register_wifi();
100 rt305x_register_wdt();
101 rt305x_register_usb();
104 MIPS_MACHINE(RAMIPS_MACH_WL341V3
, "WL341V3", "Sitecom WL-341 v3",