ramips: introduce ramips_soc_prom_init and move SoC detection into that
[openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-wl341v3.c
1 /*
2 * Sitecom WL341v3 board support
3 *
4 * Copyright (C) 2012 Marco Antonio Mauro <marcus90@gmail.com>
5 *
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.
9 */
10
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13
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>
19
20 #include "devices.h"
21
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
29
30 #define WL341V3_GPIO_BUTTON_WPS 5 /* active low */
31 #define WL341V3_GPIO_BUTTON_RESET 7 /* active low */
32
33 #define WL341V3_KEYS_POLL_INTERVAL 20
34 #define WL341V3_KEYS_DEBOUNCE_INTERVAL (3 * WL341V3_KEYS_POLL_INTERVAL)
35
36 static struct gpio_led wl341v3_leds_gpio[] __initdata = {
37 {
38 .name = "wl341v3:amber:first",
39 .gpio = WL341V3_GPIO_LED_FIRST_AMBER,
40 .active_low = 1,
41 }, {
42 .name = "wl341v3:blue:first",
43 .gpio = WL341V3_GPIO_LED_FIRST_BLUE,
44 .active_low = 1,
45 }, {
46 .name = "wl341v3:amber:third",
47 .gpio = WL341V3_GPIO_LED_THIRD_AMBER,
48 .active_low = 1,
49 }, {
50 .name = "wl341v3:blue:third",
51 .gpio = WL341V3_GPIO_LED_THIRD_BLUE,
52 .active_low = 1,
53 }, {
54 .name = "wl341v3:blue:fourth",
55 .gpio = WL341V3_GPIO_LED_FOURTH_BLUE,
56 .active_low = 1,
57 }, {
58 .name = "wl341v3:amber:fifth",
59 .gpio = WL341V3_GPIO_LED_FIFTH_AMBER,
60 .active_low = 1,
61 }, {
62 .name = "wl341v3:blue:fifth",
63 .gpio = WL341V3_GPIO_LED_FIFTH_BLUE,
64 .active_low = 1,
65 }
66 };
67
68 static struct gpio_keys_button wl341v3_gpio_buttons[] __initdata = {
69 {
70 .desc = "reset",
71 .type = EV_KEY,
72 .code = KEY_RESTART,
73 .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL,
74 .gpio = WL341V3_GPIO_BUTTON_RESET,
75 .active_low = 1,
76 }, {
77 .desc = "wps",
78 .type = EV_KEY,
79 .code = KEY_WPS_BUTTON,
80 .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL,
81 .gpio = WL341V3_GPIO_BUTTON_WPS,
82 .active_low = 1,
83 }
84 };
85
86 static void __init wl341v3_init(void)
87 {
88 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
89
90 rt305x_register_flash(0);
91
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),
95 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();
102 }
103
104 MIPS_MACHINE(RAMIPS_MACH_WL341V3, "WL341V3", "Sitecom WL-341 v3",
105 wl341v3_init);
This page took 0.055117 seconds and 5 git commands to generate.