[PATCH 1/3] arm: Implement show_boot_progress() for imx53's HSC and DDC devices

This patch provides information regarding the boot stage with using LEDs. On the very beginning of U-Boot execution the GREEN LED is turned on. When the execution is passed to Linux kernel the GREEN LED is off and RED one is ON.
Afterwards, when Linux takes over the execution, the "heartbeat" driver provides indication if the board is still alive.
Please also note that this patch uses {set|clr}bits_le32 macros as turning ON GREEN LED is performed in a _very_ early stage of U-Boot execution before DM_GPIOs are initialized.
Signed-off-by: Lukasz Majewski lukma@denx.de
---
board/k+p/kp_imx53/kp_imx53.c | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/board/k+p/kp_imx53/kp_imx53.c b/board/k+p/kp_imx53/kp_imx53.c index eb5b67d1e6..efca3e0965 100644 --- a/board/k+p/kp_imx53/kp_imx53.c +++ b/board/k+p/kp_imx53/kp_imx53.c @@ -17,11 +17,13 @@ #include <env.h> #include <power/pmic.h> #include <fsl_pmic.h> +#include <bootstage.h> #include "kp_id_rev.h"
#define BOOSTER_OFF IMX_GPIO_NR(2, 23) #define LCD_BACKLIGHT IMX_GPIO_NR(1, 1) #define KEY1 IMX_GPIO_NR(2, 26) +#define LED_RED IMX_GPIO_NR(3, 28)
DECLARE_GLOBAL_DATA_PTR;
@@ -151,3 +153,52 @@ int board_late_init(void)
return ret; } + +#define GPIO_DR 0x0 +#define GPIO_GDIR 0x4 +#define GPIO_ALT1 0x1 +#define GPIO5_BASE 0x53FDC000 +#define IOMUXC_EIM_WAIT 0x53FA81E4 +/* Green LED: GPIO5_0 */ +#define GPIO_GREEN BIT(0) + +void show_boot_progress(int status) +{ + /* + * This BOOTSTAGE_ID is called at very early stage of execution. DM gpio + * is not yet initialized. + */ + if (status == BOOTSTAGE_ID_START_UBOOT_F) { + /* + * After ROM execution the EIM_WAIT PAD is set as ALT0 + * (according to RM it shall be ALT1 after reset). To use it as + * GPIO we need to set it to ALT1. + */ + setbits_le32(((uint32_t *)(IOMUXC_EIM_WAIT)), GPIO_ALT1); + + /* Configure green LED GPIO pin direction */ + setbits_le32(((uint32_t *)(GPIO5_BASE + GPIO_GDIR)), + GPIO_GREEN); + /* Turn on green LED */ + setbits_le32(((uint32_t *)(GPIO5_BASE + GPIO_DR)), GPIO_GREEN); + } + + /* + * This BOOTSTAGE_ID is called just before handling execution to kernel + * - i.e. gpio subsystem is already initialized + */ + if (status == BOOTSTAGE_ID_BOOTM_HANDOFF) { + /* + * Off green LED - the same approach - i.e. non dm gpio + * (*bits_le32) is used as in the very early stage. + */ + clrbits_le32(((uint32_t *)(GPIO5_BASE + GPIO_DR)), + GPIO_GREEN); + + /* + * On red LED + */ + gpio_request(LED_RED, "LED_RED_ERROR"); + gpio_direction_output(LED_RED, 1); + } +}

Those two LEDs are used to indicate U-Boot's boot stage.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
arch/arm/dts/imx53-kp.dts | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm/dts/imx53-kp.dts b/arch/arm/dts/imx53-kp.dts index 5f9e4fad82..03e571d274 100644 --- a/arch/arm/dts/imx53-kp.dts +++ b/arch/arm/dts/imx53-kp.dts @@ -131,6 +131,10 @@ MX53_PAD_GPIO_1__GPIO1_1 0x1e4 /* KEY1 GPIO */ MX53_PAD_EIM_RW__GPIO2_26 0x1e4 + /* LED GREEN GPIO */ + MX53_PAD_EIM_WAIT__GPIO5_0 0x1e4 + /* LED RED GPIO */ + MX53_PAD_EIM_D28__GPIO3_28 0x1e4 >; };

Those two LEDs are used to indicate U-Boot's boot stage. Signed-off-by: Lukasz Majewski lukma@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

This option allows using show_boot_progress to visualize the state of boot process.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
configs/kp_imx53_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/kp_imx53_defconfig b/configs/kp_imx53_defconfig index b6845f8e87..8778d48664 100644 --- a/configs/kp_imx53_defconfig +++ b/configs/kp_imx53_defconfig @@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET_REDUND=0x102000 CONFIG_DEFAULT_DEVICE_TREE="imx53-kp" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx53loco/imximage.cfg" +CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_SILENT_CONSOLE=y # CONFIG_SILENT_CONSOLE_UPDATE_ON_SET is not set CONFIG_SYS_CONSOLE_IS_IN_ENV=y

This option allows using show_boot_progress to visualize the state of boot process. Signed-off-by: Lukasz Majewski lukma@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

This patch provides information regarding the boot stage with using LEDs. On the very beginning of U-Boot execution the GREEN LED is turned on. When the execution is passed to Linux kernel the GREEN LED is off and RED one is ON. Afterwards, when Linux takes over the execution, the "heartbeat" driver provides indication if the board is still alive. Please also note that this patch uses {set|clr}bits_le32 macros as turning ON GREEN LED is performed in a _very_ early stage of U-Boot execution before DM_GPIOs are initialized. Signed-off-by: Lukasz Majewski lukma@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic
participants (2)
-
Lukasz Majewski
-
sbabic@denx.de