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_BUTTONS_POLL_INTERVAL 20
38 static struct mtd_partition wl341v3_partitions[] = {
43 .mask_flags = MTD_WRITEABLE,
45 .name = "board-nvram",
48 .mask_flags = MTD_WRITEABLE,
53 .mask_flags = MTD_WRITEABLE,
63 .name = "signature-eRcOmM",
77 static struct physmap_flash_data wl341v3_flash_data = {
78 .nr_parts = ARRAY_SIZE(wl341v3_partitions),
79 .parts = wl341v3_partitions,
82 static struct gpio_led wl341v3_leds_gpio[] __initdata = {
84 .name = "wl341v3:amber:first",
85 .gpio = WL341V3_GPIO_LED_FIRST_AMBER,
88 .name = "wl341v3:blue:first",
89 .gpio = WL341V3_GPIO_LED_FIRST_BLUE,
92 .name = "wl341v3:amber:third",
93 .gpio = WL341V3_GPIO_LED_THIRD_AMBER,
96 .name = "wl341v3:blue:third",
97 .gpio = WL341V3_GPIO_LED_THIRD_BLUE,
100 .name = "wl341v3:blue:fourth",
101 .gpio = WL341V3_GPIO_LED_FOURTH_BLUE,
104 .name = "wl341v3:amber:fifth",
105 .gpio = WL341V3_GPIO_LED_FIFTH_AMBER,
108 .name = "wl341v3:blue:fifth",
109 .gpio = WL341V3_GPIO_LED_FIFTH_BLUE,
114 static struct gpio_button wl341v3_gpio_buttons[] __initdata = {
120 .gpio = WL341V3_GPIO_BUTTON_RESET,
125 .code = KEY_WPS_BUTTON,
127 .gpio = WL341V3_GPIO_BUTTON_WPS,
132 static void __init wl341v3_init(void)
134 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
136 rt305x_register_flash(0, &wl341v3_flash_data);
137 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
138 rt305x_register_ethernet();
139 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio),
141 ramips_register_gpio_buttons(-1, WL341V3_BUTTONS_POLL_INTERVAL,
142 ARRAY_SIZE(wl341v3_gpio_buttons),
143 wl341v3_gpio_buttons);
144 rt305x_register_wifi();
145 rt305x_register_wdt();
146 rt305x_register_usb();
149 MIPS_MACHINE(RAMIPS_MACH_WL341V3, "WL341V3", "Sitecom WL-341 v3",