Commit 2b8754b25ff8134d8db18f6d4d28d41a5e1b36e6

Authored by Igor Grinberg
Committed by Albert ARIBAUD
1 parent afff1fc079

OMAP3: CM-T35: enable the green LED

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>

Showing 4 changed files with 67 additions and 2 deletions Side-by-side Diff

board/cm_t35/Makefile
... ... @@ -25,7 +25,7 @@
25 25  
26 26 LIB = $(obj)lib$(BOARD).o
27 27  
28   -COBJS := cm_t35.o
  28 +COBJS := cm_t35.o leds.o
29 29  
30 30 SRCS := $(COBJS:.o=.c)
31 31 OBJS := $(addprefix $(obj),$(COBJS))
board/cm_t35/cm_t35.c
... ... @@ -29,6 +29,7 @@
29 29 */
30 30  
31 31 #include <common.h>
  32 +#include <status_led.h>
32 33 #include <netdev.h>
33 34 #include <net.h>
34 35 #include <i2c.h>
... ... @@ -85,6 +86,10 @@
85 86 /* boot param addr */
86 87 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
87 88  
  89 +#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  90 + status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
  91 +#endif
  92 +
88 93 return 0;
89 94 }
90 95  
... ... @@ -249,7 +254,7 @@
249 254 MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)); /*SYS_nIRQ*/
250 255 MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)); /*OFF_MODE*/
251 256 MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)); /*CLKOUT1*/
252   - MUX_VAL(CP(SYS_CLKOUT2), (IDIS | PTD | DIS | M4)); /*green LED*/
  257 + MUX_VAL(CP(SYS_CLKOUT2), (IDIS | PTU | DIS | M4)); /*green LED*/
253 258 MUX_VAL(CP(JTAG_nTRST), (IEN | PTD | DIS | M0)); /*JTAG_nTRST*/
254 259 MUX_VAL(CP(JTAG_TCK), (IEN | PTD | DIS | M0)); /*JTAG_TCK*/
255 260 MUX_VAL(CP(JTAG_TMS), (IEN | PTD | DIS | M0)); /*JTAG_TMS*/
  1 +/*
  2 + * (C) Copyright 2011
  3 + * CompuLab, Ltd. <www.compulab.co.il>
  4 + *
  5 + * Author: Igor Grinberg <grinberg@compulab.co.il>
  6 + *
  7 + * This program is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU General Public License as
  9 + * published by the Free Software Foundation; either version 2 of
  10 + * the License, or (at your option) any later version.
  11 + *
  12 + * This program is distributed in the hope that it will be useful,
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 + * GNU General Public License for more details.
  16 + *
  17 + * You should have received a copy of the GNU General Public License
  18 + * along with this program; if not, write to the Free Software
  19 + * Foundation, Inc.
  20 + */
  21 +#include <common.h>
  22 +#include <status_led.h>
  23 +#include <asm/arch/gpio.h>
  24 +
  25 +static unsigned int leds[] = { GREEN_LED_GPIO };
  26 +
  27 +void __led_init(led_id_t mask, int state)
  28 +{
  29 + if (omap_request_gpio(leds[mask]) != 0) {
  30 + printf("%s: failed requesting GPIO%u\n", __func__, leds[mask]);
  31 + return;
  32 + }
  33 +
  34 + omap_set_gpio_direction(leds[mask], 0);
  35 +}
  36 +
  37 +void __led_set(led_id_t mask, int state)
  38 +{
  39 + omap_set_gpio_dataout(leds[mask], state == STATUS_LED_ON);
  40 +}
  41 +
  42 +void __led_toggle(led_id_t mask)
  43 +{
  44 + omap_set_gpio_dataout(leds[mask], !omap_get_gpio_datain(leds[mask]));
  45 +}
include/configs/cm_t35.h
... ... @@ -351,5 +351,20 @@
351 351 CONFIG_SYS_INIT_RAM_SIZE - \
352 352 GENERATED_GBL_DATA_SIZE)
353 353  
  354 +/* Status LED */
  355 +#define CONFIG_STATUS_LED 1 /* Status LED enabled */
  356 +#define CONFIG_BOARD_SPECIFIC_LED 1
  357 +#define STATUS_LED_GREEN 0
  358 +#define STATUS_LED_BIT STATUS_LED_GREEN
  359 +#define STATUS_LED_STATE STATUS_LED_ON
  360 +#define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  361 +#define STATUS_LED_BOOT STATUS_LED_BIT
  362 +#define GREEN_LED_GPIO 186 /* CM-T35 Green LED is GPIO186 */
  363 +
  364 +/* GPIO banks */
  365 +#ifdef CONFIG_STATUS_LED
  366 +#define CONFIG_OMAP3_GPIO_6 1 /* GPIO186 is in GPIO bank 6 */
  367 +#endif
  368 +
354 369 #endif /* __CONFIG_H */