Skip to contentSkip to conversation

OMAP3: add boot status GPIO LED for IGEP boards

PATCH Superseded Javier Martinez Canillas 2 participants 3 messages Dec 24, 2012 – Dec 26, 2012

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 OMAP3: add boot status GPIO LED for IGEP boards

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.

---

Changes since v2:
- Use show_boot_progress() instead implementing yet another boot status signalling as suggested by Wolfgang Denk.

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/igep0020.c |   15 +++++++++++++++
 board/isee/igep0020/igep0020.h |    2 ++
 board/isee/igep0030/igep0030.c |   15 +++++++++++++++
 board/isee/igep0030/igep0030.h |    2 ++
 include/configs/igep00x0.h     |    3 +++
 5 files changed, 37 insertions(+), 0 deletions(-)
board/isee/igep0020/igep0020.c +15 -0
index a8257a3..5b6afa9 100644
@@ -58,6 +58,21 @@ int board_init(void)
 	return 0;
 }
 
+#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD)
+void show_boot_progress(int val)
+{
+	if (val < 0) {
+		/* something went wrong */
+		return;
+	}
+
+	if (!gpio_request(IGEP0020_GPIO_LED, "")) {
+		gpio_direction_output(IGEP0020_GPIO_LED, 0);
+		gpio_set_value(IGEP0020_GPIO_LED, 1);
+	}
+}
+#endif
+
 #ifdef CONFIG_SPL_BUILD
 /*
  * Routine: omap_rev_string
board/isee/igep0020/igep0020.h +2 -0
index 3335ecc..1958bdd 100644
@@ -23,6 +23,8 @@
 #ifndef _IGEP0020_H_
 #define _IGEP0020_H_
 
+#define IGEP0020_GPIO_LED   27
+
 const omap3_sysinfo sysinfo = {
 	DDR_STACKED,
 	"IGEP v2 board",
board/isee/igep0030/igep0030.c +15 -0
index 107cb7f..91aff8c 100644
@@ -45,6 +45,21 @@ int board_init(void)
 	return 0;
 }
 
+#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD)
+void show_boot_progress(int val)
+{
+	if (val < 0) {
+		/* something went wrong */
+		return;
+	}
+
+	if (!gpio_request(IGEP0030_GPIO_LED, "")) {
+		gpio_direction_output(IGEP0030_GPIO_LED, 0);
+		gpio_set_value(IGEP0030_GPIO_LED, 1);
+	}
+}
+#endif
+
 #ifdef CONFIG_SPL_BUILD
 /*
  * Routine: omap_rev_string
board/isee/igep0030/igep0030.h +2 -0
index a93339d..42c2d9c 100644
@@ -23,6 +23,8 @@
 #ifndef _IGEP0030_H_
 #define _IGEP0030_H_
 
+#define IGEP0030_GPIO_LED 16
+
 const omap3_sysinfo sysinfo = {
 	DDR_STACKED,
 	"OMAP3 IGEP module",
include/configs/igep00x0.h +3 -0
index be7937d..07b1d3a 100644
@@ -82,6 +82,9 @@
 #define CONFIG_OMAP_HSMMC		1
 #define CONFIG_DOS_PARTITION		1
 
+/* define to enable boot progress via leds */
+#define CONFIG_SHOW_BOOT_PROGRESS
+
 /* USB */
 #define CONFIG_MUSB_UDC			1
 #define CONFIG_USB_OMAP3		1
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH v3 1/1 OMAP3: add boot status GPIO LED for IGEP boards

Dear Javier Martinez Canillas,

Quoted 9 lines · In message <1356349896-11693-1-git-send-email-javier.martinez@collabora.co.uk>…

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.

...

Quoted 2 lines
board/isee/igep0020/igep0020.c +0 -0

...

Quoted 14 lines
board/isee/igep0020/igep0020.c +14 -0
+#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD)
+void show_boot_progress(int val)
+{
+	if (val < 0) {
+		/* something went wrong */
+		return;
+	}
+
+	if (!gpio_request(IGEP0020_GPIO_LED, "")) {
+		gpio_direction_output(IGEP0020_GPIO_LED, 0);
+		gpio_set_value(IGEP0020_GPIO_LED, 1);
+	}
+}
+#endif

...

Quoted 2 lines
board/isee/igep0030/igep0030.c +0 -0

...

Quoted 4 lines
board/isee/igep0030/igep0030.c +4 -0
+#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD)
+void show_boot_progress(int val)
+{
+	if (val < 0) {

board/isee/igep0030/igep0030.c int board_init(void) · line 61

Quoted 10 lines
board/isee/igep0030/igep0030.c +10 -0
+		/* something went wrong */
+		return;
+	}
+
+	if (!gpio_request(IGEP0030_GPIO_LED, "")) {
+		gpio_direction_output(IGEP0030_GPIO_LED, 0);
+		gpio_set_value(IGEP0030_GPIO_LED, 1);
+	}
+}
+#endif

Can we not avoid duplicating this code? If you change
IGEP0020_GPIO_LED and IGEP0030_GPIO_LED into some common name like IGEP00XX_GPIO_LED, you can use common code for all such boards.

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Whenever people agree with me, I always think I must be wrong.
- Oscar Wilde
#2 lore raw

PATCH v3 1/1 OMAP3: add boot status GPIO LED for IGEP boards

Quoted 2 lines · Wolfgang Denk

Dear Javier Martinez Canillas,

Hello Wolfang,

Thanks a lot for your suggestions.

Quoted 42 lines
Quoted 9 lines · In message <1356349896-11693-1-git-send-email-javier.martinez@collabora.co.uk>…

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.

...

Quoted 2 lines
board/isee/igep0020/igep0020.c +0 -0

...

Quoted 14 lines
board/isee/igep0020/igep0020.c +14 -0
+#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD)
+void show_boot_progress(int val)
+{
+     if (val < 0) {
+             /* something went wrong */
+             return;
+     }
+
+     if (!gpio_request(IGEP0020_GPIO_LED, "")) {
+             gpio_direction_output(IGEP0020_GPIO_LED, 0);
+             gpio_set_value(IGEP0020_GPIO_LED, 1);
+     }
+}
+#endif

...

Quoted 2 lines
board/isee/igep0030/igep0030.c +0 -0

...

Quoted 10 lines
board/isee/igep0030/igep0030.c +10 -0
+#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD)
+void show_boot_progress(int val)
+{
+     if (val < 0) {
+             /* something went wrong */
+             return;
+     }
+
+     if (!gpio_request(IGEP0030_GPIO_LED, "")) {
+             gpio_direction_output(IGEP0030_GPIO_LED, 0);
Quoted 9 lines

board/isee/igep0030/igep0030.c int board_init(void) · line 61

Quoted 4 lines
board/isee/igep0030/igep0030.c +4 -0
+             gpio_set_value(IGEP0030_GPIO_LED, 1);
+     }
+}
+#endif

Can we not avoid duplicating this code? If you change
IGEP0020_GPIO_LED and IGEP0030_GPIO_LED into some common name like IGEP00XX_GPIO_LED, you can use common code for all such boards.

Yes, in fact I'm going to send a patch that removes the code duplication between igep0020 and igep0030 by using a single board file for both devices and a following patch that adds a single GPIO LED support function for both boards.

Quoted 6 lines

Thanks.

Best regards,

Wolfgang Denk

Thanks a lot and best regards,
Javier