2 * La Fonera20N board support
4 * Copyright (C) 2009 John Crispin <blogic@openwrt.org>
5 * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
15 #include <asm/mach-ralink/machine.h>
16 #include <asm/mach-ralink/dev-gpio-buttons.h>
17 #include <asm/mach-ralink/dev-gpio-leds.h>
18 #include <asm/mach-ralink/rt305x.h>
19 #include <asm/mach-ralink/rt305x_regs.h>
23 #define FONERA20N_GPIO_BUTTON_RESET 12
24 #define FONERA20N_GPIO_SWITCH 13
25 #define FONERA20N_GPIO_LED_WIFI 7
26 #define FONERA20N_GPIO_LED_POWER 9
27 #define FONERA20N_GPIO_LED_USB 14
29 #define FONERA20N_KEYS_POLL_INTERVAL 20
30 #define FONERA20N_KEYS_DEBOUNCE_INTERVAL (3 * FONERA20N_KEYS_POLL_INTERVAL)
32 static struct gpio_led fonera20n_leds_gpio
[] __initdata
= {
34 .name
= "fonera20n:orange:wifi",
35 .gpio
= FONERA20N_GPIO_LED_WIFI
,
38 .name
= "fonera20n:green:power",
39 .gpio
= FONERA20N_GPIO_LED_POWER
,
42 .name
= "fonera20n:orange:usb",
43 .gpio
= FONERA20N_GPIO_LED_USB
,
48 static struct gpio_keys_button fonera20n_gpio_buttons
[] __initdata
= {
53 .debounce_interval
= FONERA20N_KEYS_DEBOUNCE_INTERVAL
,
54 .gpio
= FONERA20N_GPIO_BUTTON_RESET
,
60 .debounce_interval
= FONERA20N_KEYS_DEBOUNCE_INTERVAL
,
61 .gpio
= FONERA20N_GPIO_SWITCH
,
66 static void __init
fonera20n_init(void)
68 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
70 rt305x_register_flash(0);
72 ramips_register_gpio_leds(-1, ARRAY_SIZE(fonera20n_leds_gpio
),
75 ramips_register_gpio_buttons(-1, FONERA20N_KEYS_POLL_INTERVAL
,
76 ARRAY_SIZE(fonera20n_gpio_buttons
),
77 fonera20n_gpio_buttons
);
79 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_LLLLW
;
80 rt305x_register_ethernet();
81 rt305x_register_wifi();
82 rt305x_register_wdt();
83 rt305x_register_usb();
86 MIPS_MACHINE(RAMIPS_MACH_FONERA20N
, "FONERA20N", "La Fonera 2.0N",