Root/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c

1/*
2 * Argus ATP-52B router support
3 * http://www.argus-co.com/english/productsview.php?id=70&cid=81
4 *
5 * Copyright (C) 2011 Roman Yeryomin <roman@advem.lv>
6 *
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.
10 */
11
12#include <linux/init.h>
13#include <linux/platform_device.h>
14
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>
20
21#include "devices.h"
22
23#define ARGUS_ATP52B_GPIO_LED_RUN 9
24#define ARGUS_ATP52B_GPIO_LED_NET 13
25#define ARGUS_ATP52B_GPIO_BUTTON_WPS 0
26#define ARGUS_ATP52B_GPIO_BUTTON_RESET 10
27#define ARGUS_ATP52B_KEYS_POLL_INTERVAL 20
28#define ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL (3 * ARGUS_ATP52B_KEYS_POLL_INTERVAL)
29
30static struct gpio_led argus_atp52b_leds_gpio[] __initdata = {
31    {
32        .name = "argus-atp52b:green:run",
33        .gpio = ARGUS_ATP52B_GPIO_LED_RUN,
34        .active_low = 1,
35    },
36    {
37        .name = "argus-atp52b:amber:net",
38        .gpio = ARGUS_ATP52B_GPIO_LED_NET,
39        .active_low = 1,
40    }
41};
42
43static struct gpio_keys_button argus_atp52b_gpio_buttons[] __initdata = {
44    {
45        .desc = "wps",
46        .type = EV_KEY,
47        .code = KEY_WPS_BUTTON,
48        .debounce_interval = ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL,
49        .gpio = ARGUS_ATP52B_GPIO_BUTTON_WPS,
50        .active_low = 1,
51    },
52    {
53        .desc = "reset",
54        .type = EV_KEY,
55        .code = KEY_RESTART,
56        .debounce_interval = ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL,
57        .gpio = ARGUS_ATP52B_GPIO_BUTTON_RESET,
58        .active_low = 1,
59    }
60};
61
62static void __init argus_atp52b_init(void)
63{
64    rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
65
66    rt305x_register_flash(0);
67
68    ramips_register_gpio_leds(-1, ARRAY_SIZE(argus_atp52b_leds_gpio),
69                    argus_atp52b_leds_gpio);
70    ramips_register_gpio_buttons(-1, ARGUS_ATP52B_KEYS_POLL_INTERVAL,
71                    ARRAY_SIZE(argus_atp52b_gpio_buttons),
72                    argus_atp52b_gpio_buttons);
73    rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
74    rt305x_register_ethernet();
75    rt305x_register_wifi();
76    rt305x_register_wdt();
77    rt305x_register_usb();
78}
79
80MIPS_MACHINE(RAMIPS_MACH_ARGUS_ATP52B, "ARGUS_ATP52B", "Argus ATP-52B",
81                    argus_atp52b_init);
82

Archive Download this file



interactive