Skip to contentSkip to conversation

led: Use STATUS_LED_ON and STATUS_LED_OFF when calling __led_set

PATCH Superseded Otavio Salvador 3 participants 11 messages Jan 28, 2013

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/3 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.

---
Changes in v4: None
Changes in v3: None
Changes in v2: None

 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 v4 2/3 mxs: Fix iomux.h to not break build during assembly stage

---
Changes in v4:
- New patch

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-mxs/iomux.h | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/include/asm/arch-mxs/iomux.h +5 -0
index 7abdf58..4288715 100644
@@ -21,6 +21,10 @@
 #ifndef __MACH_MXS_IOMUX_H__
 #define __MACH_MXS_IOMUX_H__
 
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+
 /*
  * IOMUX/PAD Bit field definitions
  *
@@ -165,4 +169,5 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad);
  */
 int mxs_iomux_setup_multiple_pads(const iomux_cfg_t *pad_list, unsigned count);
 
+#endif /* __ASSEMBLY__ */
 #endif /* __MACH_MXS_IOMUX_H__*/
Signature · 1 line
1.8.1
#2 lore raw

PATCH v4 2/3 mxs: Fix iomux.h to not break build during assembly stage

Dear Otavio Salvador,

Missing commit message.

Quoted 16 lines

---
Changes in v4:
- New patch

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-mxs/iomux.h | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-mxs/iomux.h index 7abdf58..4288715 100644

arch/arm/include/asm/arch-mxs/iomux.h line 27

Quoted 7 lines
arch/arm/include/asm/arch-mxs/iomux.h +4 -0
@@ -21,6 +21,10 @@
 #ifndef __MACH_MXS_IOMUX_H__
 #define __MACH_MXS_IOMUX_H__
 
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+

Is this needed?

Quoted 10 lines
arch/arm/include/asm/arch-mxs/iomux.h +1 -0
 /*
  * IOMUX/PAD Bit field definitions
  *
@@ -165,4 +169,5 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad);
  */
 int mxs_iomux_setup_multiple_pads(const iomux_cfg_t *pad_list, unsigned
 count);
 
+#endif /* __ASSEMBLY__ */

#endif /* __MACH_MXS_IOMUX_H__*/

Best regards,
Marek Vasut

#3 lore raw

PATCH v4 2/3 mxs: Fix iomux.h to not break build during assembly stage

Quoted 3 lines · Marek Vasut

Dear Otavio Salvador,

Missing commit message.

I think short description is clear enough. What you'd like me to put in long one?

Quoted 19 lines
Quoted 19 lines

---
Changes in v4:
- New patch

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-mxs/iomux.h | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-mxs/iomux.h index 7abdf58..4288715 100644

arch/arm/include/asm/arch-mxs/iomux.h +0 -0
@@ -21,6 +21,10 @@
 #ifndef __MACH_MXS_IOMUX_H__
 #define __MACH_MXS_IOMUX_H__
 
Quoted 6 lines

arch/arm/include/asm/arch-mxs/iomux.h line 27

Quoted 4 lines
arch/arm/include/asm/arch-mxs/iomux.h +4 -0
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+

Is this needed?

Yes; or I would not have added it right? :)

Quoted 8 lines
Quoted 8 lines
arch/arm/include/asm/arch-mxs/iomux.h +0 -0
 /*
  * IOMUX/PAD Bit field definitions
  *
@@ -165,4 +169,5 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad);
  */
 int mxs_iomux_setup_multiple_pads(const iomux_cfg_t *pad_list, unsigned
 count);
 
Quoted 5 lines
Quoted 2 lines
arch/arm/include/asm/arch-mxs/iomux.h +1 -0
+#endif /* __ASSEMBLY__ */

#endif /* __MACH_MXS_IOMUX_H__*/

Best regards,
Marek Vasut

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

#4 lore raw

PATCH v4 2/3 mxs: Fix iomux.h to not break build during assembly stage

Dear Otavio Salvador,

Quoted 7 lines · Marek Vasut
Quoted 3 lines

Dear Otavio Salvador,

Missing commit message.

I think short description is clear enough. What you'd like me to put in long one?

Reasoning why this patch is necessary.

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

---
Changes in v4:
- New patch

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-mxs/iomux.h | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-mxs/iomux.h index 7abdf58..4288715 100644

arch/arm/include/asm/arch-mxs/iomux.h +0 -0
@@ -21,6 +21,10 @@
 
 #ifndef __MACH_MXS_IOMUX_H__
 #define __MACH_MXS_IOMUX_H__
 
Quoted 8 lines
Quoted 6 lines

arch/arm/include/asm/arch-mxs/iomux.h line 27

Quoted 4 lines
arch/arm/include/asm/arch-mxs/iomux.h +4 -0
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+

Is this needed?

Yes; or I would not have added it right? :)

Why is it needed?

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
arch/arm/include/asm/arch-mxs/iomux.h +0 -0
 /*
 

* IOMUX/PAD Bit field definitions
*

arch/arm/include/asm/arch-mxs/iomux.h +0 -0
@@ -165,4 +169,5 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad);
 
  */
 
 int mxs_iomux_setup_multiple_pads(const iomux_cfg_t *pad_list, unsigned
Quoted 8 lines
Quoted 5 lines

count);

+#endif /* __ASSEMBLY__ */

#endif /* __MACH_MXS_IOMUX_H__*/

Best regards,
Marek Vasut

Quoted 4 lines

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

Best regards,
Marek Vasut

#5 lore raw

PATCH v4 2/3 mxs: Fix iomux.h to not break build during assembly stage

Quoted 11 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 7 lines · Marek Vasut
Quoted 3 lines

Dear Otavio Salvador,

Missing commit message.

I think short description is clear enough. What you'd like me to put in long one?

Reasoning why this patch is necessary.

Well, it seems quite clear it fix a build failure when it is used in assembly stage; it is clear enough for me, in the shortlog

Quoted 51 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

---
Changes in v4:
- New patch

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-mxs/iomux.h | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-mxs/iomux.h index 7abdf58..4288715 100644

arch/arm/include/asm/arch-mxs/iomux.h +0 -0
@@ -21,6 +21,10 @@
 
 #ifndef __MACH_MXS_IOMUX_H__
 #define __MACH_MXS_IOMUX_H__
 
Quoted 8 lines
Quoted 6 lines

arch/arm/include/asm/arch-mxs/iomux.h line 27

Quoted 4 lines
arch/arm/include/asm/arch-mxs/iomux.h +4 -0
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+

Is this needed?

Yes; or I would not have added it right? :)

Why is it needed?

Quoted 20 lines
Quoted 19 lines
Quoted 11 lines
arch/arm/include/asm/arch-mxs/iomux.h +0 -0
 /*
 

* IOMUX/PAD Bit field definitions
*

arch/arm/include/asm/arch-mxs/iomux.h +0 -0
@@ -165,4 +169,5 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad);
 
  */
 
 int mxs_iomux_setup_multiple_pads(const iomux_cfg_t *pad_list, unsigned
Quoted 5 lines

count);

+#endif /* __ASSEMBLY__ */

#endif /* __MACH_MXS_IOMUX_H__*/

Best regards,
Marek Vasut

Quoted 7 lines
Quoted 4 lines

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

Best regards,
Marek Vasut

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

#6 lore raw

PATCH v4 2/3 mxs: Fix iomux.h to not break build during assembly stage

Dear Otavio Salvador,

Quoted 8 lines · Marek Vasut
Quoted 7 lines

Dear Otavio Salvador,

Quoted 5 lines · Marek Vasut
Quoted 3 lines

Dear Otavio Salvador,

Missing commit message.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I think short description is clear enough. What you'd like me to put in long one?

Reasoning why this patch is necessary.

Well, it seems quite clear it fix a build failure when it is used in assembly stage; it is clear enough for me, in the shortlog

I don't understand why did you also add the header below. That's not clear.

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Quoted 16 lines

---
Changes in v4:
- New patch

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-mxs/iomux.h | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-mxs/iomux.h index 7abdf58..4288715 100644

arch/arm/include/asm/arch-mxs/iomux.h line 28

Quoted 8 lines
arch/arm/include/asm/arch-mxs/iomux.h +4 -0
@@ -21,6 +21,10 @@
 
 #ifndef __MACH_MXS_IOMUX_H__
 #define __MACH_MXS_IOMUX_H__
 
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+

Is this needed?

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Yes; or I would not have added it right? :)

Why is it needed?

Here, I fail to understand what this has to do with fixing the inclusion of this in assembly files.

Best regards,
Marek Vasut

#7 lore raw

PATCH v4 2/3 mxs: Fix iomux.h to not break build during assembly stage

Quoted 47 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 8 lines · Marek Vasut
Quoted 7 lines

Dear Otavio Salvador,

Quoted 5 lines · Marek Vasut
Quoted 3 lines

Dear Otavio Salvador,

Missing commit message.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I think short description is clear enough. What you'd like me to put in long one?

Reasoning why this patch is necessary.

Well, it seems quite clear it fix a build failure when it is used in assembly stage; it is clear enough for me, in the shortlog

I don't understand why did you also add the header below. That's not clear.

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Quoted 16 lines

---
Changes in v4:
- New patch

Changes in v3: None
Changes in v2: None

 arch/arm/include/asm/arch-mxs/iomux.h | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-mxs/iomux.h index 7abdf58..4288715 100644

arch/arm/include/asm/arch-mxs/iomux.h line 28

Quoted 8 lines
arch/arm/include/asm/arch-mxs/iomux.h +4 -0
@@ -21,6 +21,10 @@
 
 #ifndef __MACH_MXS_IOMUX_H__
 #define __MACH_MXS_IOMUX_H__
 
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+

Is this needed?

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Yes; or I would not have added it right? :)

Why is it needed?

Here, I fail to understand what this has to do with fixing the inclusion of this in assembly files.

I sent v5; hope it is fine now.

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

#8 lore raw

PATCH v4 3/3 mx23_olinuxino: Add support for status LED

In reply to Otavio Salvador

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

---
Changes in v4:
- Use MUX PIN macro

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             | 14 ++++++++++++++
 3 files changed, 25 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..3bbf5ad 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_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,
include/configs/mx23_olinuxino.h +14 -0
index 7983c5d..d019944 100644
@@ -19,6 +19,8 @@
 #ifndef __MX23_OLINUXINO_CONFIG_H__
 #define __MX23_OLINUXINO_CONFIG_H__
 
+#include <asm/arch/iomux-mx23.h>
+
 /*
  * SoC configurations
  */
@@ -56,6 +58,7 @@
 #define	CONFIG_CMD_EXT2
 #define	CONFIG_CMD_FAT
 #define	CONFIG_CMD_GPIO
+#define	CONFIG_CMD_LED
 #define	CONFIG_CMD_MMC
 
 /*
@@ -112,6 +115,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	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
Signature · 1 line
1.8.1
reviewer
#9 lore raw

PATCH v4 3/3 mx23_olinuxino: Add support for status LED

include/configs/mx23_olinuxino.h line 124

Quoted 8 lines · Otavio Salvador

/*
+ * Status LED
+ */

include/configs/mx23_olinuxino.h +5 -0
+#define        CONFIG_STATUS_LED
+#define        CONFIG_GPIO_LED
+#define        CONFIG_BOARD_SPECIFIC_LED
+#define        STATUS_LED_BOOT 0
+#define        STATUS_LED_BIT  MX23_PAD_SSP1_DETECT__GPIO_2_1

Is this really correct?

#define MX23_PAD_SSP1_DETECT__GPIO_2_1 MXS_IOMUX_PAD_NAKED(2, 1,
PAD_MUXSEL_GPIO)

Does the LED API need this symbol?

I thought that you would only need to setup this pin as GPIO and then define something like:
+#define STATUS_LED_BIT 1

#10 lore raw

PATCH v4 3/3 mx23_olinuxino: Add support for status LED

Quoted 14 lines · Fabio Estevam

include/configs/mx23_olinuxino.h line 124

Quoted 8 lines · Otavio Salvador

/*
+ * Status LED
+ */

include/configs/mx23_olinuxino.h +5 -0
+#define        CONFIG_STATUS_LED
+#define        CONFIG_GPIO_LED
+#define        CONFIG_BOARD_SPECIFIC_LED
+#define        STATUS_LED_BOOT 0
+#define        STATUS_LED_BIT  MX23_PAD_SSP1_DETECT__GPIO_2_1

Is this really correct?

Quoted 8 lines

#define MX23_PAD_SSP1_DETECT__GPIO_2_1 MXS_IOMUX_PAD_NAKED(2, 1,
PAD_MUXSEL_GPIO)

Does the LED API need this symbol?

I thought that you would only need to setup this pin as GPIO and then define something like:
+#define STATUS_LED_BIT 1

Maybe it can be done in a better way ... but I failed to figure the GPIO number to use. Any hint?

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