ar71xx: wndr4300: select GPIO_OUT functionality for LED GPIOs
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-wndr4300.c
index 715fb064fee4a6d5bad528c0a2c3cb16840e1770..a89b8b6827dafc11fd9a15f5a46641a028da6a3b 100644 (file)
@@ -2,6 +2,7 @@
  *  NETGEAR WNDR4300 board support
  *
  *  Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
+ *  Copyright (C) 2014 Ralph Perlich <rpsoft@arcor.de>
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License version 2 as published
@@ -14,6 +15,9 @@
 #include <linux/platform_device.h>
 #include <linux/ath9k_platform.h>
 #include <linux/ar8216_platform.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/platform/ar934x_nfc.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
 
 #include "machtypes.h"
 
 #define WNDR4300_GPIO_LED_POWER_GREEN  0
-#define WNDR4300_GPIO_LED_POWER_ORANGE 2
+#define WNDR4300_GPIO_LED_POWER_AMBER  2
 #define WNDR4300_GPIO_LED_USB          13
 #define WNDR4300_GPIO_LED_WAN_GREEN    1
-#define WNDR4300_GPIO_LED_WAN_ORANGE   3
+#define WNDR4300_GPIO_LED_WAN_AMBER    3
 #define WNDR4300_GPIO_LED_WLAN5G       14
 #define WNDR4300_GPIO_LED_WPS_GREEN    16
-#define WNDR4300_GPIO_LED_WPS_ORANGE   17
+#define WNDR4300_GPIO_LED_WPS_AMBER    17
 
 #define WNDR4300_GPIO_BTN_RESET                21
 #define WNDR4300_GPIO_BTN_WIRELESS     15
@@ -50,8 +54,8 @@ static struct gpio_led wndr4300_leds_gpio[] __initdata = {
                .active_low     = 1,
        },
        {
-               .name           = "netgear:orange:power",
-               .gpio           = WNDR4300_GPIO_LED_POWER_ORANGE,
+               .name           = "netgear:amber:power",
+               .gpio           = WNDR4300_GPIO_LED_POWER_AMBER,
                .active_low     = 1,
        },
        {
@@ -60,8 +64,8 @@ static struct gpio_led wndr4300_leds_gpio[] __initdata = {
                .active_low     = 1,
        },
        {
-               .name           = "netgear:orange:wan",
-               .gpio           = WNDR4300_GPIO_LED_WAN_ORANGE,
+               .name           = "netgear:amber:wan",
+               .gpio           = WNDR4300_GPIO_LED_WAN_AMBER,
                .active_low     = 1,
        },
        {
@@ -75,8 +79,8 @@ static struct gpio_led wndr4300_leds_gpio[] __initdata = {
                .active_low     = 1,
        },
        {
-               .name           = "netgear:orange:wps",
-               .gpio           = WNDR4300_GPIO_LED_WPS_ORANGE,
+               .name           = "netgear:amber:wps",
+               .gpio           = WNDR4300_GPIO_LED_WPS_AMBER,
                .active_low     = 1,
        },
        {
@@ -151,6 +155,12 @@ static struct mdio_board_info wndr4300_mdio0_info[] = {
 
 static void __init wndr4300_setup(void)
 {
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(wndr4300_leds_gpio); i++)
+               ath79_gpio_output_select(wndr4300_leds_gpio[i].gpio,
+                                        AR934X_GPIO_OUT_GPIO);
+
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wndr4300_leds_gpio),
                                 wndr4300_leds_gpio);
        ath79_register_gpio_keys_polled(-1, WNDR4300_KEYS_POLL_INTERVAL,
@@ -171,6 +181,7 @@ static void __init wndr4300_setup(void)
        ath79_eth0_pll_data.pll_1000 = 0x06000000;
        ath79_register_eth(0);
 
+       ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW);
        ath79_register_nfc();
        ath79_register_usb();