* [PATCH] imx: spl_imx_romapi: Get and print boot stage
@ 2023-02-03 10:21 Ye Li
2023-03-30 8:43 ` sbabic
0 siblings, 1 reply; 2+ messages in thread
From: Ye Li @ 2023-02-03 10:21 UTC (permalink / raw)
To: sbabic, u-boot; +Cc: peng.fan, uboot-imx
Get and print boot stage through ROM API in SPL
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/include/asm/mach-imx/sys_proto.h | 7 +++++++
arch/arm/mach-imx/spl_imx_romapi.c | 22 +++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h
index dd0d3f2..d70d8bb 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -170,6 +170,13 @@ enum boot_dev_type_e {
BT_DEV_TYPE_INVALID = 0xFF
};
+enum boot_stage_type {
+ BT_STAGE_PRIMARY = 0x6,
+ BT_STAGE_SECONDARY = 0x9,
+ BT_STAGE_RECOVERY = 0xa,
+ BT_STAGE_USB = 0x5,
+};
+
#define QUERY_ROM_VER 1
#define QUERY_BT_DEV 2
#define QUERY_PAGE_SZ 3
diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c
index aa5d23a..830d5d1 100644
--- a/arch/arm/mach-imx/spl_imx_romapi.c
+++ b/arch/arm/mach-imx/spl_imx_romapi.c
@@ -341,15 +341,35 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
int ret;
- u32 boot;
+ u32 boot, bstage;
ret = rom_api_query_boot_infor(QUERY_BT_DEV, &boot);
+ ret |= rom_api_query_boot_infor(QUERY_BT_STAGE, &bstage);
if (ret != ROM_API_OKAY) {
puts("ROMAPI: failure at query_boot_info\n");
return -1;
}
+ printf("Boot Stage: ");
+
+ switch (bstage) {
+ case BT_STAGE_PRIMARY:
+ printf("Primary boot\n");
+ break;
+ case BT_STAGE_SECONDARY:
+ printf("Secondary boot\n");
+ break;
+ case BT_STAGE_RECOVERY:
+ printf("Recovery boot\n");
+ break;
+ case BT_STAGE_USB:
+ printf("USB boot\n");
+ break;
+ default:
+ printf("Unknow (0x%x)\n", bstage);
+ }
+
if (is_boot_from_stream_device(boot))
return spl_romapi_load_image_stream(spl_image, bootdev);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] imx: spl_imx_romapi: Get and print boot stage
2023-02-03 10:21 [PATCH] imx: spl_imx_romapi: Get and print boot stage Ye Li
@ 2023-03-30 8:43 ` sbabic
0 siblings, 0 replies; 2+ messages in thread
From: sbabic @ 2023-03-30 8:43 UTC (permalink / raw)
To: Ye Li, u-boot
> Get and print boot stage through ROM API in SPL
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, next, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-30 8:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-03 10:21 [PATCH] imx: spl_imx_romapi: Get and print boot stage Ye Li
2023-03-30 8:43 ` sbabic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox