From patchwork Sun Dec 23 12:31:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 207969 X-Patchwork-Delegate: trini@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 B71522C008F for ; Sun, 23 Dec 2012 23:32:22 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 863314A03E; Sun, 23 Dec 2012 13:32:20 +0100 (CET) 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 IECHmlB9aryD; Sun, 23 Dec 2012 13:32:20 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4B41F4A030; Sun, 23 Dec 2012 13:32:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0D874A030 for ; Sun, 23 Dec 2012 13:32:14 +0100 (CET) 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 6L1ZQxszmpS5 for ; Sun, 23 Dec 2012 13:32:12 +0100 (CET) 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 mail-we0-f179.google.com (mail-we0-f179.google.com [74.125.82.179]) by theia.denx.de (Postfix) with ESMTPS id 922F74A02F for ; Sun, 23 Dec 2012 13:32:10 +0100 (CET) Received: by mail-we0-f179.google.com with SMTP id r6so2944925wey.24 for ; Sun, 23 Dec 2012 04:32:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=VOkP2k0zjQyBuL8p18AWXhDjvFqZ0SuZjRNqaBSz4+U=; b=ZGEgLc5QaX+7y961ycrGIihZErRfS08Qx0zLWmCAEUiG0xzt6CFNFMFHirpm86f6FW wM7b3+MKX45eJY7kI7PCXo6GGZNqdCR08KPsAkMcF9uJuhYabDJAW//PB+s8/TSihfgl zYGPCFHd98t6BvHwPh093cxnGn+GLrMVu4+A1KMiT6gWDKwBsZAg8JqhSJnwqweblp8V ioq2wHRlq6BZYLZ0YjJCbQKLZSQjPBADKPvBSjukWLm/IBiF4TXXJHGKI7YGzSNCi9ay FYeICOxIiBJ36hzmK9e3wOF6RoTm783KosKVS9Eq7j8VWFCj8HVFGW5vMO4fAy3E3ICq XYfA== X-Received: by 10.180.107.129 with SMTP id hc1mr23700160wib.34.1356265927746; Sun, 23 Dec 2012 04:32:07 -0800 (PST) Received: from localhost.localdomain (65.216.77.188.dynamic.jazztel.es. [188.77.216.65]) by mx.google.com with ESMTPS id w5sm38354680wif.11.2012.12.23.04.32.02 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Dec 2012 04:32:06 -0800 (PST) From: Javier Martinez Canillas To: Enric Balletbo i Serra Date: Sun, 23 Dec 2012 13:31:39 +0100 Message-Id: <1356265899-18669-1-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 1.7.7.6 X-Gm-Message-State: ALoCoQmgLsNVKTxMaYWgOgdfZDM57ZODIXk4kMflxFtNGeGEqptxl/O1MN/XW4BdvA5OXf/g8D9w Cc: Ezequiel Garcia , u-boot@lists.denx.de, Tom Rini , Javier Martinez Canillas Subject: [U-Boot] [PATCH v2 1/1] OMAP3: add boot status GPIO LED for IGEP boards X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 This patch adds an GPIO LED boot status for IGEP boards. The GPIO LED used is the red LED0 while the Linux kernel uses the green LED0 as the boot status. By using different GPIO LEDs, the user can know in which step of the boot process the board currently is. Signed-off-by: Javier Martinez Canillas Acked-by: Igor Grinberg --- Changes since v1: - Don't set gd->bd->bi_arch_number since is done in arch/arm/lib/board.c - Use CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020 instead of check bi_arch_number as suggested by Igor Grinberg. board/isee/igep0020/Makefile | 4 ++- board/isee/igep0020/igep0020.c | 7 +++++ board/isee/igep0030/Makefile | 4 ++- board/isee/igep0030/igep0030.c | 7 +++++ board/isee/led.c | 58 ++++++++++++++++++++++++++++++++++++++++ include/configs/igep00x0.h | 11 +++++++ 6 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 board/isee/led.c diff --git a/board/isee/igep0020/Makefile b/board/isee/igep0020/Makefile index 00463e1..5ead151 100644 --- a/board/isee/igep0020/Makefile +++ b/board/isee/igep0020/Makefile @@ -25,8 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -COBJS := igep0020.o +COBJS-y := igep0020.o +COBJS-$(CONFIG_STATUS_LED) += ../led.o +COBJS := $(sort $(COBJS-y)) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/isee/igep0020/igep0020.c b/board/isee/igep0020/igep0020.c index a8257a3..c4fe138 100644 --- a/board/isee/igep0020/igep0020.c +++ b/board/isee/igep0020/igep0020.c @@ -21,6 +21,9 @@ * MA 02111-1307 USA */ #include +#ifdef CONFIG_STATUS_LED +#include +#endif #include #include #include @@ -55,6 +58,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; } diff --git a/board/isee/igep0030/Makefile b/board/isee/igep0030/Makefile index cbc03d4..1ca011d 100644 --- a/board/isee/igep0030/Makefile +++ b/board/isee/igep0030/Makefile @@ -25,8 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -COBJS := igep0030.o +COBJS-y := igep0030.o +COBJS-$(CONFIG_STATUS_LED) += ../led.o +COBJS := $(sort $(COBJS-y)) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/isee/igep0030/igep0030.c b/board/isee/igep0030/igep0030.c index 107cb7f..60dabcd 100644 --- a/board/isee/igep0030/igep0030.c +++ b/board/isee/igep0030/igep0030.c @@ -21,6 +21,9 @@ * MA 02111-1307 USA */ #include +#ifdef CONFIG_STATUS_LED +#include +#endif #include #include #include @@ -42,6 +45,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; } diff --git a/board/isee/led.c b/board/isee/led.c new file mode 100644 index 0000000..023ad67 --- /dev/null +++ b/board/isee/led.c @@ -0,0 +1,58 @@ +/* + * IGEP boards GPIO LED support + * + * Author: Javier Martinez Canillas + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include + +/* GPIO pin for the LED */ +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020) +#define IGEP_GPIO_LED 27 +#else /* MACH_TYPE_IGEP0030 */ +#define IGEP_GPIO_LED 16 +#endif + +void __led_init(led_id_t mask, int state) +{ + __led_set(mask, state); +} + +void __led_toggle(led_id_t mask) +{ + int state; + + if (!gpio_request(IGEP_GPIO_LED, "")) { + gpio_direction_output(IGEP_GPIO_LED, 0); + state = gpio_get_value(IGEP_GPIO_LED); + gpio_set_value(IGEP_GPIO_LED, !state); + } +} + +void __led_set(led_id_t mask, int state) +{ + if (!gpio_request(IGEP_GPIO_LED, "")) { + gpio_direction_output(IGEP_GPIO_LED, 0); + gpio_set_value(IGEP_GPIO_LED, state); + } +} diff --git a/include/configs/igep00x0.h b/include/configs/igep00x0.h index be7937d..a583be2 100644 --- a/include/configs/igep00x0.h +++ b/include/configs/igep00x0.h @@ -82,6 +82,17 @@ #define CONFIG_OMAP_HSMMC 1 #define CONFIG_DOS_PARTITION 1 +/* Status LED */ +#define CONFIG_STATUS_LED 1 +#define CONFIG_BOARD_SPECIFIC_LED 1 +#define STATUS_LED_BIT 0x01 +#define STATUS_LED_STATE STATUS_LED_ON +#define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2) +#define STATUS_LED_BIT1 0x02 +#define STATUS_LED_STATE1 STATUS_LED_ON +#define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 2) +#define STATUS_LED_BOOT STATUS_LED_BIT + /* USB */ #define CONFIG_MUSB_UDC 1 #define CONFIG_USB_OMAP3 1