All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/1] OMAP3: add boot status GPIO LED for IGEP boards
@ 2012-12-24 11:51 Javier Martinez Canillas
  2012-12-25 19:57 ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Javier Martinez Canillas @ 2012-12-24 11:51 UTC (permalink / raw)
  To: u-boot

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 <javier.martinez@collabora.co.uk>
---

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(-)

diff --git a/board/isee/igep0020/igep0020.c b/board/isee/igep0020/igep0020.c
index a8257a3..5b6afa9 100644
--- a/board/isee/igep0020/igep0020.c
+++ b/board/isee/igep0020/igep0020.c
@@ -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
diff --git a/board/isee/igep0020/igep0020.h b/board/isee/igep0020/igep0020.h
index 3335ecc..1958bdd 100644
--- a/board/isee/igep0020/igep0020.h
+++ b/board/isee/igep0020/igep0020.h
@@ -23,6 +23,8 @@
 #ifndef _IGEP0020_H_
 #define _IGEP0020_H_
 
+#define IGEP0020_GPIO_LED   27
+
 const omap3_sysinfo sysinfo = {
 	DDR_STACKED,
 	"IGEP v2 board",
diff --git a/board/isee/igep0030/igep0030.c b/board/isee/igep0030/igep0030.c
index 107cb7f..91aff8c 100644
--- a/board/isee/igep0030/igep0030.c
+++ b/board/isee/igep0030/igep0030.c
@@ -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
diff --git a/board/isee/igep0030/igep0030.h b/board/isee/igep0030/igep0030.h
index a93339d..42c2d9c 100644
--- a/board/isee/igep0030/igep0030.h
+++ b/board/isee/igep0030/igep0030.h
@@ -23,6 +23,8 @@
 #ifndef _IGEP0030_H_
 #define _IGEP0030_H_
 
+#define IGEP0030_GPIO_LED 16
+
 const omap3_sysinfo sysinfo = {
 	DDR_STACKED,
 	"OMAP3 IGEP module",
diff --git a/include/configs/igep00x0.h b/include/configs/igep00x0.h
index be7937d..07b1d3a 100644
--- a/include/configs/igep00x0.h
+++ b/include/configs/igep00x0.h
@@ -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
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v3 1/1] OMAP3: add boot status GPIO LED for IGEP boards
  2012-12-24 11:51 [U-Boot] [PATCH v3 1/1] OMAP3: add boot status GPIO LED for IGEP boards Javier Martinez Canillas
@ 2012-12-25 19:57 ` Wolfgang Denk
  2012-12-26  3:20   ` Javier Martinez Canillas
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Denk @ 2012-12-25 19:57 UTC (permalink / raw)
  To: u-boot

Dear Javier Martinez Canillas,

In message <1356349896-11693-1-git-send-email-javier.martinez@collabora.co.uk> you wrote:
> 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 <javier.martinez@collabora.co.uk>
...
> --- a/board/isee/igep0020/igep0020.c
> +++ b/board/isee/igep0020/igep0020.c
...
> +#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
...
> --- a/board/isee/igep0030/igep0030.c
> +++ b/board/isee/igep0030/igep0030.c
...
> +#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

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

-- 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v3 1/1] OMAP3: add boot status GPIO LED for IGEP boards
  2012-12-25 19:57 ` Wolfgang Denk
@ 2012-12-26  3:20   ` Javier Martinez Canillas
  0 siblings, 0 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2012-12-26  3:20 UTC (permalink / raw)
  To: u-boot

On Tue, Dec 25, 2012 at 8:57 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Javier Martinez Canillas,
>

Hello Wolfang,

Thanks a lot for your suggestions.

> In message <1356349896-11693-1-git-send-email-javier.martinez@collabora.co.uk> you wrote:
>> 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 <javier.martinez@collabora.co.uk>
> ...
>> --- a/board/isee/igep0020/igep0020.c
>> +++ b/board/isee/igep0020/igep0020.c
> ...
>> +#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
> ...
>> --- a/board/isee/igep0030/igep0030.c
>> +++ b/board/isee/igep0030/igep0030.c
> ...
>> +#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
>
> 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.

> Thanks.
>
> Best regards,
>
> Wolfgang Denk
>

Thanks a lot and best regards,
Javier

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-26  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-24 11:51 [U-Boot] [PATCH v3 1/1] OMAP3: add boot status GPIO LED for IGEP boards Javier Martinez Canillas
2012-12-25 19:57 ` Wolfgang Denk
2012-12-26  3:20   ` Javier Martinez Canillas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.