2 * Asus WL_330N 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_330N_GPIO_BUTTON_RESET 10
25 #define WL_330N_GPIO_BUTTON_WPS 0
26 #define WL_330N_GPIO_LED_LINK 9
27 #define WL_330N_GPIO_LED_POWER 11
28 #define WL_330N_KEYS_POLL_INTERVAL 20
29 #define WL_330N_KEYS_DEBOUNCE_INTERVAL (3 * WL_330N_KEYS_POLL_INTERVAL)
31 const struct flash_platform_data wl_330n_flash = {
35 struct spi_board_info wl_330n_spi_slave_info[] __initdata = {
38 .platform_data = &wl_330n_flash,
40 .max_speed_hz = 10000000,
46 static struct gpio_keys_button wl_330n_gpio_buttons[] __initdata = {
51 .debounce_interval = WL_330N_KEYS_DEBOUNCE_INTERVAL,
52 .gpio = WL_330N_GPIO_BUTTON_RESET,
59 .debounce_interval = WL_330N_KEYS_DEBOUNCE_INTERVAL,
60 .gpio = WL_330N_GPIO_BUTTON_WPS,
65 static struct gpio_led wl_330n_leds_gpio[] __initdata = {
67 .name = "asus:blue:link",
68 .gpio = WL_330N_GPIO_LED_LINK,
71 .name = "asus:blue:power",
72 .gpio = WL_330N_GPIO_LED_POWER,
77 static void __init wl_330n_init(void)
79 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
80 rt305x_register_spi(wl_330n_spi_slave_info,
81 ARRAY_SIZE(wl_330n_spi_slave_info));
82 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
83 rt305x_register_ethernet();
84 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl_330n_leds_gpio),
86 ramips_register_gpio_buttons(-1, WL_330N_KEYS_POLL_INTERVAL,
87 ARRAY_SIZE(wl_330n_gpio_buttons),
88 wl_330n_gpio_buttons);
89 rt305x_register_wifi();
90 rt305x_register_wdt();
93 MIPS_MACHINE(RAMIPS_MACH_WL_330N, "WL_330N", "Asus WL-330N",