2 * Edimax 3g-6200n board support
4 * Copyright (C) 2011 Andrzej Hajda <andrzej.hajda@wp.pl>
5 * Copyright (C) 2012 Lukasz Golebiowski <lgolebio@gmail.com>
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.
13 #include <linux/init.h>
14 #include <linux/platform_device.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 EDIMAX_GPIO_BUTTON_WPS 12
25 #define EDIMAX_GPIO_BTN_0 13 /* Wifi on/off switch button */
27 #define EDIMAX_GPIO_LED_POWER 9
28 #define EDIMAX_GPIO_LED_WLAN 14
29 #define EDIMAX_GPIO_LED_3G 7
31 #define EDIMAX_KEYS_POLL_INTERVAL 20
32 #define EDIMAX_KEYS_DEBOUNCE_INTERVAL (3 * EDIMAX_KEYS_POLL_INTERVAL)
34 static struct gpio_led edimax_leds_gpio[] __initdata = {
36 .name = "edimax:green:power",
37 .gpio = EDIMAX_GPIO_LED_POWER,
40 .name = "edimax:amber:wlan",
41 .gpio = EDIMAX_GPIO_LED_WLAN,
44 .name = "edimax:blue:3g",
45 .gpio = EDIMAX_GPIO_LED_3G,
50 static struct gpio_keys_button edimax_gpio_buttons[] __initdata = {
54 .code = KEY_WPS_BUTTON,
55 .debounce_interval = EDIMAX_KEYS_DEBOUNCE_INTERVAL,
56 .gpio = EDIMAX_GPIO_BUTTON_WPS,
62 .debounce_interval = EDIMAX_KEYS_DEBOUNCE_INTERVAL,
63 .gpio = EDIMAX_GPIO_BTN_0,
68 static void __init edimax_init(void)
70 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
72 rt305x_register_flash(0);
73 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
74 rt305x_register_ethernet();
75 ramips_register_gpio_leds(-1, ARRAY_SIZE(edimax_leds_gpio),
77 ramips_register_gpio_buttons(-1, EDIMAX_KEYS_POLL_INTERVAL,
78 ARRAY_SIZE(edimax_gpio_buttons),
80 rt305x_register_wifi();
81 rt305x_register_wdt();
82 rt305x_register_usb();
85 MIPS_MACHINE(RAMIPS_MACH_3G_6200N, "3G-6200N", "Edimax 3g-6200n",