ramips: properly setup the FEATURES variable
[openwrt.git] / target / linux / ramips / files-3.7 / arch / mips / ralink / rt305x / mach-psr-680w.c
1 /*
2  *  Petatel PSR-680W Wireless 3G Router support
3  *
4  *  Copyright (C) 2012 Dmitry Shmygov <shmygov@rambler.ru>
5  *
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.
9  */
10
11 #include <linux/init.h>
12 #include <linux/platform_device.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
20 #include "devices.h"
21
22 #define PSR_680W_GPIO_BUTTON_RESET      0       /* active low */
23
24 #define PSR_680W_GPIO_LED_STATUS        19
25
26 #define PSR_680W_KEYS_POLL_INTERVAL     20
27 #define PSR_680W_KEYS_DEBOUNCE_INTERVAL (3 * PSR_680W_KEYS_POLL_INTERVAL)
28
29
30 static struct gpio_led psr_680w_leds_gpio[] __initdata = {
31         {
32                 .name           = "psr-680w:red:wan",
33                 .gpio           = PSR_680W_GPIO_LED_STATUS,
34                 .active_low     = 1,
35         }
36 };
37
38 static struct gpio_keys_button psr_680w_gpio_buttons[] __initdata = {
39         {
40                 .desc           = "reset",
41                 .type           = EV_KEY,
42                 .code           = KEY_RESTART,
43                 .debounce_interval = PSR_680W_KEYS_DEBOUNCE_INTERVAL,
44                 .gpio           = PSR_680W_GPIO_BUTTON_RESET,
45                 .active_low     = 1,
46         }
47 };
48
49 static void __init psr_680w_init(void)
50 {
51         rt305x_gpio_init((RT305X_GPIO_MODE_I2S_UARTF << RT305X_GPIO_MODE_UART0_SHIFT) |
52                                 RT305X_GPIO_MODE_SPI |
53                                 RT305X_GPIO_MODE_JTAG |
54                                 RT305X_GPIO_MODE_MDIO |
55                                 RT305X_GPIO_MODE_RGMII);
56
57         rt305x_register_flash(0);
58
59         rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
60         rt305x_register_ethernet();
61         ramips_register_gpio_leds(-1, ARRAY_SIZE(psr_680w_leds_gpio),
62                                   psr_680w_leds_gpio);
63         ramips_register_gpio_buttons(-1, PSR_680W_KEYS_POLL_INTERVAL,
64                                      ARRAY_SIZE(psr_680w_gpio_buttons),
65                                      psr_680w_gpio_buttons);
66         rt305x_register_wifi();
67         rt305x_register_wdt();
68         rt305x_register_usb();
69 }
70
71 MIPS_MACHINE(RAMIPS_MACH_PSR_680W, "PSR-680W",
72              "Petatel PSR-680W Wireless 3G Router",
73              psr_680w_init);