2 * MoFi Network MOFI3500-3GN board support
4 * Copyright (C) 2011 Layne Edwards <ledwards76@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>
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>
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
27 #define MOFI3500_3GN_GPIO_BUTTON_RESET 10
28 #define MOFI3500_3GN_GPIO_BUTTON_CONNECT 7
29 #define MOFI3500_3GN_GPIO_BUTTON_WPS 0
31 #define MOFI3500_3GN_KEYS_POLL_INTERVAL 20
32 #define MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL (3 * MOFI3500_3GN_KEYS_POLL_INTERVAL)
34 static struct gpio_led mofi3500_3gn_leds_gpio
[] __initdata
= {
36 .name
= "mofi3500-3gn:green:usb",
37 .gpio
= MOFI3500_3GN_GPIO_LED_USB
,
40 .name
= "mofi3500-3gn:green:3g",
41 .gpio
= MOFI3500_3GN_GPIO_LED_3G
,
44 .name
= "mofi3500-3gn:green:status",
45 .gpio
= MOFI3500_3GN_GPIO_LED_STATUS
,
48 .name
= "mofi3500-3gn:green:wps",
49 .gpio
= MOFI3500_3GN_GPIO_LED_WPS
,
54 static struct gpio_keys_button mofi3500_3gn_gpio_buttons
[] __initdata
= {
59 .debounce_interval
= MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL
,
60 .gpio
= MOFI3500_3GN_GPIO_BUTTON_RESET
,
66 .debounce_interval
= MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL
,
67 .gpio
= MOFI3500_3GN_GPIO_BUTTON_CONNECT
,
72 .code
= KEY_WPS_BUTTON
,
73 .debounce_interval
= MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL
,
74 .gpio
= MOFI3500_3GN_GPIO_BUTTON_WPS
,
79 #define MOFI3500_3GN_GPIO_MODE \
80 ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
81 RT305X_GPIO_MODE_MDIO)
83 static void __init
mofi3500_3gn_init(void)
85 rt305x_gpio_init(MOFI3500_3GN_GPIO_MODE
);
87 rt305x_register_flash(0);
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();
101 MIPS_MACHINE(RAMIPS_MACH_MOFI3500_3GN
, "MOFI3500-3GN", "MoFi Network MOFI3500-3GN",