wireguard-tools: add tunlink option for hostroute
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-wnr2000-v3.c
index 8f585fb74b0058f5006d1324c2b64b2ed00cc7be..76c9cb99c9bb94de216f7239738e9f8d9a76f736 100644 (file)
@@ -80,7 +80,7 @@
 #define WNR1000V2_GPIO_WMAC_BTN_RESET          7
 #define WNR1000V2_GPIO_WMAC_BTN_RFKILL         8
 
-/* Connected through AR7240 */
+/* WPN824N - connected through AR7240 */
 #define WPN824N_GPIO_LED_WAN_AMBER     0
 #define WPN824N_GPIO_LED_STATUS_AMBER  1
 #define WPN824N_GPIO_LED_LAN1_AMBER    6 /* AR724X_GPIO_FUNC_JTAG_DISABLE */
 #define WPN824N_GPIO_LED_LAN4_GREEN    16
 #define WPN824N_GPIO_LED_WAN_GREEN     17
 
-/* Connected through AR9285 */
+/* WPN824N - connected through AR9285 */
 #define WPN824N_WGPIO_LED_PWR_GREEN    0
 #define WPN824N_WGPIO_LED_WLAN_BLUE    1
 #define WPN824N_WGPIO_LED_WPS1_BLUE    5
 #define WPN824N_WGPIO_LED_WPS2_BLUE    9
 #define WPN824N_WGPIO_LED_TEST_AMBER   10
-#define WPN824N_WGPIO_BTN_PUSH         6       /* currently unused */
-#define WPN824N_WGPIO_BTN_RESET                7       /* currently unused */
-#define WPN824N_WGPIO_BTN_WLAN         8       /* currently unused */
+#define WPN824N_WGPIO_BTN_WPS          6
+#define WPN824N_WGPIO_BTN_RESET                7
+#define WPN824N_WGPIO_BTN_WLAN         8
 
 #define WNR2000V3_KEYS_POLL_INTERVAL   20      /* msecs */
 #define WNR2000V3_KEYS_DEBOUNCE_INTERVAL       (3 * WNR2000V3_KEYS_POLL_INTERVAL)
@@ -170,12 +170,13 @@ static struct gpio_led wnr2000v3_wmac_leds_gpio[] = {
                .name           = "netgear:amber:test",
                .gpio           = WNR2000V3_GPIO_WMAC_LED_TEST_AMBER,
                .active_low     = 1,
+       }, {
+               .name           = "netgear:blue:wlan",
+               .gpio           = WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE,
+               .active_low     = 1,
        }
 };
 
-/* Blue WLAN LED for: WNR2000v3, WNR1000v2 */
-static const char *wnr2000v3_wmac_led_name = "netgear:blue:wlan";
-
 static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
        {
                .name           = "netgear:green:power",
@@ -196,7 +197,13 @@ static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
        }
 };
 
-static const char *wnr612v2_wmac_led_name = "netgear:green:wlan";
+static struct gpio_led wnr612v2_wmac_leds_gpio[] = {
+       {
+               .name           = "netgear:green:wlan",
+               .gpio           = WNR612V2_GPIO_WMAC_LED_WLAN_GREEN,
+               .active_low     = 1,
+       }
+};
 
 static struct gpio_led wnr1000v2_leds_gpio[] __initdata = {
        {
@@ -255,6 +262,10 @@ static struct gpio_led wnr1000v2_wmac_leds_gpio[] = {
                .name           = "netgear:green:wps",
                .gpio           = WNR1000V2_GPIO_WMAC_LED_WPS_GREEN,
                .active_low     = 1,
+       }, {
+               .name           = "netgear:blue:wlan",
+               .gpio           = WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE,
+               .active_low     = 1,
        }
 };
 
@@ -311,10 +322,6 @@ static struct gpio_led wpn824n_wmac_leds_gpio[] = {
                .name           = "netgear:green:power",
                .gpio           = WPN824N_WGPIO_LED_PWR_GREEN,
                .active_low     = 1,
-       }, {
-               .name           = "netgear:blue:wlan",
-               .gpio           = WPN824N_WGPIO_LED_WLAN_BLUE,
-               .active_low     = 1,
        }, {
                .name           = "netgear:blue:wps1",
                .gpio           = WPN824N_WGPIO_LED_WPS1_BLUE,
@@ -327,6 +334,10 @@ static struct gpio_led wpn824n_wmac_leds_gpio[] = {
                .name           = "netgear:amber:test",
                .gpio           = WPN824N_WGPIO_LED_TEST_AMBER,
                .active_low     = 1,
+       }, {
+               .name           = "netgear:blue:wlan",
+               .gpio           = WPN824N_WGPIO_LED_WLAN_BLUE,
+               .active_low     = 1,
        }
 };
 
@@ -395,6 +406,31 @@ static struct gpio_keys_button wnr1000v2_wmac_keys_gpio[] = {
        }
 };
 
+static struct gpio_keys_button wpn824n_wmac_keys_gpio[] = {
+       {
+               .desc                   = "reset",
+               .type                   = EV_KEY,
+               .code                   = KEY_RESTART,
+               .debounce_interval      = WNR2000V3_KEYS_DEBOUNCE_INTERVAL,
+               .gpio                   = WPN824N_WGPIO_BTN_RESET,
+               .active_low             = 1,
+       }, {
+               .desc                   = "rfkill",
+               .type                   = EV_KEY,
+               .code                   = KEY_RFKILL,
+               .debounce_interval      = WNR2000V3_KEYS_DEBOUNCE_INTERVAL,
+               .gpio                   = WPN824N_WGPIO_BTN_WLAN,
+               .active_low             = 1,
+       }, {
+               .desc                   = "wps",
+               .type                   = EV_KEY,
+               .code                   = KEY_WPS_BUTTON,
+               .debounce_interval      = WNR2000V3_KEYS_DEBOUNCE_INTERVAL,
+               .gpio                   = WPN824N_WGPIO_BTN_WPS,
+               .active_low             = 1,
+       }
+};
+
 /*
  * For WNR2000v3 ART flash area used for WLAN MAC is usually empty (0xff)
  * so ath9k driver uses random MAC instead each time module is loaded.
@@ -483,9 +519,6 @@ static void __init wnr2000v3_setup(void)
                                        ARRAY_SIZE(wnr2000v3_keys_gpio),
                                        wnr2000v3_keys_gpio);
 
-       ap9x_pci_setup_wmac_led_pin(0, WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE);
-       ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
-
        ap9x_pci_setup_wmac_leds(0, wnr2000v3_wmac_leds_gpio,
                                 ARRAY_SIZE(wnr2000v3_wmac_leds_gpio));
 
@@ -527,14 +560,8 @@ static void __init wnr612v2_setup(void)
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr612v2_leds_gpio),
                                 wnr612v2_leds_gpio);
 
-       /*
-        * This device has no buttons on AR7241 GPIO and no extra LEDs
-        * connected to AR9285 so setup is simpler than for WNR2000v3.
-        */
-       ap9x_pci_setup_wmac_led_pin(0, WNR612V2_GPIO_WMAC_LED_WLAN_GREEN);
-       ap9x_pci_setup_wmac_led_name(0, wnr612v2_wmac_led_name);
-
-       ap9x_pci_setup_wmac_leds(0, NULL, 0);
+       ap9x_pci_setup_wmac_leds(0, wnr612v2_wmac_leds_gpio,
+                                ARRAY_SIZE(wnr612v2_wmac_leds_gpio));
 
        ap9x_pci_setup_wmac_btns(0, wnr612v2_wmac_keys_gpio,
                                 ARRAY_SIZE(wnr612v2_wmac_keys_gpio),
@@ -574,9 +601,6 @@ static void __init wnr1000v2_setup(void)
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr1000v2_leds_gpio),
                                 wnr1000v2_leds_gpio);
 
-       ap9x_pci_setup_wmac_led_pin(0, WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE);
-       ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
-
        ap9x_pci_setup_wmac_leds(0, wnr1000v2_wmac_leds_gpio,
                                 ARRAY_SIZE(wnr1000v2_wmac_leds_gpio));
 
@@ -603,9 +627,11 @@ static void __init wpn824n_setup(void)
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wpn824n_leds_gpio),
                                 wpn824n_leds_gpio);
 
-       ap9x_pci_setup_wmac_led_pin(0, WPN824N_WGPIO_LED_WLAN_BLUE);
        ap9x_pci_setup_wmac_leds(0, wpn824n_wmac_leds_gpio,
                                 ARRAY_SIZE(wpn824n_wmac_leds_gpio));
+       ap9x_pci_setup_wmac_btns(0, wpn824n_wmac_keys_gpio,
+                                ARRAY_SIZE(wpn824n_wmac_keys_gpio),
+                                WNR2000V3_KEYS_POLL_INTERVAL);
 }
 
 MIPS_MACHINE(ATH79_MACH_WPN824N, "WPN824N", "NETGEAR WPN824N", wpn824n_setup);