Patchwork [U-Boot,2/2] mx23_olinuxino: Add support for status LED

login
register
mail settings
Submitter Otavio Salvador
Date Jan. 27, 2013, 9:53 p.m.
Message ID <1359323623-15736-2-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/216065/
State Not Applicable
Headers show

Comments

Marek Vasut - Jan. 27, 2013, 9:52 p.m.
Dear Otavio Salvador,

> This allow user to know if the bootloader is running, even without a
> serial console.

1/2 is missing ?

> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  board/olimex/mx23_olinuxino/mx23_olinuxino.c |  7 +++++++
>  board/olimex/mx23_olinuxino/spl_boot.c       |  4 ++++
>  include/configs/mx23_olinuxino.h             | 12 ++++++++++++
>  3 files changed, 23 insertions(+)
> 
> diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
> b/board/olimex/mx23_olinuxino/mx23_olinuxino.c index 6a6053b..2501417
> 100644
> --- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
> +++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
> @@ -28,6 +28,9 @@
>  #include <asm/arch/imx-regs.h>
>  #include <asm/arch/clock.h>
>  #include <asm/arch/sys_proto.h>
> +#ifdef CONFIG_STATUS_LED
> +#include <status_led.h>
> +#endif
> 
>  DECLARE_GLOBAL_DATA_PTR;
> 
> @@ -67,5 +70,9 @@ int board_init(void)
>  	/* Adress of boot parameters */
>  	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
> 
> +#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
> +	status_led_set(STATUS_LED_BOOT, STATUS_LED_STATE);
> +#endif
> +
>  	return 0;
>  }

I'm missing LED value setter ... so the LED toggles only because you set the 
pinmux, right ?

> diff --git a/board/olimex/mx23_olinuxino/spl_boot.c
> b/board/olimex/mx23_olinuxino/spl_boot.c index 7def8bc..ed8f8d9 100644
> --- a/board/olimex/mx23_olinuxino/spl_boot.c
> +++ b/board/olimex/mx23_olinuxino/spl_boot.c
> @@ -84,6 +84,10 @@ const iomux_cfg_t iomux_setup[] = {
>  	MX23_PAD_EMI_RASN__EMI_RASN | MUX_CONFIG_EMI,
>  	MX23_PAD_EMI_WEN__EMI_WEN | MUX_CONFIG_EMI,
> 
> +	/* Green LED */
> +	MX23_PAD_SSP1_DETECT__GPIO_2_1 |
> +		(MXS_PAD_4MA | MXS_PAD_3V3),

NOPULL ?

>  	/* MMC 0 */
>  	MX23_PAD_SSP1_CMD__SSP1_CMD | MUX_CONFIG_SSP,
>  	MX23_PAD_SSP1_DATA0__SSP1_DATA0 | MUX_CONFIG_SSP,
> diff --git a/include/configs/mx23_olinuxino.h
> b/include/configs/mx23_olinuxino.h index 4658aea..c57bb67 100644
> --- a/include/configs/mx23_olinuxino.h
> +++ b/include/configs/mx23_olinuxino.h
> @@ -56,6 +56,7 @@
>  #define	CONFIG_CMD_EXT2
>  #define	CONFIG_CMD_FAT
>  #define	CONFIG_CMD_GPIO
> +#define	CONFIG_CMD_LED
>  #define	CONFIG_CMD_MMC
> 
>  /*
> @@ -112,6 +113,17 @@
>  #define	CONFIG_BAUDRATE			115200	/* Default baud rate */
> 
>  /*
> + * Status LED
> + */
> +#define	CONFIG_STATUS_LED
> +#define	CONFIG_GPIO_LED
> +#define	CONFIG_BOARD_SPECIFIC_LED
> +#define	STATUS_LED_BOOT	0
> +#define	STATUS_LED_BIT	0x30a
> +#define	STATUS_LED_STATE	STATUS_LED_ON
> +#define	STATUS_LED_PERIOD	(CONFIG_SYS_HZ / 2)

Are these needed?

> +/*
>   * MMC Driver
>   */
>  #ifdef	CONFIG_CMD_MMC

Best regards,
Marek Vasut
Otavio Salvador - Jan. 27, 2013, 9:53 p.m.
This allow user to know if the bootloader is running, even without a
serial console.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 board/olimex/mx23_olinuxino/mx23_olinuxino.c |  7 +++++++
 board/olimex/mx23_olinuxino/spl_boot.c       |  4 ++++
 include/configs/mx23_olinuxino.h             | 12 ++++++++++++
 3 files changed, 23 insertions(+)
Otavio Salvador - Jan. 27, 2013, 10:03 p.m.
On Sun, Jan 27, 2013 at 7:52 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
>> This allow user to know if the bootloader is running, even without a
>> serial console.
>
> 1/2 is missing ?

No; it is in mailing list but you're not in cc.

>> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>> ---
>>  board/olimex/mx23_olinuxino/mx23_olinuxino.c |  7 +++++++
>>  board/olimex/mx23_olinuxino/spl_boot.c       |  4 ++++
>>  include/configs/mx23_olinuxino.h             | 12 ++++++++++++
>>  3 files changed, 23 insertions(+)
>>
>> diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
>> b/board/olimex/mx23_olinuxino/mx23_olinuxino.c index 6a6053b..2501417
>> 100644
>> --- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
>> +++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
>> @@ -28,6 +28,9 @@
>>  #include <asm/arch/imx-regs.h>
>>  #include <asm/arch/clock.h>
>>  #include <asm/arch/sys_proto.h>
>> +#ifdef CONFIG_STATUS_LED
>> +#include <status_led.h>
>> +#endif
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> @@ -67,5 +70,9 @@ int board_init(void)
>>       /* Adress of boot parameters */
>>       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
>>
>> +#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
>> +     status_led_set(STATUS_LED_BOOT, STATUS_LED_STATE);
>> +#endif
>> +
>>       return 0;
>>  }
>
> I'm missing LED value setter ... so the LED toggles only because you set the
> pinmux, right ?

No; it uses the gpio_led driver so we don't need to write the common code.

>> diff --git a/board/olimex/mx23_olinuxino/spl_boot.c
>> b/board/olimex/mx23_olinuxino/spl_boot.c index 7def8bc..ed8f8d9 100644
>> --- a/board/olimex/mx23_olinuxino/spl_boot.c
>> +++ b/board/olimex/mx23_olinuxino/spl_boot.c
>> @@ -84,6 +84,10 @@ const iomux_cfg_t iomux_setup[] = {
>>       MX23_PAD_EMI_RASN__EMI_RASN | MUX_CONFIG_EMI,
>>       MX23_PAD_EMI_WEN__EMI_WEN | MUX_CONFIG_EMI,
>>
>> +     /* Green LED */
>> +     MX23_PAD_SSP1_DETECT__GPIO_2_1 |
>> +             (MXS_PAD_4MA | MXS_PAD_3V3),
>
> NOPULL ?

Not needed; removed for v2.

>>       /* MMC 0 */
>>       MX23_PAD_SSP1_CMD__SSP1_CMD | MUX_CONFIG_SSP,
>>       MX23_PAD_SSP1_DATA0__SSP1_DATA0 | MUX_CONFIG_SSP,
>> diff --git a/include/configs/mx23_olinuxino.h
>> b/include/configs/mx23_olinuxino.h index 4658aea..c57bb67 100644
>> --- a/include/configs/mx23_olinuxino.h
>> +++ b/include/configs/mx23_olinuxino.h
>> @@ -56,6 +56,7 @@
>>  #define      CONFIG_CMD_EXT2
>>  #define      CONFIG_CMD_FAT
>>  #define      CONFIG_CMD_GPIO
>> +#define      CONFIG_CMD_LED
>>  #define      CONFIG_CMD_MMC
>>
>>  /*
>> @@ -112,6 +113,17 @@
>>  #define      CONFIG_BAUDRATE                 115200  /* Default baud rate */
>>
>>  /*
>> + * Status LED
>> + */
>> +#define      CONFIG_STATUS_LED
>> +#define      CONFIG_GPIO_LED
>> +#define      CONFIG_BOARD_SPECIFIC_LED
>> +#define      STATUS_LED_BOOT 0
>> +#define      STATUS_LED_BIT  0x30a
>> +#define      STATUS_LED_STATE        STATUS_LED_ON
>> +#define      STATUS_LED_PERIOD       (CONFIG_SYS_HZ / 2)
>
> Are these needed?

Yes.

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br

Patch

diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
index 6a6053b..2501417 100644
--- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
+++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
@@ -28,6 +28,9 @@ 
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#ifdef CONFIG_STATUS_LED
+#include <status_led.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -67,5 +70,9 @@  int board_init(void)
 	/* Adress of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
+#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
+	status_led_set(STATUS_LED_BOOT, STATUS_LED_STATE);
+#endif
+
 	return 0;
 }
diff --git a/board/olimex/mx23_olinuxino/spl_boot.c b/board/olimex/mx23_olinuxino/spl_boot.c
index 7def8bc..ed8f8d9 100644
--- a/board/olimex/mx23_olinuxino/spl_boot.c
+++ b/board/olimex/mx23_olinuxino/spl_boot.c
@@ -84,6 +84,10 @@  const iomux_cfg_t iomux_setup[] = {
 	MX23_PAD_EMI_RASN__EMI_RASN | MUX_CONFIG_EMI,
 	MX23_PAD_EMI_WEN__EMI_WEN | MUX_CONFIG_EMI,
 
+	/* Green LED */
+	MX23_PAD_SSP1_DETECT__GPIO_2_1 |
+		(MXS_PAD_4MA | MXS_PAD_3V3),
+
 	/* MMC 0 */
 	MX23_PAD_SSP1_CMD__SSP1_CMD | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_DATA0__SSP1_DATA0 | MUX_CONFIG_SSP,
diff --git a/include/configs/mx23_olinuxino.h b/include/configs/mx23_olinuxino.h
index 4658aea..c57bb67 100644
--- a/include/configs/mx23_olinuxino.h
+++ b/include/configs/mx23_olinuxino.h
@@ -56,6 +56,7 @@ 
 #define	CONFIG_CMD_EXT2
 #define	CONFIG_CMD_FAT
 #define	CONFIG_CMD_GPIO
+#define	CONFIG_CMD_LED
 #define	CONFIG_CMD_MMC
 
 /*
@@ -112,6 +113,17 @@ 
 #define	CONFIG_BAUDRATE			115200	/* Default baud rate */
 
 /*
+ * Status LED
+ */
+#define	CONFIG_STATUS_LED
+#define	CONFIG_GPIO_LED
+#define	CONFIG_BOARD_SPECIFIC_LED
+#define	STATUS_LED_BOOT	0
+#define	STATUS_LED_BIT	0x30a
+#define	STATUS_LED_STATE	STATUS_LED_ON
+#define	STATUS_LED_PERIOD	(CONFIG_SYS_HZ / 2)
+
+/*
  * MMC Driver
  */
 #ifdef	CONFIG_CMD_MMC