ramips: introduce ramips_soc_prom_init and move SoC detection into that
[openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-mofi3500-3gn.c
1 /*
2 * MoFi Network MOFI3500-3GN board support
3 *
4 * Copyright (C) 2011 Layne Edwards <ledwards76@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 MOFI3500_3GN_GPIO_LED_USB 8
23 #define MOFI3500_3GN_GPIO_LED_3G 11
24 #define MOFI3500_3GN_GPIO_LED_STATUS 12
25 #define MOFI3500_3GN_GPIO_LED_WPS 14
26
27 #define MOFI3500_3GN_GPIO_BUTTON_RESET 10
28 #define MOFI3500_3GN_GPIO_BUTTON_CONNECT 7
29 #define MOFI3500_3GN_GPIO_BUTTON_WPS 0
30
31 #define MOFI3500_3GN_KEYS_POLL_INTERVAL 20
32 #define MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL (3 * MOFI3500_3GN_KEYS_POLL_INTERVAL)
33
34 static struct gpio_led mofi3500_3gn_leds_gpio[] __initdata = {
35 {
36 .name = "mofi3500-3gn:green:usb",
37 .gpio = MOFI3500_3GN_GPIO_LED_USB,
38 .active_low = 1,
39 }, {
40 .name = "mofi3500-3gn:green:3g",
41 .gpio = MOFI3500_3GN_GPIO_LED_3G,
42 .active_low = 1,
43 }, {
44 .name = "mofi3500-3gn:green:status",
45 .gpio = MOFI3500_3GN_GPIO_LED_STATUS,
46 .active_low = 1,
47 }, {
48 .name = "mofi3500-3gn:green:wps",
49 .gpio = MOFI3500_3GN_GPIO_LED_WPS,
50 .active_low = 1,
51 }
52 };
53
54 static struct gpio_keys_button mofi3500_3gn_gpio_buttons[] __initdata = {
55 {
56 .desc = "reset",
57 .type = EV_KEY,
58 .code = KEY_RESTART,
59 .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL,
60 .gpio = MOFI3500_3GN_GPIO_BUTTON_RESET,
61 .active_low = 1,
62 }, {
63 .desc = "connect",
64 .type = EV_KEY,
65 .code = KEY_CONNECT,
66 .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL,
67 .gpio = MOFI3500_3GN_GPIO_BUTTON_CONNECT,
68 .active_low = 1,
69 }, {
70 .desc = "wps",
71 .type = EV_KEY,
72 .code = KEY_WPS_BUTTON,
73 .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL,
74 .gpio = MOFI3500_3GN_GPIO_BUTTON_WPS,
75 .active_low = 1,
76 }
77 };
78
79 #define MOFI3500_3GN_GPIO_MODE \
80 ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
81 RT305X_GPIO_MODE_MDIO)
82
83 static void __init mofi3500_3gn_init(void)
84 {
85 rt305x_gpio_init(MOFI3500_3GN_GPIO_MODE);
86
87 rt305x_register_flash(0);
88
89 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
90 rt305x_register_ethernet();
91 ramips_register_gpio_leds(-1, ARRAY_SIZE(mofi3500_3gn_leds_gpio),
92 mofi3500_3gn_leds_gpio);
93 ramips_register_gpio_buttons(-1, MOFI3500_3GN_KEYS_POLL_INTERVAL,
94 ARRAY_SIZE(mofi3500_3gn_gpio_buttons),
95 mofi3500_3gn_gpio_buttons);
96 rt305x_register_wifi();
97 rt305x_register_wdt();
98 rt305x_register_usb();
99 }
100
101 MIPS_MACHINE(RAMIPS_MACH_MOFI3500_3GN, "MOFI3500-3GN", "MoFi Network MOFI3500-3GN",
102 mofi3500_3gn_init);
This page took 0.055813 seconds and 5 git commands to generate.