[U-Boot] [PATCH] AT91: Add support for blue_LED_* and add coloured_LED_init to at91/led.c

Albin Tonnerre albin.tonnerre at free-electrons.com
Wed Aug 12 18:10:34 CEST 2009


Currently, at91/led.c only provides _on and _off functions for green,
yellow and red LEDs. This patch provides a generic coloured_LED_init
function, which is a first step towards getting rid of the
board-specific (and duplicated) board/*/*/led.c files on at91
This patch alos adds similar support for blue LEDs, mostly for the sake
of completeness.

Signed-off-by: Albin Tonnerre <albin.tonnerre at free-electrons.com>
---
 cpu/arm926ejs/at91/led.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/cpu/arm926ejs/at91/led.c b/cpu/arm926ejs/at91/led.c
index be68f59..f6b1912 100644
--- a/cpu/arm926ejs/at91/led.c
+++ b/cpu/arm926ejs/at91/led.c
@@ -27,6 +27,26 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/io.h>
 
+void coloured_LED_init(void)
+{
+#ifdef CONFIG_RED_LED
+	at91_set_gpio_output(CONFIG_RED_LED, 0);
+	red_LED_off();
+#endif
+#ifdef CONFIG_GREEN_LED
+	at91_set_gpio_output(CONFIG_GREEN_LED, 0);
+	green_LED_off();
+#endif
+#ifdef CONFIG_YELLOW_LED
+	at91_set_gpio_output(CONFIG_YELLOW_LED, 0);
+	yellow_LED_off();
+#endif
+#ifdef CONFIG_BLUE_LED
+	at91_set_gpio_output(CONFIG_BLUE_LED, 0);
+	blue_LED_off();
+#endif
+}
+
 #ifdef CONFIG_RED_LED
 void red_LED_on(void)
 {
@@ -62,3 +82,15 @@ void yellow_LED_off(void)
 	at91_set_gpio_value(CONFIG_YELLOW_LED, 1);
 }
 #endif
+
+#ifdef CONFIG_BLUE_LED
+void blue_LED_on(void)
+{
+	at91_set_gpio_value(CONFIG_BLUE_LED, 0);
+}
+
+void blue_LED_off(void)
+{
+	at91_set_gpio_value(CONFIG_BLUE_LED, 1);
+}
+#endif
-- 
1.6.0.4



More information about the U-Boot mailing list