ar71xx: fix button polarity on TL-WR703N and TL-WR741N v4
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-aw-nr580.c
1 /*
2 * AzureWave AW-NR580 board support
3 *
4 * Copyright (C) 2008-2012 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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 <asm/mach-ath79/ath79.h>
13
14 #include "dev-eth.h"
15 #include "dev-m25p80.h"
16 #include "dev-gpio-buttons.h"
17 #include "dev-leds-gpio.h"
18 #include "machtypes.h"
19 #include "pci.h"
20
21 #define AW_NR580_GPIO_LED_READY_RED 0
22 #define AW_NR580_GPIO_LED_WLAN 1
23 #define AW_NR580_GPIO_LED_READY_GREEN 2
24 #define AW_NR580_GPIO_LED_WPS_GREEN 4
25 #define AW_NR580_GPIO_LED_WPS_AMBER 5
26
27 #define AW_NR580_GPIO_BTN_WPS 3
28 #define AW_NR580_GPIO_BTN_RESET 11
29
30 #define AW_NR580_KEYS_POLL_INTERVAL 20 /* msecs */
31 #define AW_NR580_KEYS_DEBOUNCE_INTERVAL (3 * AW_NR580_KEYS_POLL_INTERVAL)
32
33 static struct gpio_led aw_nr580_leds_gpio[] __initdata = {
34 {
35 .name = "aw-nr580:red:ready",
36 .gpio = AW_NR580_GPIO_LED_READY_RED,
37 .active_low = 0,
38 }, {
39 .name = "aw-nr580:green:ready",
40 .gpio = AW_NR580_GPIO_LED_READY_GREEN,
41 .active_low = 0,
42 }, {
43 .name = "aw-nr580:green:wps",
44 .gpio = AW_NR580_GPIO_LED_WPS_GREEN,
45 .active_low = 0,
46 }, {
47 .name = "aw-nr580:amber:wps",
48 .gpio = AW_NR580_GPIO_LED_WPS_AMBER,
49 .active_low = 0,
50 }, {
51 .name = "aw-nr580:green:wlan",
52 .gpio = AW_NR580_GPIO_LED_WLAN,
53 .active_low = 0,
54 }
55 };
56
57 static struct gpio_keys_button aw_nr580_gpio_keys[] __initdata = {
58 {
59 .desc = "reset",
60 .type = EV_KEY,
61 .code = KEY_RESTART,
62 .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
63 .gpio = AW_NR580_GPIO_BTN_RESET,
64 .active_low = 1,
65 }, {
66 .desc = "wps",
67 .type = EV_KEY,
68 .code = KEY_WPS_BUTTON,
69 .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
70 .gpio = AW_NR580_GPIO_BTN_WPS,
71 .active_low = 1,
72 }
73 };
74
75 static const char *aw_nr580_part_probes[] = {
76 "RedBoot",
77 NULL,
78 };
79
80 static struct flash_platform_data aw_nr580_flash_data = {
81 .part_probes = aw_nr580_part_probes,
82 };
83
84 static void __init aw_nr580_setup(void)
85 {
86 ath79_register_mdio(0, 0x0);
87
88 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
89 ath79_eth0_data.speed = SPEED_100;
90 ath79_eth0_data.duplex = DUPLEX_FULL;
91
92 ath79_register_eth(0);
93
94 ath79_register_pci();
95
96 ath79_register_m25p80(&aw_nr580_flash_data);
97
98 ath79_register_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio),
99 aw_nr580_leds_gpio);
100
101 ath79_register_gpio_keys_polled(-1, AW_NR580_KEYS_POLL_INTERVAL,
102 ARRAY_SIZE(aw_nr580_gpio_keys),
103 aw_nr580_gpio_keys);
104 }
105
106 MIPS_MACHINE(ATH79_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580",
107 aw_nr580_setup);
This page took 0.055662 seconds and 5 git commands to generate.