Add for imx8x SoC get_boot_type command
cover Add for imx8x SoC get_boot_type command
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
Signature · 3 lines
2.20.1 base-commit: 5c3e84731b68d26340e6acf8e27c7c680aa55360
PATCH 1/2 imx: scu_api: implement sc_misc_get_boot_type
add function sc_misc_get_boot_type() which returns the boot type.
---
drivers/misc/imx8/scu_api.c | 25 +++++++++++++++++++++++++ include/firmware/imx/sci/sci.h | 1 + 2 files changed, 26 insertions(+)
drivers/misc/imx8/scu_api.c +25 -0
@@ -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;
include/firmware/imx/sci/sci.h +1 -0
@@ -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);
Signature · 1 line
2.20.1
Re: [PATCH v1 1/2] imx: scu_api: implement sc_misc_get_boot_type
Quoted 6 lines · Heiko Schocher
add function
sc_misc_get_boot_type()which returns the boot type.Signed-off-by Heiko Schocher <[email protected]>Signed-off-by Walter Schweizer <[email protected]>
PATCH 2/2 imx8qx: misc: add command for getting boottype
In reply to Heiko Schocheradd 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.
---
arch/arm/mach-imx/imx8/misc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/mach-imx/imx8/misc.c +27 -0
@@ -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" +);
Signature · 1 line
2.20.1
Re: [PATCH v1 2/2] imx8qx: misc: add command for getting boottype
Hi Heiko,
Quoted 41 lines · Heiko Schocher
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 <[email protected]>Signed-off-by Walter Schweizer <[email protected]>---
arch/arm/mach-imx/imx8/misc.c| 27 +++++++++++++++++++++++++++1 file changed, 27 insertions(+)arch/arm/mach-imx/imx8/misc.c +16
-0@@ -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 )
arch/arm/mach-imx/imx8/misc.c void build_info(void) · line 90
Quoted 10 lines
arch/arm/mach-imx/imx8/misc.c +10
-0+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
Quoted 4 lines
arch/arm/mach-imx/imx8/misc.c +1
-0+);Signature · 1 line
2.20.1