aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-10-14 10:33:07 +0000
committerJohn Crispin <john@openwrt.org>2014-10-14 10:33:07 +0000
commit99c238ff15ddfbdb16c82e3b219ada67c02e0a0f (patch)
tree4bcff11adbe5ae8a2aab87b29c0b39a24061481b
parent28d57f707d09d0bd085f82d2bb4188ea3ee7a13c (diff)
downloadupstream-99c238ff15ddfbdb16c82e3b219ada67c02e0a0f.tar.gz
upstream-99c238ff15ddfbdb16c82e3b219ada67c02e0a0f.tar.bz2
upstream-99c238ff15ddfbdb16c82e3b219ada67c02e0a0f.zip
ar71xx: Fix LED definitions for the DRAGINO2 board
This patch fixes LED definitions for the DRAGINO2 board. 1. It renames the Router/USB led to System, as it is now marked "SYS" on the board. 2. It gives control of the LAN and WAN leds and some other GPIOs to Linux. 3. It fixes the active_low property for the LAN and WAN leds. 4. It sets up WLAN, LAN and WAN leds in the UCI defaults. 5. It allows usage of the System led by the diag.sh script, so it will be used to indicate boot and failsafe status. Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net> SVN-Revision: 42897
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/diag.sh3
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/01_leds6
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c43
3 files changed, 35 insertions, 17 deletions
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index ac7e20d7f0..bbe04b51ee 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -62,6 +62,9 @@ get_status_led() {
dir-835-a1)
status_led="d-link:amber:power"
;;
+ dragino2)
+ status_led="dragino2:red:system"
+ ;;
eap300v2)
status_led="engenius:blue:power"
;;
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index aca8509c6b..599fc1920b 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -66,6 +66,12 @@ db120)
ucidef_set_led_usbdev "usb" "USB" "db120:green:usb" "1-1"
;;
+dragino2)
+ ucidef_set_led_wlan "wlan" "WLAN" "dragino2:red:wlan" "phy0tpt"
+ ucidef_set_led_netdev "lan" "LAN" "dragino2:red:lan" "eth0"
+ ucidef_set_led_netdev "wan" "WAN" "dragino2:red:wan" "eth1"
+ ;;
+
eap300v2)
ucidef_set_led_netdev "lan" "LAN" "engenius:blue:lan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "engenius:blue:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c
index 156fbe50eb..95bd6f41a3 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2012 Elektra Wagenrad <elektra@villagetelco.org>
+ * Copyright (C) 2014 Vittorio Gambaletta <openwrt@vittgam.net>
*
* 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
@@ -27,12 +28,12 @@
#define DRAGINO2_GPIO_LED_WAN 17
/*
- * The following GPIO is actually named "Router" on the board.
- * However, since the "Router" feature is not supported as of yet
- * we use it to display USB activity.
+ * The following GPIO is named "SYS" on newer revisions of the the board.
+ * It was previously used to indicate USB activity, even though it was
+ * named "Router".
*/
-#define DRAGINO2_GPIO_LED_USB 28
+#define DRAGINO2_GPIO_LED_SYS 28
#define DRAGINO2_GPIO_BTN_JUMPSTART 11
#define DRAGINO2_GPIO_BTN_RESET 12
@@ -46,23 +47,23 @@
static struct gpio_led dragino2_leds_gpio[] __initdata = {
{
- .name = "dragino2:red:lan",
- .gpio = DRAGINO2_GPIO_LED_LAN,
- .active_low = 0,
- },
- {
.name = "dragino2:red:wlan",
.gpio = DRAGINO2_GPIO_LED_WLAN,
.active_low = 0,
},
- {
+ {
.name = "dragino2:red:wan",
.gpio = DRAGINO2_GPIO_LED_WAN,
- .active_low = 0,
+ .active_low = 1,
},
{
- .name = "dragino2:red:usb",
- .gpio = DRAGINO2_GPIO_LED_USB,
+ .name = "dragino2:red:lan",
+ .gpio = DRAGINO2_GPIO_LED_LAN,
+ .active_low = 1,
+ },
+ {
+ .name = "dragino2:red:system",
+ .gpio = DRAGINO2_GPIO_LED_SYS,
.active_low = 0,
},
};
@@ -99,15 +100,23 @@ static void __init dragino2_common_setup(void)
ath79_register_mdio(0, 0x0);
- /* Enable GPIO15 and GPIO16 and possibly GPIO26 and GPIO27 */
- ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
- AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN);
+ /* Enable GPIO13, GPIO14, GPIO15, GPIO16 and GPIO17 */
+ ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
- /* LAN ports */
+ /* LAN port */
ath79_register_eth(1);
/* WAN port */
ath79_register_eth(0);
+
+ /* Enable GPIO26 and GPIO27 */
+ ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP,
+ ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP) |
+ AR933X_BOOTSTRAP_MDIO_GPIO_EN);
}
static void __init dragino2_setup(void)