]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
OMAP3: CM-T35: enable the green LED
authorIgor Grinberg <grinberg@compulab.co.il>
Mon, 18 Apr 2011 21:54:33 +0000 (17:54 -0400)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Wed, 27 Apr 2011 17:38:07 +0000 (19:38 +0200)
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
board/cm_t35/Makefile
board/cm_t35/cm_t35.c
board/cm_t35/leds.c [new file with mode: 0644]
include/configs/cm_t35.h

index 862b8dc1b2506c83e088971a5629b9bf546b7984..83d7a568f8365b3606737de8115aa42fd25df113 100644 (file)
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).o
 
 
 LIB    = $(obj)lib$(BOARD).o
 
-COBJS  := cm_t35.o
+COBJS  := cm_t35.o leds.o
 
 SRCS   := $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 
 SRCS   := $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
index bf54061954096f3bd1f59831f97cf58b260b3884..cfdc4df9160ac65b41c5846e1006cd9c0ab39808 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <common.h>
  */
 
 #include <common.h>
+#include <status_led.h>
 #include <netdev.h>
 #include <net.h>
 #include <i2c.h>
 #include <netdev.h>
 #include <net.h>
 #include <i2c.h>
@@ -85,6 +86,10 @@ int board_init(void)
        /* boot param addr */
        gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
 
        /* boot param addr */
        gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
 
+#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
+       status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
+#endif
+
        return 0;
 }
 
        return 0;
 }
 
@@ -249,7 +254,7 @@ void set_muxconf_regs(void)
        MUX_VAL(CP(SYS_NIRQ),           (IEN  | PTU | EN  | M0)); /*SYS_nIRQ*/
        MUX_VAL(CP(SYS_OFF_MODE),       (IEN  | PTD | DIS | M0)); /*OFF_MODE*/
        MUX_VAL(CP(SYS_CLKOUT1),        (IEN  | PTD | DIS | M0)); /*CLKOUT1*/
        MUX_VAL(CP(SYS_NIRQ),           (IEN  | PTU | EN  | M0)); /*SYS_nIRQ*/
        MUX_VAL(CP(SYS_OFF_MODE),       (IEN  | PTD | DIS | M0)); /*OFF_MODE*/
        MUX_VAL(CP(SYS_CLKOUT1),        (IEN  | PTD | DIS | M0)); /*CLKOUT1*/
-       MUX_VAL(CP(SYS_CLKOUT2),        (IDIS | PTD | DIS | M4)); /*green LED*/
+       MUX_VAL(CP(SYS_CLKOUT2),        (IDIS | PTU | DIS | M4)); /*green LED*/
        MUX_VAL(CP(JTAG_nTRST),         (IEN  | PTD | DIS | M0)); /*JTAG_nTRST*/
        MUX_VAL(CP(JTAG_TCK),           (IEN  | PTD | DIS | M0)); /*JTAG_TCK*/
        MUX_VAL(CP(JTAG_TMS),           (IEN  | PTD | DIS | M0)); /*JTAG_TMS*/
        MUX_VAL(CP(JTAG_nTRST),         (IEN  | PTD | DIS | M0)); /*JTAG_nTRST*/
        MUX_VAL(CP(JTAG_TCK),           (IEN  | PTD | DIS | M0)); /*JTAG_TCK*/
        MUX_VAL(CP(JTAG_TMS),           (IEN  | PTD | DIS | M0)); /*JTAG_TMS*/
diff --git a/board/cm_t35/leds.c b/board/cm_t35/leds.c
new file mode 100644 (file)
index 0000000..71c5b0d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * (C) Copyright 2011
+ * CompuLab, Ltd. <www.compulab.co.il>
+ *
+ * Author: Igor Grinberg <grinberg@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+#include <common.h>
+#include <status_led.h>
+#include <asm/arch/gpio.h>
+
+static unsigned int leds[] = { GREEN_LED_GPIO };
+
+void __led_init(led_id_t mask, int state)
+{
+       if (omap_request_gpio(leds[mask]) != 0) {
+               printf("%s: failed requesting GPIO%u\n", __func__, leds[mask]);
+               return;
+       }
+
+       omap_set_gpio_direction(leds[mask], 0);
+}
+
+void __led_set(led_id_t mask, int state)
+{
+       omap_set_gpio_dataout(leds[mask], state == STATUS_LED_ON);
+}
+
+void __led_toggle(led_id_t mask)
+{
+       omap_set_gpio_dataout(leds[mask], !omap_get_gpio_datain(leds[mask]));
+}
index 3692810f5d2442c7ecdc619a789729c020fcbbe5..c259640d3808ee499c29d7c1dec9bc4c76f90d82 100644 (file)
@@ -351,4 +351,19 @@ extern unsigned int boot_flash_type;
                                         CONFIG_SYS_INIT_RAM_SIZE -     \
                                         GENERATED_GBL_DATA_SIZE)
 
                                         CONFIG_SYS_INIT_RAM_SIZE -     \
                                         GENERATED_GBL_DATA_SIZE)
 
+/* Status LED */
+#define CONFIG_STATUS_LED              1 /* Status LED enabled */
+#define CONFIG_BOARD_SPECIFIC_LED      1
+#define STATUS_LED_GREEN               0
+#define STATUS_LED_BIT                 STATUS_LED_GREEN
+#define STATUS_LED_STATE               STATUS_LED_ON
+#define STATUS_LED_PERIOD              (CONFIG_SYS_HZ / 2)
+#define STATUS_LED_BOOT                        STATUS_LED_BIT
+#define GREEN_LED_GPIO                 186 /* CM-T35 Green LED is GPIO186 */
+
+/* GPIO banks */
+#ifdef CONFIG_STATUS_LED
+#define CONFIG_OMAP3_GPIO_6            1 /* GPIO186 is in GPIO bank 6  */
+#endif
+
 #endif /* __CONFIG_H */
 #endif /* __CONFIG_H */