2 * UR-326N4G board support
4 * Copyright (C) 2013 Dmitry Lebedev <Lebedev@upvel.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>
23 #define UR_326N4G_GPIO_LED_3G 9
24 #define UR_326N4G_GPIO_LED_GATEWAY 11
25 #define UR_326N4G_GPIO_LED_AP 12
26 #define UR_326N4G_GPIO_LED_STATION 13
27 #define UR_326N4G_GPIO_LED_WPS 14
29 #define UR_326N4G_GPIO_BUTTON_RESET 10
30 #define UR_326N4G_GPIO_BUTTON_CONNECT 7
31 #define UR_326N4G_GPIO_BUTTON_WPS 0
32 #define UR_326N4G_GPIO_BUTTON_WPS2 8
34 #define UR_326N4G_KEYS_POLL_INTERVAL 20
35 #define UR_326N4G_KEYS_DEBOUNCE_INTERVAL (3 * UR_326N4G_KEYS_POLL_INTERVAL)
37 static struct gpio_led UR_326N4G_leds_gpio
[] __initdata
= {
39 .name
= "ur326:green:3g",
40 .gpio
= UR_326N4G_GPIO_LED_3G
,
43 .name
= "ur326:green:gateway",
44 .gpio
= UR_326N4G_GPIO_LED_GATEWAY
,
47 .name
= "ur326:green:ap",
48 .gpio
= UR_326N4G_GPIO_LED_AP
,
51 .name
= "ur326:green:wps",
52 .gpio
= UR_326N4G_GPIO_LED_WPS
,
55 .name
= "ur326:green:station",
56 .gpio
= UR_326N4G_GPIO_LED_STATION
,
61 static struct gpio_keys_button UR_326N4G_gpio_buttons
[] __initdata
= {
66 .debounce_interval
= UR_326N4G_KEYS_DEBOUNCE_INTERVAL
,
67 .gpio
= UR_326N4G_GPIO_BUTTON_RESET
,
73 .debounce_interval
= UR_326N4G_KEYS_DEBOUNCE_INTERVAL
,
74 .gpio
= UR_326N4G_GPIO_BUTTON_CONNECT
,
79 #define UR_326N4G_GPIO_MODE \
80 ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
81 RT305X_GPIO_MODE_MDIO)
83 static void __init
UR_326N4G_init(void)
85 rt305x_gpio_init(UR_326N4G_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(UR_326N4G_leds_gpio
),
93 ramips_register_gpio_buttons(-1, UR_326N4G_KEYS_POLL_INTERVAL
,
94 ARRAY_SIZE(UR_326N4G_gpio_buttons
),
95 UR_326N4G_gpio_buttons
);
96 rt305x_register_wifi();
97 rt305x_register_wdt();
98 rt305x_register_usb();
101 MIPS_MACHINE(RAMIPS_MACH_UR_326N4G
, "UR-326N4G", "UR-326N4G Wireless N router",