Root/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w306r-v20.c

1/*
2 * Tenda W306R V2.0 board support
3 *
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation.
8 */
9
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/ethtool.h>
13
14#include <asm/mach-ralink/machine.h>
15#include <asm/mach-ralink/dev-gpio-buttons.h>
16#include <asm/mach-ralink/dev-gpio-leds.h>
17#include <asm/mach-ralink/rt305x.h>
18#include <asm/mach-ralink/rt305x_regs.h>
19#include <asm/mach-ralink/ramips_eth_platform.h>
20
21#include "devices.h"
22
23#define W306R_V20_GPIO_LED_SYS 9
24#define W306R_V20_GPIO_LED_WPS 13
25
26#define W306R_V20_GPIO_BUTTON_RESET 10
27
28#define W306R_V20_KEYS_POLL_INTERVAL 20
29#define W306R_V20_KEYS_DEBOUNCE_INTERVAL (3 * W306R_V20_KEYS_POLL_INTERVAL)
30
31static struct gpio_led w306r_v20_leds_gpio[] __initdata = {
32    {
33        .name = "w306r-v20:green:sys",
34        .gpio = W306R_V20_GPIO_LED_SYS,
35        .active_low = 1,
36    }, {
37        .name = "w306r-v20:green:wps",
38        .gpio = W306R_V20_GPIO_LED_WPS,
39        .active_low = 1,
40    }
41};
42
43static struct gpio_keys_button w306r_v20_gpio_buttons[] __initdata = {
44    {
45        .desc = "RESET/WPS",
46        .type = EV_KEY,
47        .code = KEY_RESTART,
48        .debounce_interval = W306R_V20_KEYS_DEBOUNCE_INTERVAL,
49        .gpio = W306R_V20_GPIO_BUTTON_RESET,
50        .active_low = 1,
51    }
52};
53
54static void __init w306r_v20_init(void)
55{
56    rt305x_register_flash(0);
57
58    rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
59
60    rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
61    rt305x_register_ethernet();
62    ramips_register_gpio_leds(-1, ARRAY_SIZE(w306r_v20_leds_gpio),
63                  w306r_v20_leds_gpio);
64    ramips_register_gpio_buttons(-1, W306R_V20_KEYS_POLL_INTERVAL,
65                     ARRAY_SIZE(w306r_v20_gpio_buttons),
66                     w306r_v20_gpio_buttons);
67    rt305x_register_wifi();
68    rt305x_register_wdt();
69}
70
71MIPS_MACHINE(RAMIPS_MACH_W306R_V20, "W306R_V20", "Tenda W306R V2.0",
72         w306r_v20_init);
73

Archive Download this file



interactive