aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/atheros/files
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2008-04-03 21:09:41 +0000
committerJohn Crispin <john@openwrt.org>2008-04-03 21:09:41 +0000
commit3f1fa224f0a3c4c3550d2b4e79a80698ff1dc349 (patch)
tree478f8997ba45b9f4249680157d7bd1889e4408fc /target/linux/atheros/files
parent633e548e0116bc18167d0f4d3dda9a81fa1473c3 (diff)
downloadupstream-3f1fa224f0a3c4c3550d2b4e79a80698ff1dc349.tar.gz
upstream-3f1fa224f0a3c4c3550d2b4e79a80698ff1dc349.tar.bz2
upstream-3f1fa224f0a3c4c3550d2b4e79a80698ff1dc349.zip
add generic led support to atheros target
SVN-Revision: 10728
Diffstat (limited to 'target/linux/atheros/files')
-rw-r--r--target/linux/atheros/files/arch/mips/atheros/ar5312/board.c24
-rw-r--r--target/linux/atheros/files/arch/mips/atheros/ar5315/board.c29
2 files changed, 49 insertions, 4 deletions
diff --git a/target/linux/atheros/files/arch/mips/atheros/ar5312/board.c b/target/linux/atheros/files/arch/mips/atheros/ar5312/board.c
index 3768e30be0..f58d08cba7 100644
--- a/target/linux/atheros/files/arch/mips/atheros/ar5312/board.c
+++ b/target/linux/atheros/files/arch/mips/atheros/ar5312/board.c
@@ -28,11 +28,12 @@
#include <asm/irq.h>
#include <asm/io.h>
#include <ar531x.h>
+#include <linux/leds.h>
#define NO_PHY 0x1f
static int is_5312 = 0;
-static struct platform_device *ar5312_devs[5];
+static struct platform_device *ar5312_devs[6];
static struct resource ar5312_eth0_res[] = {
{
@@ -164,6 +165,24 @@ static struct platform_device ar5312_physmap_flash = {
.resource = &ar5312_flash_resource,
};
+#ifdef CONFIG_LEDS_GPIO
+static struct gpio_led ar5312_leds[] = {
+ { .name = "wlan", .gpio = 0, .active_low = 1, },
+};
+
+static const struct gpio_led_platform_data ar5312_led_data = {
+ .num_leds = ARRAY_SIZE(ar5312_leds),
+ .leds = (void *) ar5312_leds,
+};
+
+static struct platform_device ar5312_gpio_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = (void *) &ar5312_led_data,
+ }
+};
+#endif
/*
* NB: This mapping size is larger than the actual flash size,
@@ -269,6 +288,9 @@ int __init ar5312_init_devices(void)
ar5312_devs[dev++] = &ar5312_physmap_flash;
+ ar5312_leds[0].gpio = bcfg->sysLedGpio;
+ ar5312_devs[dev++] = &ar5312_gpio_leds;
+
if (!memcmp(bcfg->enet0Mac, "\xff\xff\xff\xff\xff\xff", 6))
memcpy(bcfg->enet0Mac, bcfg->enet1Mac, 6);
diff --git a/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c b/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c
index 57d17f526a..6d46c85a1e 100644
--- a/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c
+++ b/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c
@@ -27,6 +27,7 @@
#include <asm/irq.h>
#include <asm/io.h>
#include <ar531x.h>
+#include <linux/leds.h>
static int is_5315 = 0;
@@ -90,7 +91,27 @@ static struct platform_device ar5315_spiflash = {
.num_resources = ARRAY_SIZE(ar5315_spiflash_res)
};
-static __initdata struct platform_device *ar5315_devs[4];
+#ifdef CONFIG_LEDS_GPIO
+static struct gpio_led ar5315_leds[] = {
+ { .name = "wlan", .gpio = 0, .active_low = 1, },
+};
+
+static const struct gpio_led_platform_data ar5315_led_data = {
+ .num_leds = ARRAY_SIZE(ar5315_leds),
+ .leds = (void *) ar5315_leds,
+};
+
+static struct platform_device ar5315_gpio_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = (void *) &ar5315_led_data,
+ }
+};
+#endif
+
+
+static __initdata struct platform_device *ar5315_devs[5];
@@ -218,11 +239,13 @@ int __init ar5315_init_devices(void)
ar5315_eth_data.board_config = board_config;
ar5315_eth_data.macaddr = bcfg->enet0Mac;
ar5315_wmac.dev.platform_data = config;
-
+
+ ar5315_leds[0].gpio = bcfg->sysLedGpio;
+
ar5315_devs[dev++] = &ar5315_eth;
ar5315_devs[dev++] = &ar5315_wmac;
ar5315_devs[dev++] = &ar5315_spiflash;
-
+ ar5315_devs[dev++] = &ar5315_gpio_leds;
return platform_add_devices(ar5315_devs, dev);
}