2 * Asus WL_330N3G board support
4 * Copyright (C) 2012 Frederic Leroy <fredo@starox.org>
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>
13 #include <linux/spi/spi.h>
14 #include <linux/spi/flash.h>
16 #include <asm/mach-ralink/machine.h>
17 #include <asm/mach-ralink/dev-gpio-buttons.h>
18 #include <asm/mach-ralink/dev-gpio-leds.h>
19 #include <asm/mach-ralink/rt305x.h>
20 #include <asm/mach-ralink/rt305x_regs.h>
24 #define WL_330N3G_GPIO_BUTTON_RESET 10
25 #define WL_330N3G_GPIO_BUTTON_WPS 0
26 #define WL_330N3G_GPIO_LED_3G_BLUE 9
27 #define WL_330N3G_GPIO_LED_3G_RED 13
28 #define WL_330N3G_GPIO_LED_POWER 11
29 #define WL_330N3G_KEYS_POLL_INTERVAL 20
30 #define WL_330N3G_KEYS_DEBOUNCE_INTERVAL (3 * WL_330N3G_KEYS_POLL_INTERVAL)
32 const struct flash_platform_data wl_330n3g_flash
= {
36 struct spi_board_info wl_330n3g_spi_slave_info
[] __initdata
= {
39 .platform_data
= &wl_330n3g_flash
,
41 .max_speed_hz
= 10000000,
47 static struct gpio_keys_button wl_330n3g_gpio_buttons
[] __initdata
= {
52 .debounce_interval
= WL_330N3G_KEYS_DEBOUNCE_INTERVAL
,
53 .gpio
= WL_330N3G_GPIO_BUTTON_RESET
,
60 .debounce_interval
= WL_330N3G_KEYS_DEBOUNCE_INTERVAL
,
61 .gpio
= WL_330N3G_GPIO_BUTTON_WPS
,
66 static struct gpio_led wl_330n3g_leds_gpio
[] __initdata
= {
68 .name
= "asus:blue:3g",
69 .gpio
= WL_330N3G_GPIO_LED_3G_BLUE
,
72 .name
= "asus:red:3g",
73 .gpio
= WL_330N3G_GPIO_LED_3G_RED
,
76 .name
= "asus:blue:power",
77 .gpio
= WL_330N3G_GPIO_LED_POWER
,
82 static void __init
wl_330n3g_init(void)
84 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
85 rt305x_register_spi(wl_330n3g_spi_slave_info
,
86 ARRAY_SIZE(wl_330n3g_spi_slave_info
));
87 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
88 rt305x_register_ethernet();
89 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl_330n3g_leds_gpio
),
91 ramips_register_gpio_buttons(-1, WL_330N3G_KEYS_POLL_INTERVAL
,
92 ARRAY_SIZE(wl_330n3g_gpio_buttons
),
93 wl_330n3g_gpio_buttons
);
94 rt305x_register_wifi();
95 rt305x_register_usb();
96 rt305x_register_wdt();
99 MIPS_MACHINE(RAMIPS_MACH_WL_330N3G
, "WL_330N3G", "Asus WL-330N3G",