Skip to contentSkip to conversation

led: Use STATUS_LED_ON and STATUS_LED_OFF when calling __led_set

PATCH Superseded Otavio Salvador 2 participants 4 messages Jan 27, 2013

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#2 lore raw

PATCH 2/2 mx23_olinuxino: Add support for status LED

In reply to Otavio Salvador

Dear Otavio Salvador,

Quoted 2 lines

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

1/2 is missing ?

Quoted 23 lines
---
 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(+)
(quoted diff) +0 -0

b/board/olimex/mx23_olinuxino/mx23_olinuxino.c index 6a6053b..2501417 100644

board/olimex/mx23_olinuxino/mx23_olinuxino.c +3 -0
@@ -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;
 

board/olimex/mx23_olinuxino/mx23_olinuxino.c int board_init(void) · line 78

Quoted 9 lines
board/olimex/mx23_olinuxino/mx23_olinuxino.c +4 -0
@@ -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 ?

board/olimex/mx23_olinuxino/spl_boot.c const iomux_cfg_t iomux_setup[] = { · line 89

Quoted 11 lines
(quoted diff) +0 -0

b/board/olimex/mx23_olinuxino/spl_boot.c index 7def8bc..ed8f8d9 100644

board/olimex/mx23_olinuxino/spl_boot.c +3 -0
@@ -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 ?

Quoted 18 lines
board/olimex/mx23_olinuxino/spl_boot.c +0 -0
 	/* MMC 0 */
 	MX23_PAD_SSP1_CMD__SSP1_CMD | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_DATA0__SSP1_DATA0 | MUX_CONFIG_SSP,
(quoted diff) +0 -0

b/include/configs/mx23_olinuxino.h index 4658aea..c57bb67 100644

include/configs/mx23_olinuxino.h +1 -0
@@ -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 */
 

include/configs/mx23_olinuxino.h line 124

Quoted 10 lines
include/configs/mx23_olinuxino.h +9 -0
 /*
+ * 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?

include/configs/mx23_olinuxino.h line 129

Quoted 4 lines
include/configs/mx23_olinuxino.h +1 -0
+/*
  * MMC Driver
  */
 #ifdef	CONFIG_CMD_MMC

Best regards,
Marek Vasut

#0 lore raw

PATCH 1/2 led: Use STATUS_LED_ON and STATUS_LED_OFF when calling __led_set

This fixes the gpio_led driver which needs to compare againt a STATUS_LED_ON to enable a led.

---
 common/cmd_led.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
common/cmd_led.c +4 -2
index 7f5ab43..84f79fa 100644
@@ -110,13 +110,15 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				if (led_commands[i].on)
 					led_commands[i].on();
 				else
-					__led_set(led_commands[i].mask, 1);
+					__led_set(led_commands[i].mask,
+							  STATUS_LED_ON);
 				break;
 			case LED_OFF:
 				if (led_commands[i].off)
 					led_commands[i].off();
 				else
-					__led_set(led_commands[i].mask, 0);
+					__led_set(led_commands[i].mask,
+							  STATUS_LED_OFF);
 				break;
 			case LED_TOGGLE:
 				if (led_commands[i].toggle)
Signature · 1 line
1.8.1
#1 lore raw

PATCH 2/2 mx23_olinuxino: Add support for status LED

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

---
 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(+)
board/olimex/mx23_olinuxino/mx23_olinuxino.c +7 -0
index 6a6053b..2501417 100644
@@ -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;
 }
board/olimex/mx23_olinuxino/spl_boot.c +4 -0
index 7def8bc..ed8f8d9 100644
@@ -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,
include/configs/mx23_olinuxino.h +12 -0
index 4658aea..c57bb67 100644
@@ -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
Signature · 1 line
1.8.1
#3 lore raw

PATCH 2/2 mx23_olinuxino: Add support for status LED

In reply to Marek Vasut
Quoted 6 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 2 lines

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.

Quoted 26 lines
Quoted 26 lines
---
 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(+)
(quoted diff) +0 -0

b/board/olimex/mx23_olinuxino/mx23_olinuxino.c index 6a6053b..2501417 100644

board/olimex/mx23_olinuxino/mx23_olinuxino.c +3 -0
@@ -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;
 
Quoted 9 lines

board/olimex/mx23_olinuxino/mx23_olinuxino.c int board_init(void) · line 78

Quoted 6 lines
board/olimex/mx23_olinuxino/mx23_olinuxino.c +4 -0
+#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.

Quoted 8 lines
Quoted 8 lines
(quoted diff) +0 -0

b/board/olimex/mx23_olinuxino/spl_boot.c index 7def8bc..ed8f8d9 100644

board/olimex/mx23_olinuxino/spl_boot.c +0 -0
@@ -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,
 
Quoted 5 lines

board/olimex/mx23_olinuxino/spl_boot.c const iomux_cfg_t iomux_setup[] = { · line 89

Quoted 3 lines
board/olimex/mx23_olinuxino/spl_boot.c +3 -0
+     /* Green LED */
+     MX23_PAD_SSP1_DETECT__GPIO_2_1 |
+             (MXS_PAD_4MA | MXS_PAD_3V3),

NOPULL ?

Not needed; removed for v2.

Quoted 18 lines
Quoted 18 lines
board/olimex/mx23_olinuxino/spl_boot.c +0 -0
      /* MMC 0 */
      MX23_PAD_SSP1_CMD__SSP1_CMD | MUX_CONFIG_SSP,
      MX23_PAD_SSP1_DATA0__SSP1_DATA0 | MUX_CONFIG_SSP,
(quoted diff) +0 -0

b/include/configs/mx23_olinuxino.h index 4658aea..c57bb67 100644

include/configs/mx23_olinuxino.h +1 -0
@@ -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 */
 
Quoted 12 lines

include/configs/mx23_olinuxino.h line 124

Quoted 10 lines
include/configs/mx23_olinuxino.h +9 -0
 /*
+ * 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 at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br