diff options
author | Lukasz Majewski <lukma@denx.de> | 2020-09-25 17:13:09 +0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2020-11-01 15:53:40 +0100 |
commit | 9c1f71060b1396fd2940e9c7b0b08f6baf1d2a36 (patch) | |
tree | 5a740d6ff1d1cb890a7e5c496d9dbec946408579 | |
parent | fc4e69f63f96d6f8898864f1a9f9b0a4c0ac426b (diff) | |
download | u-boot-9c1f71060b1396fd2940e9c7b0b08f6baf1d2a36.zip u-boot-9c1f71060b1396fd2940e9c7b0b08f6baf1d2a36.tar.gz u-boot-9c1f71060b1396fd2940e9c7b0b08f6baf1d2a36.tar.bz2 |
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>
-rw-r--r-- | board/k+p/kp_imx53/kp_imx53.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/board/k+p/kp_imx53/kp_imx53.c b/board/k+p/kp_imx53/kp_imx53.c index eb5b67d..efca3e0 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); + } +} |