summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/files/arch/mips
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-03-08 12:10:01 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-03-08 12:10:01 +0000
commit6600fab89300162a580bd4b689939e380fcfdd78 (patch)
tree0f290705303c4ba0ab8bc5510f567eac88b5c602 /target/linux/ar71xx/files/arch/mips
parenta1a9727fbfa4709e5c3c01d8129f0bd35e74a5b4 (diff)
downloadmtk-20170518-6600fab89300162a580bd4b689939e380fcfdd78.zip
mtk-20170518-6600fab89300162a580bd4b689939e380fcfdd78.tar.gz
mtk-20170518-6600fab89300162a580bd4b689939e380fcfdd78.tar.bz2
ar71xx: add LED driver for the RB750
SVN-Revision: 20051
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb750.c49
-rw-r--r--target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/mach-rb750.h12
2 files changed, 61 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb750.c
index 06f4832..1698db9 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb750.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb750.c
@@ -8,12 +8,54 @@
* by the Free Software Foundation.
*/
+#include <linux/platform_device.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include <asm/mach-ar71xx/mach-rb750.h>
#include "machtype.h"
#include "dev-ap91-eth.h"
+static struct rb750_led_data rb750_leds[] = {
+ {
+ .name = "rb750:green:act",
+ .mask = RB750_LED_ACT,
+ .active_low = 1,
+ }, {
+ .name = "rb750:green:port1",
+ .mask = RB750_LED_PORT5,
+ .active_low = 1,
+ }, {
+ .name = "rb750:green:port2",
+ .mask = RB750_LED_PORT4,
+ .active_low = 1,
+ }, {
+ .name = "rb750:green:port3",
+ .mask = RB750_LED_PORT3,
+ .active_low = 1,
+ }, {
+ .name = "rb750:green:port4",
+ .mask = RB750_LED_PORT2,
+ .active_low = 1,
+ }, {
+ .name = "rb750:green:port5",
+ .mask = RB750_LED_PORT1,
+ .active_low = 1,
+ }
+};
+
+static struct rb750_led_platform_data rb750_leds_data = {
+ .num_leds = ARRAY_SIZE(rb750_leds),
+ .leds = rb750_leds,
+};
+
+static struct platform_device rb750_leds_device = {
+ .name = "leds-rb750",
+ .id = -1,
+ .dev = {
+ .platform_data = &rb750_leds_data,
+ }
+};
+
int rb750_latch_change(u32 mask_clr, u32 mask_set)
{
static DEFINE_SPINLOCK(lock);
@@ -65,7 +107,14 @@ EXPORT_SYMBOL_GPL(rb750_latch_change);
static void __init rb750_setup(void)
{
+ 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);
+
ap91_eth_init(NULL);
+ platform_device_register(&rb750_leds_device);
}
MIPS_MACHINE(AR71XX_MACH_RB_750, "750i", "MikroTik RouterBOARD 750",
diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/mach-rb750.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/mach-rb750.h
index 8165da3..661ba4e 100644
--- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/mach-rb750.h
+++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/mach-rb750.h
@@ -49,6 +49,18 @@
#define RB750_LED_BITS (RB750_LED_PORT1 | RB750_LED_PORT2 | RB750_LED_PORT3 | \
RB750_LED_PORT4 | RB750_LED_PORT5 | RB750_LED_ACT)
+struct rb750_led_data {
+ char *name;
+ char *default_trigger;
+ u32 mask;
+ int active_low;
+};
+
+struct rb750_led_platform_data {
+ int num_leds;
+ struct rb750_led_data *leds;
+};
+
int rb750_latch_change(u32 mask_clr, u32 mask_set);
#endif /* _MACH_RB750_H */ \ No newline at end of file