2 * AirLive Air3GII board support
4 * Copyright (C) 2012 Cezary Jackiewicz <cezary.jackiewicz@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.
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
17 #include <asm/mach-ralink/machine.h>
18 #include <asm/mach-ralink/dev-gpio-buttons.h>
19 #include <asm/mach-ralink/dev-gpio-leds.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
25 #define AIR3GII_GPIO_BUTTON_WPS 7
27 #define AIR3GII_GPIO_LED_WLAN 8
28 #define AIR3GII_GPIO_LED_MOBILE 9
30 #define AIR3GII_KEYS_POLL_INTERVAL 20
31 #define AIR3GII_KEYS_DEBOUNCE_INTERVAL (3 * AIR3GII_KEYS_POLL_INTERVAL)
33 const struct flash_platform_data air3gii_flash
= {
37 struct spi_board_info air3gii_spi_slave_info
[] __initdata
= {
40 .platform_data
= &air3gii_flash
,
42 .max_speed_hz
= 10000000,
48 static struct gpio_led air3gii_leds_gpio
[] __initdata
= {
50 .name
= "airlive:green:wlan",
51 .gpio
= AIR3GII_GPIO_LED_WLAN
,
54 .name
= "airlive:green:mobile",
55 .gpio
= AIR3GII_GPIO_LED_MOBILE
,
60 static struct gpio_keys_button air3gii_gpio_buttons
[] __initdata
= {
64 .code
= KEY_WPS_BUTTON
,
65 .debounce_interval
= AIR3GII_KEYS_DEBOUNCE_INTERVAL
,
66 .gpio
= AIR3GII_GPIO_BUTTON_WPS
,
71 static void __init
air3gii_init(void)
73 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
75 rt305x_register_spi(air3gii_spi_slave_info
,
76 ARRAY_SIZE(air3gii_spi_slave_info
));
78 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_LLLLW
;
79 rt305x_register_ethernet();
81 ramips_register_gpio_leds(-1, ARRAY_SIZE(air3gii_leds_gpio
),
84 ramips_register_gpio_buttons(-1, AIR3GII_KEYS_POLL_INTERVAL
,
85 ARRAY_SIZE(air3gii_gpio_buttons
),
86 air3gii_gpio_buttons
);
88 rt305x_register_wifi();
89 rt305x_register_wdt();
90 rt305x_register_usb();
93 MIPS_MACHINE(RAMIPS_MACH_AIR3GII
, "AIR3GII", "AirLive Air3GII",