ramips: introduce ramips_soc_prom_init and move SoC detection into that
[openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-w502u.c
1 /*
2 * ALFA Networks W502U board support
3 *
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
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 W502U_GPIO_LED_USB 13
23 #define W502U_GPIO_LED_WPS 14
24
25 #define W502U_GPIO_BUTTON_WPS 0
26 #define W502U_GPIO_BUTTON_RESET 10
27
28 #define W502U_KEYS_POLL_INTERVAL 20
29 #define W502U_KEYS_DEBOUNCE_INTERVAL (3 * W502U_KEYS_POLL_INTERVAL)
30
31 static struct gpio_led w502u_leds_gpio[] __initdata = {
32 {
33 .name = "alfa:blue:usb",
34 .gpio = W502U_GPIO_LED_USB,
35 .active_low = 1,
36 },
37 {
38 .name = "alfa:blue:wps",
39 .gpio = W502U_GPIO_LED_WPS,
40 .active_low = 1,
41 },
42 };
43
44 static struct gpio_keys_button w502u_gpio_buttons[] __initdata = {
45 {
46 .desc = "Reset button",
47 .type = EV_KEY,
48 .code = KEY_RESTART,
49 .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL,
50 .gpio = W502U_GPIO_BUTTON_RESET,
51 .active_low = 1,
52 },
53 {
54 .desc = "WPS button",
55 .type = EV_KEY,
56 .code = KEY_WPS_BUTTON,
57 .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL,
58 .gpio = W502U_GPIO_BUTTON_WPS,
59 .active_low = 1,
60 },
61 };
62
63 static void __init w502u_init(void)
64 {
65 rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
66 RT305X_GPIO_MODE_UART0_SHIFT));
67
68 rt305x_register_flash(0);
69
70 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
71 rt305x_register_ethernet();
72 ramips_register_gpio_leds(-1, ARRAY_SIZE(w502u_leds_gpio),
73 w502u_leds_gpio);
74 ramips_register_gpio_buttons(-1, W502U_KEYS_POLL_INTERVAL,
75 ARRAY_SIZE(w502u_gpio_buttons),
76 w502u_gpio_buttons);
77 rt305x_register_wifi();
78 rt305x_register_wdt();
79 rt305x_register_usb();
80 }
81
82 MIPS_MACHINE(RAMIPS_MACH_W502U, "W502U", "ALFA Networks W502U",
83 w502u_init);
This page took 0.044051 seconds and 5 git commands to generate.