2 * Unbranded router from DX board support
3 * Also known as *WR512*-3GN by local vendors
4 * e.g. WS-WR512N1, Sin Hon SH-WR512NU, and etc
5 * (http://www.dealextreme.com/p/portable-wireless-n-3g-router-cdma2000-evdo-td-scdma-hspa-wcdma-45639)
6 * This router is also known to be rebranded and sold by a number of local
7 * vendors in several countries.
9 * Copyright (C) 2011 Andrew Andrianov <necromant@necromant.ath.cx>
10 * Based on MOFI3500-3N code by
11 * Copyright (C) 2011 Layne Edwards <ledwards76@gmail.com>
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License version 2 as published
16 * by the Free Software Foundation.
19 #include <linux/init.h>
20 #include <linux/platform_device.h>
22 #include <asm/mach-ralink/machine.h>
23 #include <asm/mach-ralink/dev-gpio-buttons.h>
24 #include <asm/mach-ralink/dev-gpio-leds.h>
25 #include <asm/mach-ralink/rt305x.h>
26 #include <asm/mach-ralink/rt305x_regs.h>
31 #define WR512_3GN_GPIO_LED_3G 9
32 #define WR512_3GN_GPIO_LED_GATEWAY 11
33 #define WR512_3GN_GPIO_LED_AP 12
34 #define WR512_3GN_GPIO_LED_STATION 13
35 #define WR512_3GN_GPIO_LED_WPS 14
37 #define WR512_3GN_GPIO_BUTTON_RESET 10
38 #define WR512_3GN_GPIO_BUTTON_CONNECT 7
39 #define WR512_3GN_GPIO_BUTTON_WPS 0
40 #define WR512_3GN_GPIO_BUTTON_WPS2 8
42 #define WR512_3GN_KEYS_POLL_INTERVAL 20
43 #define WR512_3GN_KEYS_DEBOUNCE_INTERVAL (3 * WR512_3GN_KEYS_POLL_INTERVAL)
45 static struct gpio_led wr512_3gn_leds_gpio
[] __initdata
= {
47 .name
= "wr512:green:3g",
48 .gpio
= WR512_3GN_GPIO_LED_3G
,
51 .name
= "wr512:green:gateway",
52 .gpio
= WR512_3GN_GPIO_LED_GATEWAY
,
55 .name
= "wr512:green:ap",
56 .gpio
= WR512_3GN_GPIO_LED_AP
,
59 .name
= "wr512:green:wps",
60 .gpio
= WR512_3GN_GPIO_LED_WPS
,
63 .name
= "wr512:green:station",
64 .gpio
= WR512_3GN_GPIO_LED_STATION
,
69 static struct gpio_keys_button wr512_3gn_gpio_buttons
[] __initdata
= {
74 .debounce_interval
= WR512_3GN_KEYS_DEBOUNCE_INTERVAL
,
75 .gpio
= WR512_3GN_GPIO_BUTTON_RESET
,
81 .debounce_interval
= WR512_3GN_KEYS_DEBOUNCE_INTERVAL
,
82 .gpio
= WR512_3GN_GPIO_BUTTON_CONNECT
,
87 #define WR512_3GN_GPIO_MODE \
88 ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
89 RT305X_GPIO_MODE_MDIO)
91 static void __init
wr512_3gn_init(void)
93 rt305x_gpio_init(WR512_3GN_GPIO_MODE
);
95 rt305x_register_flash(0);
97 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_LLLLW
;
98 rt305x_register_ethernet();
99 ramips_register_gpio_leds(-1, ARRAY_SIZE(wr512_3gn_leds_gpio
),
100 wr512_3gn_leds_gpio
);
101 ramips_register_gpio_buttons(-1, WR512_3GN_KEYS_POLL_INTERVAL
,
102 ARRAY_SIZE(wr512_3gn_gpio_buttons
),
103 wr512_3gn_gpio_buttons
);
104 rt305x_register_wifi();
105 rt305x_register_wdt();
106 rt305x_register_usb();
109 MIPS_MACHINE(RAMIPS_MACH_WR512_3GN
, "WR512-3GN", "WR512-3GN-like router",