ar71xx: fix ethernet LEDs on the WHR-{G301N,HP-G300N,HP-GN} boards

SVN-Revision: 29978
This commit is contained in:
Gabor Juhos 2012-01-31 20:49:34 +00:00
parent c315ce403b
commit 41bd6bd282
3 changed files with 88 additions and 14 deletions

View file

@ -209,6 +209,16 @@ wndr3700)
set_led_usbdev "usb" "USB" "wndr3700:green:usb" "1-1" set_led_usbdev "usb" "USB" "wndr3700:green:usb" "1-1"
;; ;;
whr-g301n |\
whr-hp-g300n |\
whr-hp-gn)
set_led_netdev "wan" "WAN" "buffalo:green:wan" "eth1"
set_led_switch "lan1" "LAN1" "buffalo:green:lan1" "switch0" "0x02"
set_led_switch "lan2" "LAN2" "buffalo:green:lan2" "switch0" "0x04"
set_led_switch "lan3" "LAN3" "buffalo:green:lan3" "switch0" "0x08"
set_led_switch "lan4" "LAN4" "buffalo:green:lan4" "switch0" "0x10"
;;
wzr-hp-g300nh) wzr-hp-g300nh)
set_led_wlan "wlan" "Wireless" "buffalo:green:wireless" "phy0tpt" set_led_wlan "wlan" "Wireless" "buffalo:green:wireless" "phy0tpt"
set_led_netdev "router" "Router" "buffalo:green:router" "eth1" set_led_netdev "router" "Router" "buffalo:green:router" "eth1"

View file

@ -24,14 +24,19 @@
#include "dev-gpio-buttons.h" #include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h" #include "dev-leds-gpio.h"
#define WHRHPG300N_GPIO_LED_SECURITY 0 #define WHRHPG300N_GPIO_LED_SECURITY 0
#define WHRHPG300N_GPIO_LED_DIAG 1 #define WHRHPG300N_GPIO_LED_DIAG 1
#define WHRHPG300N_GPIO_LED_ROUTER 6 #define WHRHPG300N_GPIO_LED_ROUTER 6
#define WHRHPG300N_GPIO_BTN_ROUTER_ON 7 #define WHRHPG300N_GPIO_BTN_ROUTER_ON 7
#define WHRHPG300N_GPIO_BTN_ROUTER_AUTO 8 #define WHRHPG300N_GPIO_BTN_ROUTER_AUTO 8
#define WHRHPG300N_GPIO_BTN_RESET 11 #define WHRHPG300N_GPIO_BTN_RESET 11
#define WHRHPG300N_GPIO_BTN_AOSS 12 #define WHRHPG300N_GPIO_BTN_AOSS 12
#define WHRHPG300N_GPIO_LED_LAN1 13
#define WHRHPG300N_GPIO_LED_LAN2 14
#define WHRHPG300N_GPIO_LED_LAN3 15
#define WHRHPG300N_GPIO_LED_LAN4 16
#define WHRHPG300N_GPIO_LED_WAN 17
#define WHRHPG300N_KEYS_POLL_INTERVAL 20 /* msecs */ #define WHRHPG300N_KEYS_POLL_INTERVAL 20 /* msecs */
#define WHRHPG300N_KEYS_DEBOUNCE_INTERVAL (3 * WHRHPG300N_KEYS_POLL_INTERVAL) #define WHRHPG300N_KEYS_DEBOUNCE_INTERVAL (3 * WHRHPG300N_KEYS_POLL_INTERVAL)
@ -95,6 +100,26 @@ static struct gpio_led whrhpg300n_leds_gpio[] __initdata = {
.name = "buffalo:green:router", .name = "buffalo:green:router",
.gpio = WHRHPG300N_GPIO_LED_ROUTER, .gpio = WHRHPG300N_GPIO_LED_ROUTER,
.active_low = 1, .active_low = 1,
}, {
.name = "buffalo:green:wan",
.gpio = WHRHPG300N_GPIO_LED_WAN,
.active_low = 1,
}, {
.name = "buffalo:green:lan1",
.gpio = WHRHPG300N_GPIO_LED_LAN1,
.active_low = 1,
}, {
.name = "buffalo:green:lan2",
.gpio = WHRHPG300N_GPIO_LED_LAN2,
.active_low = 1,
}, {
.name = "buffalo:green:lan3",
.gpio = WHRHPG300N_GPIO_LED_LAN3,
.active_low = 1,
}, {
.name = "buffalo:green:lan4",
.gpio = WHRHPG300N_GPIO_LED_LAN4,
.active_low = 1,
} }
}; };
@ -137,6 +162,12 @@ static void __init whrhpg300n_setup(void)
ar71xx_add_device_m25p80(&whrhpg300n_flash_data); ar71xx_add_device_m25p80(&whrhpg300n_flash_data);
ar71xx_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(whrhpg300n_leds_gpio), ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(whrhpg300n_leds_gpio),
whrhpg300n_leds_gpio); whrhpg300n_leds_gpio);

View file

@ -16,7 +16,9 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <asm/mach-ath79/ath79.h> #include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.h"
#include "dev-ap9x-pci.h" #include "dev-ap9x-pci.h"
#include "dev-eth.h" #include "dev-eth.h"
#include "dev-gpio-buttons.h" #include "dev-gpio-buttons.h"
@ -24,14 +26,19 @@
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "machtypes.h" #include "machtypes.h"
#define WHRHPG300N_GPIO_LED_SECURITY 0 #define WHRHPG300N_GPIO_LED_SECURITY 0
#define WHRHPG300N_GPIO_LED_DIAG 1 #define WHRHPG300N_GPIO_LED_DIAG 1
#define WHRHPG300N_GPIO_LED_ROUTER 6 #define WHRHPG300N_GPIO_LED_ROUTER 6
#define WHRHPG300N_GPIO_BTN_ROUTER_ON 7 #define WHRHPG300N_GPIO_BTN_ROUTER_ON 7
#define WHRHPG300N_GPIO_BTN_ROUTER_AUTO 8 #define WHRHPG300N_GPIO_BTN_ROUTER_AUTO 8
#define WHRHPG300N_GPIO_BTN_RESET 11 #define WHRHPG300N_GPIO_BTN_RESET 11
#define WHRHPG300N_GPIO_BTN_AOSS 12 #define WHRHPG300N_GPIO_BTN_AOSS 12
#define WHRHPG300N_GPIO_LED_LAN1 13
#define WHRHPG300N_GPIO_LED_LAN2 14
#define WHRHPG300N_GPIO_LED_LAN3 15
#define WHRHPG300N_GPIO_LED_LAN4 16
#define WHRHPG300N_GPIO_LED_WAN 17
#define WHRHPG300N_KEYS_POLL_INTERVAL 20 /* msecs */ #define WHRHPG300N_KEYS_POLL_INTERVAL 20 /* msecs */
#define WHRHPG300N_KEYS_DEBOUNCE_INTERVAL (3 * WHRHPG300N_KEYS_POLL_INTERVAL) #define WHRHPG300N_KEYS_DEBOUNCE_INTERVAL (3 * WHRHPG300N_KEYS_POLL_INTERVAL)
@ -91,6 +98,26 @@ static struct gpio_led whrhpg300n_leds_gpio[] __initdata = {
.name = "buffalo:green:router", .name = "buffalo:green:router",
.gpio = WHRHPG300N_GPIO_LED_ROUTER, .gpio = WHRHPG300N_GPIO_LED_ROUTER,
.active_low = 1, .active_low = 1,
}, {
.name = "buffalo:green:wan",
.gpio = WHRHPG300N_GPIO_LED_WAN,
.active_low = 1,
}, {
.name = "buffalo:green:lan1",
.gpio = WHRHPG300N_GPIO_LED_LAN1,
.active_low = 1,
}, {
.name = "buffalo:green:lan2",
.gpio = WHRHPG300N_GPIO_LED_LAN2,
.active_low = 1,
}, {
.name = "buffalo:green:lan3",
.gpio = WHRHPG300N_GPIO_LED_LAN3,
.active_low = 1,
}, {
.name = "buffalo:green:lan4",
.gpio = WHRHPG300N_GPIO_LED_LAN4,
.active_low = 1,
} }
}; };
@ -133,6 +160,12 @@ static void __init whrhpg300n_setup(void)
ath79_register_m25p80(&whrhpg300n_flash_data); ath79_register_m25p80(&whrhpg300n_flash_data);
ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
ath79_register_leds_gpio(-1, ARRAY_SIZE(whrhpg300n_leds_gpio), ath79_register_leds_gpio(-1, ARRAY_SIZE(whrhpg300n_leds_gpio),
whrhpg300n_leds_gpio); whrhpg300n_leds_gpio);