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>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
17 #include <asm/mach-ralink/machine.h>
18 #include <asm/mach-ralink/dev-gpio-buttons.h>
19 #include <asm/mach-ralink/dev-gpio-leds.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
25 #define WL341V3_GPIO_LED_FIRST_AMBER 9
26 #define WL341V3_GPIO_LED_FIRST_BLUE 13
27 #define WL341V3_GPIO_LED_THIRD_AMBER 11
28 #define WL341V3_GPIO_LED_THIRD_BLUE 14
29 #define WL341V3_GPIO_LED_FOURTH_BLUE 10
30 #define WL341V3_GPIO_LED_FIFTH_AMBER 12
31 #define WL341V3_GPIO_LED_FIFTH_BLUE 8
33 #define WL341V3_GPIO_BUTTON_WPS 5 /* active low */
34 #define WL341V3_GPIO_BUTTON_RESET 7 /* active low */
36 #define WL341V3_KEYS_POLL_INTERVAL 20
37 #define WL341V3_KEYS_DEBOUNCE_INTERVAL (3 * WL341V3_KEYS_POLL_INTERVAL)
39 static struct mtd_partition wl341v3_partitions
[] = {
44 .mask_flags
= MTD_WRITEABLE
,
46 .name
= "board-nvram",
49 .mask_flags
= MTD_WRITEABLE
,
54 .mask_flags
= MTD_WRITEABLE
,
64 .name
= "signature-eRcOmM",
78 static struct gpio_led wl341v3_leds_gpio
[] __initdata
= {
80 .name
= "wl341v3:amber:first",
81 .gpio
= WL341V3_GPIO_LED_FIRST_AMBER
,
84 .name
= "wl341v3:blue:first",
85 .gpio
= WL341V3_GPIO_LED_FIRST_BLUE
,
88 .name
= "wl341v3:amber:third",
89 .gpio
= WL341V3_GPIO_LED_THIRD_AMBER
,
92 .name
= "wl341v3:blue:third",
93 .gpio
= WL341V3_GPIO_LED_THIRD_BLUE
,
96 .name
= "wl341v3:blue:fourth",
97 .gpio
= WL341V3_GPIO_LED_FOURTH_BLUE
,
100 .name
= "wl341v3:amber:fifth",
101 .gpio
= WL341V3_GPIO_LED_FIFTH_AMBER
,
104 .name
= "wl341v3:blue:fifth",
105 .gpio
= WL341V3_GPIO_LED_FIFTH_BLUE
,
110 static struct gpio_keys_button wl341v3_gpio_buttons
[] __initdata
= {
115 .debounce_interval
= WL341V3_KEYS_DEBOUNCE_INTERVAL
,
116 .gpio
= WL341V3_GPIO_BUTTON_RESET
,
121 .code
= KEY_WPS_BUTTON
,
122 .debounce_interval
= WL341V3_KEYS_DEBOUNCE_INTERVAL
,
123 .gpio
= WL341V3_GPIO_BUTTON_WPS
,
128 static void __init
wl341v3_init(void)
130 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
132 rt305x_flash0_data
.nr_parts
= ARRAY_SIZE(wl341v3_partitions
);
133 rt305x_flash0_data
.parts
= wl341v3_partitions
;
134 rt305x_register_flash(0);
136 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
137 rt305x_register_ethernet();
138 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio
),
140 ramips_register_gpio_buttons(-1, WL341V3_KEYS_POLL_INTERVAL
,
141 ARRAY_SIZE(wl341v3_gpio_buttons
),
142 wl341v3_gpio_buttons
);
143 rt305x_register_wifi();
144 rt305x_register_wdt();
145 rt305x_register_usb();
148 MIPS_MACHINE(RAMIPS_MACH_WL341V3
, "WL341V3", "Sitecom WL-341 v3",