diff mbox

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

Message ID 1359385879-14979-2-git-send-email-otavio@ossystems.com.br
State Not Applicable
Headers show

Commit Message

Otavio Salvador Jan. 28, 2013, 3:11 p.m. UTC
This allow user to know if the bootloader is running, even without a
serial console.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Changes in v3:
- Added the MUX settings back (requested by Fabio)
- Added name of the PIN in the board config file

Changes in v2:
- Remove MUX setting - not need

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

Comments

Marek Vasut Jan. 28, 2013, 3:10 p.m. UTC | #1
Dear Otavio Salvador,

[..]
>  /*
> + * Status LED
> + */
> +#define	CONFIG_STATUS_LED
> +#define	CONFIG_GPIO_LED
> +#define	CONFIG_BOARD_SPECIFIC_LED
> +#define	STATUS_LED_BOOT	0
> +#define	STATUS_LED_BIT	0x030a /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */

Just use MX23_PAD_SSP1_DETECT__GPIO_2_1 directly ?

> +#define	STATUS_LED_STATE	STATUS_LED_ON
> +#define	STATUS_LED_PERIOD	(CONFIG_SYS_HZ / 2)
> +
> +/*
>   * MMC Driver
>   */
>  #ifdef	CONFIG_CMD_MMC

Best regards,
Marek Vasut
Otavio Salvador Jan. 28, 2013, 3:12 p.m. UTC | #2
On Mon, Jan 28, 2013 at 1:10 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
> [..]
>>  /*
>> + * Status LED
>> + */
>> +#define      CONFIG_STATUS_LED
>> +#define      CONFIG_GPIO_LED
>> +#define      CONFIG_BOARD_SPECIFIC_LED
>> +#define      STATUS_LED_BOOT 0
>> +#define      STATUS_LED_BIT  0x030a /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */
>
> Just use MX23_PAD_SSP1_DETECT__GPIO_2_1 directly ?

make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/otavio/hacking/u-boot/drivers/mtd/spi'
status_led.c:46:7: error: 'MX23_PAD_SSP1_DETECT__GPIO_2_1' undeclared
here (not in a function)
make[1]: Entering directory `/home/otavio/hacking/u-boot/drivers/mtd/ubi'

...

--
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
Marek Vasut Jan. 28, 2013, 3:18 p.m. UTC | #3
Dear Otavio Salvador,

> On Mon, Jan 28, 2013 at 1:10 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Otavio Salvador,
> > 
> > [..]
> > 
> >>  /*
> >> 
> >> + * Status LED
> >> + */
> >> +#define      CONFIG_STATUS_LED
> >> +#define      CONFIG_GPIO_LED
> >> +#define      CONFIG_BOARD_SPECIFIC_LED
> >> +#define      STATUS_LED_BOOT 0
> >> +#define      STATUS_LED_BIT  0x030a /* MX23_PAD_SSP1_DETECT__GPIO_2_1
> >> */
> > 
> > Just use MX23_PAD_SSP1_DETECT__GPIO_2_1 directly ?
> 
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory `/home/otavio/hacking/u-boot/drivers/mtd/spi'
> status_led.c:46:7: error: 'MX23_PAD_SSP1_DETECT__GPIO_2_1' undeclared
> here (not in a function)

#include iomux-mx23 missing ?

> make[1]: Entering directory `/home/otavio/hacking/u-boot/drivers/mtd/ubi'
> 
> ...
> 
> --
> 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

Best regards,
Marek Vasut
Otavio Salvador Jan. 28, 2013, 3:20 p.m. UTC | #4
On Mon, Jan 28, 2013 at 1:18 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
>> On Mon, Jan 28, 2013 at 1:10 PM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Otavio Salvador,
>> >
>> > [..]
>> >
>> >>  /*
>> >>
>> >> + * Status LED
>> >> + */
>> >> +#define      CONFIG_STATUS_LED
>> >> +#define      CONFIG_GPIO_LED
>> >> +#define      CONFIG_BOARD_SPECIFIC_LED
>> >> +#define      STATUS_LED_BOOT 0
>> >> +#define      STATUS_LED_BIT  0x030a /* MX23_PAD_SSP1_DETECT__GPIO_2_1
>> >> */
>> >
>> > Just use MX23_PAD_SSP1_DETECT__GPIO_2_1 directly ?
>>
>> make[1]: Nothing to be done for `all'.
>> make[1]: Leaving directory `/home/otavio/hacking/u-boot/drivers/mtd/spi'
>> status_led.c:46:7: error: 'MX23_PAD_SSP1_DETECT__GPIO_2_1' undeclared
>> here (not in a function)
>
> #include iomux-mx23 missing ?

...
make[1]: Entering directory `/home/otavio/hacking/u-boot/tools'
/home/otavio/hacking/u-boot/include/asm/arch/iomux.h: Assembler messages:
/home/otavio/hacking/u-boot/include/asm/arch/iomux.h:38: Error: bad
instruction `typedef u32 iomux_cfg_t'
/home/otavio/hacking/u-boot/include/asm/arch/iomux.h:112: Error: bad
instruction `static inline unsigned int PAD_BANK(iomux_cfg_t pad)'
/home/otavio/hacking/u-boot/include/asm/arch/iomux.h:113: Error: junk
at end of line, first unrecognized character is `{'
/home/otavio/hacking/u-boot/include/asm/arch/iomux.h:114: Error: bad
instruction `return (pad&((iomux_cfg_t)0x7<<0))>>0'
...

I had try it before of course ;)

--
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
Marek Vasut Jan. 28, 2013, 3:23 p.m. UTC | #5
Dear Otavio Salvador,

> On Mon, Jan 28, 2013 at 1:18 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Otavio Salvador,
> > 
> >> On Mon, Jan 28, 2013 at 1:10 PM, Marek Vasut <marex@denx.de> wrote:
> >> > Dear Otavio Salvador,
> >> > 
> >> > [..]
> >> > 
> >> >>  /*
> >> >> 
> >> >> + * Status LED
> >> >> + */
> >> >> +#define      CONFIG_STATUS_LED
> >> >> +#define      CONFIG_GPIO_LED
> >> >> +#define      CONFIG_BOARD_SPECIFIC_LED
> >> >> +#define      STATUS_LED_BOOT 0
> >> >> +#define      STATUS_LED_BIT  0x030a /*
> >> >> MX23_PAD_SSP1_DETECT__GPIO_2_1 */
> >> > 
> >> > Just use MX23_PAD_SSP1_DETECT__GPIO_2_1 directly ?
> >> 
> >> make[1]: Nothing to be done for `all'.
> >> make[1]: Leaving directory `/home/otavio/hacking/u-boot/drivers/mtd/spi'
> >> status_led.c:46:7: error: 'MX23_PAD_SSP1_DETECT__GPIO_2_1' undeclared
> >> here (not in a function)
> > 
> > #include iomux-mx23 missing ?
> 
> ...
> make[1]: Entering directory `/home/otavio/hacking/u-boot/tools'
> /home/otavio/hacking/u-boot/include/asm/arch/iomux.h: Assembler messages:
> /home/otavio/hacking/u-boot/include/asm/arch/iomux.h:38: Error: bad
> instruction `typedef u32 iomux_cfg_t'
> /home/otavio/hacking/u-boot/include/asm/arch/iomux.h:112: Error: bad
> instruction `static inline unsigned int PAD_BANK(iomux_cfg_t pad)'
> /home/otavio/hacking/u-boot/include/asm/arch/iomux.h:113: Error: junk
> at end of line, first unrecognized character is `{'
> /home/otavio/hacking/u-boot/include/asm/arch/iomux.h:114: Error: bad
> instruction `return (pad&((iomux_cfg_t)0x7<<0))>>0'
> ...
> 
> I had try it before of course ;)

So iomux.h is not safe to be included in assembler fixes ... fix it with some 
ifdef __ASSEMBLY__ as the rest of the header files are .

Best regards,
Marek Vasut
diff mbox

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..3bbf5ad 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_3V3 | MXS_PAD_4MA | MXS_PAD_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 7983c5d..ef8aaae 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	0x030a /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */
+#define	STATUS_LED_STATE	STATUS_LED_ON
+#define	STATUS_LED_PERIOD	(CONFIG_SYS_HZ / 2)
+
+/*
  * MMC Driver
  */
 #ifdef	CONFIG_CMD_MMC