[U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info()

Anatolij Gustschin agust at denx.de
Mon Oct 21 15:58:50 UTC 2019


Add function for reading SECO-FW commit id.

Signed-off-by: Anatolij Gustschin <agust at denx.de>
---
 arch/arm/include/asm/arch-imx8/sci/sci.h |  1 +
 drivers/misc/imx8/scu_api.c              | 27 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/include/asm/arch-imx8/sci/sci.h b/arch/arm/include/asm/arch-imx8/sci/sci.h
index 14ee6f999b..df5c60d4ce 100644
--- a/arch/arm/include/asm/arch-imx8/sci/sci.h
+++ b/arch/arm/include/asm/arch-imx8/sci/sci.h
@@ -81,6 +81,7 @@ int sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl,
 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);
 void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit);
+void sc_misc_seco_build_info(sc_ipc_t ipc, u32 *version, 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,
 		     s16 *celsius, s8 *tenths);
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index b2fdeef13a..44d0165c3f 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -349,6 +349,33 @@ void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit)
 		*commit = RPC_U32(&msg, 4);
 }
 
+void sc_misc_seco_build_info(sc_ipc_t ipc, u32 *version, u32 *commit)
+{
+	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_SVC(&msg) = SC_RPC_SVC_MISC;
+	RPC_FUNC(&msg) = MISC_FUNC_SECO_BUILD_INFO;
+	RPC_SIZE(&msg) = 1;
+
+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+	if (ret < 0) {
+		printf("%s: err: %d\n", __func__, ret);
+		return;
+	}
+
+	if (version)
+		*version = RPC_U32(&msg, 0);
+	if (commit)
+		*commit = RPC_U32(&msg, 4);
+}
+
 int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val)
 {
 	struct udevice *dev = gd->arch.scu_dev;
-- 
2.17.1



More information about the U-Boot mailing list