* [PATCH v1 0/2] Add for imx8x SoC get_boot_type command @ 2026-01-24 5:50 Heiko Schocher 2026-01-24 5:50 ` [PATCH v1 1/2] imx: scu_api: implement sc_misc_get_boot_type Heiko Schocher 2026-01-24 5:50 ` [PATCH v1 2/2] imx8qx: misc: add command for getting boottype Heiko Schocher 0 siblings, 2 replies; 5+ messages in thread From: Heiko Schocher @ 2026-01-24 5:50 UTC (permalink / raw) To: U-Boot Mailing List Cc: Heiko Schocher, Andrew Goodbody, Fabio Estevam, John Ripple, NXP i.MX U-Boot Team, Stefano Babic, Tom Rini, Walter Schweizer add function sc_misc_get_boot_type() which requests from the SC the current used boottype and add a comand "boottype" which saves the current boot_type in environment variable "boottype", so we can use this later. Heiko Schocher (2): imx: scu_api: implement sc_misc_get_boot_type imx8qx: misc: add command for getting boottype arch/arm/mach-imx/imx8/misc.c | 27 +++++++++++++++++++++++++++ drivers/misc/imx8/scu_api.c | 25 +++++++++++++++++++++++++ include/firmware/imx/sci/sci.h | 1 + 3 files changed, 53 insertions(+) Azure build (series is in a bunch of siemens patches sending now to mainline): https://dev.azure.com/hs0298/hs/_build/results?buildId=202&view=results -- 2.20.1 base-commit: 5c3e84731b68d26340e6acf8e27c7c680aa55360 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/2] imx: scu_api: implement sc_misc_get_boot_type 2026-01-24 5:50 [PATCH v1 0/2] Add for imx8x SoC get_boot_type command Heiko Schocher @ 2026-01-24 5:50 ` Heiko Schocher 2026-01-26 1:47 ` Peng Fan 2026-01-24 5:50 ` [PATCH v1 2/2] imx8qx: misc: add command for getting boottype Heiko Schocher 1 sibling, 1 reply; 5+ messages in thread From: Heiko Schocher @ 2026-01-24 5:50 UTC (permalink / raw) To: U-Boot Mailing List Cc: Heiko Schocher, Walter Schweizer, Andrew Goodbody, John Ripple, Tom Rini add function sc_misc_get_boot_type() which returns the boot type. Signed-off-by: Heiko Schocher <hs@nabladev.com> Signed-off-by: Walter Schweizer <walter.schweizer@siemens.com> --- drivers/misc/imx8/scu_api.c | 25 +++++++++++++++++++++++++ include/firmware/imx/sci/sci.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c index d9cc7acb970..c15a4a629ad 100644 --- a/drivers/misc/imx8/scu_api.c +++ b/drivers/misc/imx8/scu_api.c @@ -374,6 +374,31 @@ void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status) __func__, status, RPC_R8(&msg)); } +int sc_misc_get_boot_type(sc_ipc_t ipc, sc_misc_bt_t *type) +{ + struct udevice *dev = gd->arch.scu_dev; + int size = sizeof(struct sc_rpc_msg_s); + struct sc_rpc_msg_s msg; + int ret; + + if (!dev) + hang(); + + RPC_VER(&msg) = SC_RPC_VERSION; + RPC_SIZE(&msg) = 1U; + RPC_SVC(&msg) = (u8)SC_RPC_SVC_MISC; + RPC_FUNC(&msg) = (u8)MISC_FUNC_GET_BOOT_TYPE; + + ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size); + if (ret < 0) + return ret; + + if (type) + *type = (u8)RPC_U8(&msg, 0U); + + return 0; +} + int sc_misc_get_boot_container(sc_ipc_t ipc, u8 *idx) { struct udevice *dev = gd->arch.scu_dev; diff --git a/include/firmware/imx/sci/sci.h b/include/firmware/imx/sci/sci.h index 876d52cac35..7f4ca735663 100644 --- a/include/firmware/imx/sci/sci.h +++ b/include/firmware/imx/sci/sci.h @@ -86,6 +86,7 @@ int sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl, u32 *val); void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev); void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status); +int sc_misc_get_boot_type(sc_ipc_t ipc, sc_misc_bt_t *type); int sc_misc_get_boot_container(sc_ipc_t ipc, u8 *idx); void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit); int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val); -- 2.20.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] imx: scu_api: implement sc_misc_get_boot_type 2026-01-24 5:50 ` [PATCH v1 1/2] imx: scu_api: implement sc_misc_get_boot_type Heiko Schocher @ 2026-01-26 1:47 ` Peng Fan 0 siblings, 0 replies; 5+ messages in thread From: Peng Fan @ 2026-01-26 1:47 UTC (permalink / raw) To: Heiko Schocher Cc: U-Boot Mailing List, Walter Schweizer, Andrew Goodbody, John Ripple, Tom Rini On Sat, Jan 24, 2026 at 06:50:43AM +0100, Heiko Schocher wrote: >add function sc_misc_get_boot_type() which returns the >boot type. > >Signed-off-by: Heiko Schocher <hs@nabladev.com> >Signed-off-by: Walter Schweizer <walter.schweizer@siemens.com> > Reviewed-by: Peng Fan <peng.fan@nxp.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] imx8qx: misc: add command for getting boottype 2026-01-24 5:50 [PATCH v1 0/2] Add for imx8x SoC get_boot_type command Heiko Schocher 2026-01-24 5:50 ` [PATCH v1 1/2] imx: scu_api: implement sc_misc_get_boot_type Heiko Schocher @ 2026-01-24 5:50 ` Heiko Schocher 2026-01-26 1:50 ` Peng Fan 1 sibling, 1 reply; 5+ messages in thread From: Heiko Schocher @ 2026-01-24 5:50 UTC (permalink / raw) To: U-Boot Mailing List Cc: Heiko Schocher, Walter Schweizer, Fabio Estevam, NXP i.MX U-Boot Team, Stefano Babic, Tom Rini add boottype command, which saves the boot_type primary (0) or fallback (1) in environment variable "boottype". If argument "print" is passed, it also prints the boottype on console. Signed-off-by: Heiko Schocher <hs@nabladev.com> Signed-off-by: Walter Schweizer <walter.schweizer@siemens.com> --- arch/arm/mach-imx/imx8/misc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/mach-imx/imx8/misc.c b/arch/arm/mach-imx/imx8/misc.c index c77104d0338..f233432f608 100644 --- a/arch/arm/mach-imx/imx8/misc.c +++ b/arch/arm/mach-imx/imx8/misc.c @@ -1,4 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ +#include <command.h> +#include <env.h> #include <log.h> #include <firmware/imx/sci/sci.h> #include <asm/mach-imx/sys_proto.h> @@ -62,3 +64,28 @@ void build_info(void) printf("Build: SCFW %08x, SECO-FW %08x, ATF %s\n", sc_commit, seco_commit, (char *)&atf_commit); } + +int do_boottype(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) +{ + sc_misc_bt_t boot_type; + + if (argc > 2) + return CMD_RET_USAGE; + + if (sc_misc_get_boot_type(-1, &boot_type) != 0) { + puts("boottype cannot be retrieved\n"); + return CMD_RET_FAILURE; + } + + if (argc > 1) + printf("Boottype: %d\n", boot_type); + + env_set_ulong("boottype", boot_type); + + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD(boottype, CONFIG_SYS_MAXARGS, 2, do_boottype, + "save current boot-container in env variable 'boottype'", + "[print] - print current boottype" +); -- 2.20.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 2/2] imx8qx: misc: add command for getting boottype 2026-01-24 5:50 ` [PATCH v1 2/2] imx8qx: misc: add command for getting boottype Heiko Schocher @ 2026-01-26 1:50 ` Peng Fan 0 siblings, 0 replies; 5+ messages in thread From: Peng Fan @ 2026-01-26 1:50 UTC (permalink / raw) To: Heiko Schocher Cc: U-Boot Mailing List, Walter Schweizer, Fabio Estevam, NXP i.MX U-Boot Team, Stefano Babic, Tom Rini Hi Heiko, On Sat, Jan 24, 2026 at 06:50:44AM +0100, Heiko Schocher wrote: >add boottype command, which saves the boot_type >primary (0) or fallback (1) in environment >variable "boottype". If argument "print" is >passed, it also prints the boottype on console. > >Signed-off-by: Heiko Schocher <hs@nabladev.com> >Signed-off-by: Walter Schweizer <walter.schweizer@siemens.com> >--- > > arch/arm/mach-imx/imx8/misc.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > >diff --git a/arch/arm/mach-imx/imx8/misc.c b/arch/arm/mach-imx/imx8/misc.c >index c77104d0338..f233432f608 100644 >--- a/arch/arm/mach-imx/imx8/misc.c >+++ b/arch/arm/mach-imx/imx8/misc.c >@@ -1,4 +1,6 @@ > // SPDX-License-Identifier: GPL-2.0+ >+#include <command.h> >+#include <env.h> > #include <log.h> > #include <firmware/imx/sci/sci.h> > #include <asm/mach-imx/sys_proto.h> >@@ -62,3 +64,28 @@ void build_info(void) > printf("Build: SCFW %08x, SECO-FW %08x, ATF %s\n", > sc_commit, seco_commit, (char *)&atf_commit); > } >+ >+int do_boottype(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) >+{ >+ sc_misc_bt_t boot_type; >+ >+ if (argc > 2) >+ return CMD_RET_USAGE; >+ >+ if (sc_misc_get_boot_type(-1, &boot_type) != 0) { >+ puts("boottype cannot be retrieved\n"); >+ return CMD_RET_FAILURE; >+ } >+ >+ if (argc > 1) >+ printf("Boottype: %d\n", boot_type); >+ >+ env_set_ulong("boottype", boot_type); >+ >+ return CMD_RET_SUCCESS; >+} >+ >+U_BOOT_CMD(boottype, CONFIG_SYS_MAXARGS, 2, do_boottype, >+ "save current boot-container in env variable 'boottype'", >+ "[print] - print current boottype" An description to describe the value, saying which value is for eMMC, and which for SD. Or even better to decode the value in above function. Thanks, Peng >+); >-- >2.20.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-26 1:50 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-24 5:50 [PATCH v1 0/2] Add for imx8x SoC get_boot_type command Heiko Schocher 2026-01-24 5:50 ` [PATCH v1 1/2] imx: scu_api: implement sc_misc_get_boot_type Heiko Schocher 2026-01-26 1:47 ` Peng Fan 2026-01-24 5:50 ` [PATCH v1 2/2] imx8qx: misc: add command for getting boottype Heiko Schocher 2026-01-26 1:50 ` Peng Fan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox