From patchwork Tue Apr 5 07:08:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Grinberg X-Patchwork-Id: 89806 X-Patchwork-Delegate: s-paulraj@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 11F7BB6EFE for ; Tue, 5 Apr 2011 18:06:53 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6569728125; Tue, 5 Apr 2011 10:06:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t2cMlOI7ND6X; Tue, 5 Apr 2011 10:06:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DE40E28117; Tue, 5 Apr 2011 10:06:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4C9B5280F4 for ; Tue, 5 Apr 2011 10:06:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MmhuGC5iGWPp for ; Tue, 5 Apr 2011 10:06:45 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from compulab.co.il (compulab.co.il [67.18.134.219]) by theia.denx.de (Postfix) with ESMTPS id 08764280EC for ; Tue, 5 Apr 2011 10:06:43 +0200 (CEST) Received: from [62.90.235.247] (helo=zimbra-mta.compulab.co.il) by compulab.site5.com with esmtp (Exim 4.69) (envelope-from ) id 1Q70NN-0006hV-Ai for u-boot@lists.denx.de; Tue, 05 Apr 2011 02:08:33 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 194337E916C for ; Tue, 5 Apr 2011 10:08:33 +0300 (IDT) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id etXfRfgR4ixO; Tue, 5 Apr 2011 10:08:33 +0300 (IDT) Received: from grinberg-linux (grinberg-pc.compulab.local [10.1.1.13]) by zimbra-mta.compulab.co.il (Postfix) with SMTP id 012567E8BA2; Tue, 5 Apr 2011 10:08:32 +0300 (IDT) Received: by grinberg-linux (sSMTP sendmail emulation); Tue, 05 Apr 2011 10:08:33 +0300 From: Igor Grinberg To: u-boot@lists.denx.de Date: Tue, 5 Apr 2011 10:08:12 +0300 Message-Id: <1301987293-5095-9-git-send-email-grinberg@compulab.co.il> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1301987293-5095-1-git-send-email-grinberg@compulab.co.il> References: <1301987293-5095-1-git-send-email-grinberg@compulab.co.il> X-ACL-Warn: { X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - compulab.site5.com X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Source: X-Source-Args: X-Source-Dir: Subject: [U-Boot] [PATCH 8/9] OMAP3: CM-T35: enable the green LED X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Igor Grinberg --- board/cm_t35/Makefile | 2 +- board/cm_t35/cm_t35.c | 7 ++++++- board/cm_t35/leds.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ include/configs/cm_t35.h | 15 +++++++++++++++ 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 board/cm_t35/leds.c diff --git a/board/cm_t35/Makefile b/board/cm_t35/Makefile index 862b8dc..83d7a56 100644 --- a/board/cm_t35/Makefile +++ b/board/cm_t35/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -COBJS := cm_t35.o +COBJS := cm_t35.o leds.o SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c index bf54061..cfdc4df 100644 --- a/board/cm_t35/cm_t35.c +++ b/board/cm_t35/cm_t35.c @@ -29,6 +29,7 @@ */ #include +#include #include #include #include @@ -85,6 +86,10 @@ int board_init(void) /* 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; } @@ -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_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*/ diff --git a/board/cm_t35/leds.c b/board/cm_t35/leds.c new file mode 100644 index 0000000..71c5b0d --- /dev/null +++ b/board/cm_t35/leds.c @@ -0,0 +1,45 @@ +/* + * (C) Copyright 2011 + * CompuLab, Ltd. + * + * Author: Igor Grinberg + * + * 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 +#include +#include + +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])); +} diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h index 3692810..c259640 100644 --- a/include/configs/cm_t35.h +++ b/include/configs/cm_t35.h @@ -351,4 +351,19 @@ extern unsigned int boot_flash_type; 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 */