[U-Boot,2/3] imx8: add sc_misc_seco_build_info()
diff mbox series

Message ID 20191021155851.16483-2-agust@denx.de
State Rejected
Delegated to: Stefano Babic
Headers show
Series
  • [U-Boot,1/3] mach-imx: Adding new argument for SIP call interface
Related show

Commit Message

Anatolij Gustschin Oct. 21, 2019, 3:58 p.m. UTC
Add function for reading SECO-FW commit id.

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

Comments

Peng Fan Oct. 22, 2019, 2:47 a.m. UTC | #1
Hi Anatolij

> Subject: [PATCH 2/3] imx8: add sc_misc_seco_build_info()

sc_seco_build_info already in Stefano's tree.

Thanks,
Peng.

> 
> Add function for reading SECO-FW commit id.
> 
> Signed-off-by: Anatolij Gustschin <agust@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
Anatolij Gustschin Oct. 22, 2019, 7:40 a.m. UTC | #2
Hi Peng,

On Tue, 22 Oct 2019 02:47:28 +0000
Peng Fan peng.fan@nxp.com wrote:
...
> sc_seco_build_info already in Stefano's tree.

Ah, I didn't notice it, must have been merged recently.

Thanks for pointing!

--
Anatolij
Anatolij Gustschin Oct. 24, 2019, 1:54 p.m. UTC | #3
Hi Peng,

On Tue, 22 Oct 2019 02:47:28 +0000
Peng Fan peng.fan@nxp.com wrote:
...
> > Subject: [PATCH 2/3] imx8: add sc_misc_seco_build_info()  
> 
> sc_seco_build_info already in Stefano's tree.

sc_seco_build_info() in current git master works on i.MX8QXP MEK board,
but it doesn't work on my custom board with different blobs. Here U-Boot
triggers system reset somewhere in sc_seco_build_info()->misc_call().

With sc_misc_seco_build_info() in this patch getting the IDs works,
I've following IDs on this board:
SCFW 65afe5f6, SECO-FW 9d71fd5b, ATF d6451cc

The differences:
sc_seco_build_info() uses SC_RPC_SVC_SECO/SECO_FUNC_BUILD_INFO,
sc_misc_seco_build_info() uses SC_RPC_SVC_MISC/MISC_FUNC_SECO_BUILD_INFO.

Any idea why sc_seco_build_info() ends in system reset?

Thanks,

--
Anatolij
Peng Fan Oct. 25, 2019, 1:45 a.m. UTC | #4
> Subject: Re: [PATCH 2/3] imx8: add sc_misc_seco_build_info()
> 
> Hi Peng,
> 
> On Tue, 22 Oct 2019 02:47:28 +0000
> Peng Fan peng.fan@nxp.com wrote:
> ...
> > > Subject: [PATCH 2/3] imx8: add sc_misc_seco_build_info()
> >
> > sc_seco_build_info already in Stefano's tree.
> 
> sc_seco_build_info() in current git master works on i.MX8QXP MEK board, but
> it doesn't work on my custom board with different blobs. Here U-Boot triggers
> system reset somewhere in sc_seco_build_info()->misc_call().
> 
> With sc_misc_seco_build_info() in this patch getting the IDs works, I've
> following IDs on this board:
> SCFW 65afe5f6, SECO-FW 9d71fd5b, ATF d6451cc
> 
> The differences:
> sc_seco_build_info() uses SC_RPC_SVC_SECO/SECO_FUNC_BUILD_INFO,
> sc_misc_seco_build_info() uses
> SC_RPC_SVC_MISC/MISC_FUNC_SECO_BUILD_INFO.
> 
> Any idea why sc_seco_build_info() ends in system reset?

You might need to update your seco/scfw.

Thanks,
Peng

> 
> Thanks,
> 
> --
> Anatolij

Patch
diff mbox series

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;