All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] misc: scu_api: Add SCFW API to get the index of boot container set
@ 2020-06-09 10:34 Ye Li
  2020-06-09 10:34 ` [PATCH 2/3] spl: mmc: Move the eMMC boot part index to weak function Ye Li
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ye Li @ 2020-06-09 10:34 UTC (permalink / raw)
  To: u-boot

Add SCFW API sc_misc_get_boot_container to get current boot container
set index.
The index value returns 1 for primary container set, 2 for secondary
container set.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/include/asm/arch-imx8/sci/rpc.h |  1 +
 arch/arm/include/asm/arch-imx8/sci/sci.h |  1 +
 drivers/misc/imx8/scu_api.c              | 25 +++++++++++++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/arch/arm/include/asm/arch-imx8/sci/rpc.h b/arch/arm/include/asm/arch-imx8/sci/rpc.h
index c1a9c35..9f55904 100644
--- a/arch/arm/include/asm/arch-imx8/sci/rpc.h
+++ b/arch/arm/include/asm/arch-imx8/sci/rpc.h
@@ -115,6 +115,7 @@ struct sc_rpc_msg_s {
 #define MISC_FUNC_GET_TEMP			13U
 #define MISC_FUNC_GET_BOOT_DEV			16U
 #define MISC_FUNC_GET_BUTTON_STATUS		18U
+#define MISC_FUNC_GET_BOOT_CONTAINER	36U
 
 /* PAD RPC */
 #define PAD_FUNC_UNKNOWN			0
diff --git a/arch/arm/include/asm/arch-imx8/sci/sci.h b/arch/arm/include/asm/arch-imx8/sci/sci.h
index f91f7cc..1c29209 100644
--- a/arch/arm/include/asm/arch-imx8/sci/sci.h
+++ b/arch/arm/include/asm/arch-imx8/sci/sci.h
@@ -82,6 +82,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_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);
 int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp,
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index 3e38edb..20b74fb 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_container(sc_ipc_t ipc, u8 *idx)
+{
+	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_CONTAINER;
+
+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+	if (ret < 0)
+		return ret;
+
+	if (idx)
+		*idx = (u8)RPC_U8(&msg, 0U);
+
+	return 0;
+}
+
 void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit)
 {
 	struct udevice *dev = gd->arch.scu_dev;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-16 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 10:34 [PATCH 1/3] misc: scu_api: Add SCFW API to get the index of boot container set Ye Li
2020-06-09 10:34 ` [PATCH 2/3] spl: mmc: Move the eMMC boot part index to weak function Ye Li
2020-06-09 10:34 ` [PATCH 3/3] imx8: spl: Support booting from secondary container set Ye Li
2020-07-16 17:49 ` [PATCH 1/3] misc: scu_api: Add SCFW API to get the index of boot " sbabic at denx.de

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.