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 physmap_flash_data wl341v3_flash_data = {
79 .nr_parts = ARRAY_SIZE(wl341v3_partitions),
80 .parts = wl341v3_partitions,
83 static struct gpio_led wl341v3_leds_gpio[] __initdata = {
85 .name = "wl341v3:amber:first",
86 .gpio = WL341V3_GPIO_LED_FIRST_AMBER,
89 .name = "wl341v3:blue:first",
90 .gpio = WL341V3_GPIO_LED_FIRST_BLUE,
93 .name = "wl341v3:amber:third",
94 .gpio = WL341V3_GPIO_LED_THIRD_AMBER,
97 .name = "wl341v3:blue:third",
98 .gpio = WL341V3_GPIO_LED_THIRD_BLUE,
101 .name = "wl341v3:blue:fourth",
102 .gpio = WL341V3_GPIO_LED_FOURTH_BLUE,
105 .name = "wl341v3:amber:fifth",
106 .gpio = WL341V3_GPIO_LED_FIFTH_AMBER,
109 .name = "wl341v3:blue:fifth",
110 .gpio = WL341V3_GPIO_LED_FIFTH_BLUE,
115 static struct gpio_keys_button wl341v3_gpio_buttons[] __initdata = {
120 .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL,
121 .gpio = WL341V3_GPIO_BUTTON_RESET,
126 .code = KEY_WPS_BUTTON,
127 .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL,
128 .gpio = WL341V3_GPIO_BUTTON_WPS,
133 static void __init wl341v3_init(void)
135 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
137 rt305x_register_flash(0, &wl341v3_flash_data);
138 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
139 rt305x_register_ethernet();
140 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio),
142 ramips_register_gpio_buttons(-1, WL341V3_KEYS_POLL_INTERVAL,
143 ARRAY_SIZE(wl341v3_gpio_buttons),
144 wl341v3_gpio_buttons);
145 rt305x_register_wifi();
146 rt305x_register_wdt();
147 rt305x_register_usb();
150 MIPS_MACHINE(RAMIPS_MACH_WL341V3, "WL341V3", "Sitecom WL-341 v3",