All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface
@ 2019-10-21 15:58 Anatolij Gustschin
  2019-10-21 15:58 ` [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info() Anatolij Gustschin
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Anatolij Gustschin @ 2019-10-21 15:58 UTC (permalink / raw)
  To: u-boot

From: Ye Li <ye.li@nxp.com>

Need to pass total 5 arguments for SIP HAB call on i.MX8MQ,
so update the interface to add new argument.

Signed-off-by: Ye Li <ye.li@nxp.com>
---
 arch/arm/include/asm/mach-imx/sys_proto.h | 3 ++-
 arch/arm/mach-imx/imx_bootaux.c           | 4 ++--
 arch/arm/mach-imx/sip.c                   | 4 +++-
 drivers/misc/imx8/fuse.c                  | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h
index aa66fdc88f..139a7638c1 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -143,7 +143,8 @@ int mxs_wait_mask_set(struct mxs_register_32 *reg, u32 mask, u32 timeout);
 int mxs_wait_mask_clr(struct mxs_register_32 *reg, u32 mask, u32 timeout);
 
 unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
-			   unsigned long reg1, unsigned long reg2);
+			   unsigned long reg1, unsigned long reg2,
+			   unsigned long reg3);
 unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0,
 				unsigned long *reg1, unsigned long reg2,
 				unsigned long reg3);
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 18d7e6819c..3d9422d5a2 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -26,7 +26,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
 
 	/* Enable M4 */
 #ifdef CONFIG_IMX8M
-	call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0);
+	call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0, 0);
 #else
 	clrsetbits_le32(SRC_BASE_ADDR + SRC_M4_REG_OFFSET,
 			SRC_M4C_NON_SCLR_RST_MASK, SRC_M4_ENABLE_MASK);
@@ -38,7 +38,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
 int arch_auxiliary_core_check_up(u32 core_id)
 {
 #ifdef CONFIG_IMX8M
-	return call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0);
+	return call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0, 0);
 #else
 	unsigned int val;
 
diff --git a/arch/arm/mach-imx/sip.c b/arch/arm/mach-imx/sip.c
index 968e7cf309..fca520c671 100644
--- a/arch/arm/mach-imx/sip.c
+++ b/arch/arm/mach-imx/sip.c
@@ -7,7 +7,8 @@
 #include <asm/arch/sys_proto.h>
 
 unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
-			   unsigned long reg1, unsigned long reg2)
+			   unsigned long reg1, unsigned long reg2,
+			   unsigned long reg3)
 {
 	struct pt_regs regs;
 
@@ -15,6 +16,7 @@ unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
 	regs.regs[1] = reg0;
 	regs.regs[2] = reg1;
 	regs.regs[3] = reg2;
+	regs.regs[4] = reg3;
 
 	smc_call(&regs);
 
diff --git a/drivers/misc/imx8/fuse.c b/drivers/misc/imx8/fuse.c
index 2f2fad2c17..1309215d4d 100644
--- a/drivers/misc/imx8/fuse.c
+++ b/drivers/misc/imx8/fuse.c
@@ -74,7 +74,7 @@ int fuse_prog(u32 bank, u32 word, u32 val)
 	}
 
 	return call_imx_sip(FSL_SIP_OTP_WRITE, (unsigned long)word,
-			    (unsigned long)val, 0);
+			    (unsigned long)val, 0, 0);
 }
 
 int fuse_override(u32 bank, u32 word, u32 val)
-- 
2.17.1

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

* [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info()
  2019-10-21 15:58 [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Anatolij Gustschin
@ 2019-10-21 15:58 ` Anatolij Gustschin
  2019-10-22  2:47   ` Peng Fan
  2019-10-21 15:58 ` [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs Anatolij Gustschin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Anatolij Gustschin @ 2019-10-21 15:58 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs
  2019-10-21 15:58 [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Anatolij Gustschin
  2019-10-21 15:58 ` [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info() Anatolij Gustschin
@ 2019-10-21 15:58 ` Anatolij Gustschin
  2019-10-22  2:49   ` Peng Fan
  2019-10-21 17:12 ` [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Patrick Wildt
  2019-10-22  7:53 ` Anatolij Gustschin
  3 siblings, 1 reply; 11+ messages in thread
From: Anatolij Gustschin @ 2019-10-21 15:58 UTC (permalink / raw)
  To: u-boot

Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617)
and add the commit IDs to the environment.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 arch/arm/mach-imx/imx8/misc.c | 61 ++++++++++++++++++++++++++++++++++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx8/misc.c b/arch/arm/mach-imx/imx8/misc.c
index fe73e29eee..b0693358e7 100644
--- a/arch/arm/mach-imx/imx8/misc.c
+++ b/arch/arm/mach-imx/imx8/misc.c
@@ -1,6 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0+
 #include <common.h>
 #include <asm/arch/sci/sci.h>
+#include <asm/arch/sys_proto.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
 {
@@ -25,9 +28,28 @@ int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
 	return 0;
 }
 
+#define FSL_SIP_BUILDINFO			0xC2000003
+#define FSL_SIP_BUILDINFO_GET_COMMITHASH	0x00
+extern uint32_t _end_ofs;
+
+static void set_buildinfo_to_env(uint32_t scfw, uint32_t secofw,
+				 char *mkimage, char *atf)
+{
+	if (!mkimage || !atf)
+		return;
+
+	env_set("commit_mkimage", mkimage);
+	env_set("commit_atf", atf);
+	env_set_hex("commit_scfw", (ulong)scfw);
+	env_set_hex("commit_secofw", (ulong)secofw);
+}
+
 void build_info(void)
 {
+	u32 seco_build = 0, seco_commit = 0;
 	u32 sc_build = 0, sc_commit = 0;
+	ulong atf_commit = 0;
+	char *mkimage_commit, *temp;
 
 	/* Get SCFW build and commit id */
 	sc_misc_build_info(-1, &sc_build, &sc_commit);
@@ -35,5 +57,42 @@ void build_info(void)
 		printf("SCFW does not support build info\n");
 		sc_commit = 0; /* Display 0 if build info not supported */
 	}
-	printf("Build: SCFW %x\n", sc_commit);
+
+	/* Get SECO FW build and commit id */
+	sc_misc_seco_build_info(-1, &seco_build, &seco_commit);
+	if (!seco_build) {
+		debug("SECO FW does not support build info\n");
+		/* Display 0 when the build info is not supported */
+		seco_commit = 0;
+	}
+
+	/*
+	 * Get imx-mkimage commit id.
+	 * The imx-mkimage puts the commit hash behind the end of u-boot.bin
+	 */
+	mkimage_commit = (char *)(ulong)(CONFIG_SYS_TEXT_BASE + _end_ofs +
+					 fdt_totalsize(gd->fdt_blob));
+	temp = mkimage_commit + 8;
+	*temp = '\0';
+
+	if (strlen(mkimage_commit) == 0) {
+		debug("IMX-MKIMAGE does not support build info\n");
+		mkimage_commit = "0"; /* Display 0 */
+	}
+
+	/* Get ARM Trusted Firmware commit id */
+	atf_commit = call_imx_sip(FSL_SIP_BUILDINFO,
+				  FSL_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
+	if (atf_commit == 0xffffffff) {
+		debug("ATF does not support build info\n");
+		atf_commit = 0x30; /* Display 0 */
+	}
+
+	printf("Build: SCFW %08x, SECO-FW %08x\n"
+	       "       IMX-MKIMAGE %s, ATF %s\n",
+	       sc_commit, seco_commit, mkimage_commit, (char *)&atf_commit);
+
+	/* Set all to env */
+	set_buildinfo_to_env(sc_commit, seco_commit, mkimage_commit,
+			     (char *)&atf_commit);
 }
-- 
2.17.1

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

* [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface
  2019-10-21 15:58 [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Anatolij Gustschin
  2019-10-21 15:58 ` [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info() Anatolij Gustschin
  2019-10-21 15:58 ` [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs Anatolij Gustschin
@ 2019-10-21 17:12 ` Patrick Wildt
  2019-10-22  7:53 ` Anatolij Gustschin
  3 siblings, 0 replies; 11+ messages in thread
From: Patrick Wildt @ 2019-10-21 17:12 UTC (permalink / raw)
  To: u-boot

On Mon, Oct 21, 2019 at 05:58:49PM +0200, Anatolij Gustschin wrote:
> From: Ye Li <ye.li@nxp.com>
> 
> Need to pass total 5 arguments for SIP HAB call on i.MX8MQ,
> so update the interface to add new argument.
> 
> Signed-off-by: Ye Li <ye.li@nxp.com>
> ---
>  arch/arm/include/asm/mach-imx/sys_proto.h | 3 ++-
>  arch/arm/mach-imx/imx_bootaux.c           | 4 ++--
>  arch/arm/mach-imx/sip.c                   | 4 +++-
>  drivers/misc/imx8/fuse.c                  | 2 +-
>  4 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h
> index aa66fdc88f..139a7638c1 100644
> --- a/arch/arm/include/asm/mach-imx/sys_proto.h
> +++ b/arch/arm/include/asm/mach-imx/sys_proto.h
> @@ -143,7 +143,8 @@ int mxs_wait_mask_set(struct mxs_register_32 *reg, u32 mask, u32 timeout);
>  int mxs_wait_mask_clr(struct mxs_register_32 *reg, u32 mask, u32 timeout);
>  
>  unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
> -			   unsigned long reg1, unsigned long reg2);
> +			   unsigned long reg1, unsigned long reg2,
> +			   unsigned long reg3);
>  unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0,
>  				unsigned long *reg1, unsigned long reg2,
>  				unsigned long reg3);
> diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
> index 18d7e6819c..3d9422d5a2 100644
> --- a/arch/arm/mach-imx/imx_bootaux.c
> +++ b/arch/arm/mach-imx/imx_bootaux.c
> @@ -26,7 +26,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
>  
>  	/* Enable M4 */
>  #ifdef CONFIG_IMX8M
> -	call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0);
> +	call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0, 0);
>  #else
>  	clrsetbits_le32(SRC_BASE_ADDR + SRC_M4_REG_OFFSET,
>  			SRC_M4C_NON_SCLR_RST_MASK, SRC_M4_ENABLE_MASK);
> @@ -38,7 +38,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
>  int arch_auxiliary_core_check_up(u32 core_id)
>  {
>  #ifdef CONFIG_IMX8M
> -	return call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0);
> +	return call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0, 0);
>  #else
>  	unsigned int val;
>  
> diff --git a/arch/arm/mach-imx/sip.c b/arch/arm/mach-imx/sip.c
> index 968e7cf309..fca520c671 100644
> --- a/arch/arm/mach-imx/sip.c
> +++ b/arch/arm/mach-imx/sip.c
> @@ -7,7 +7,8 @@
>  #include <asm/arch/sys_proto.h>
>  
>  unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
> -			   unsigned long reg1, unsigned long reg2)
> +			   unsigned long reg1, unsigned long reg2,
> +			   unsigned long reg3)
>  {
>  	struct pt_regs regs;
>  
> @@ -15,6 +16,7 @@ unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
>  	regs.regs[1] = reg0;
>  	regs.regs[2] = reg1;
>  	regs.regs[3] = reg2;
> +	regs.regs[4] = reg3;
>  
>  	smc_call(&regs);
>  
> diff --git a/drivers/misc/imx8/fuse.c b/drivers/misc/imx8/fuse.c
> index 2f2fad2c17..1309215d4d 100644
> --- a/drivers/misc/imx8/fuse.c
> +++ b/drivers/misc/imx8/fuse.c
> @@ -74,7 +74,7 @@ int fuse_prog(u32 bank, u32 word, u32 val)
>  	}
>  
>  	return call_imx_sip(FSL_SIP_OTP_WRITE, (unsigned long)word,
> -			    (unsigned long)val, 0);
> +			    (unsigned long)val, 0, 0);
>  }
>  
>  int fuse_override(u32 bank, u32 word, u32 val)
> -- 
> 2.17.1
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

Reviewed-by: Patrick Wildt <patrick@blueri.se>

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

* [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info()
  2019-10-21 15:58 ` [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info() Anatolij Gustschin
@ 2019-10-22  2:47   ` Peng Fan
  2019-10-22  7:40     ` Anatolij Gustschin
  2019-10-24 13:54     ` Anatolij Gustschin
  0 siblings, 2 replies; 11+ messages in thread
From: Peng Fan @ 2019-10-22  2:47 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs
  2019-10-21 15:58 ` [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs Anatolij Gustschin
@ 2019-10-22  2:49   ` Peng Fan
  2019-10-22  7:57     ` Anatolij Gustschin
  0 siblings, 1 reply; 11+ messages in thread
From: Peng Fan @ 2019-10-22  2:49 UTC (permalink / raw)
  To: u-boot

Hi Anatolij,

> Subject: [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit
> IDs
> 
> Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617)
> and add the commit IDs to the environment.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  arch/arm/mach-imx/imx8/misc.c | 61
> ++++++++++++++++++++++++++++++++++-
>  1 file changed, 60 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/imx8/misc.c
> b/arch/arm/mach-imx/imx8/misc.c index fe73e29eee..b0693358e7 100644
> --- a/arch/arm/mach-imx/imx8/misc.c
> +++ b/arch/arm/mach-imx/imx8/misc.c
> @@ -1,6 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  #include <common.h>
>  #include <asm/arch/sci/sci.h>
> +#include <asm/arch/sys_proto.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> 
>  int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
> { @@ -25,9 +28,28 @@ int sc_pm_setup_uart(sc_rsrc_t uart_rsrc,
> sc_pm_clock_rate_t clk_rate)
>  	return 0;
>  }
> 
> +#define FSL_SIP_BUILDINFO			0xC2000003
> +#define FSL_SIP_BUILDINFO_GET_COMMITHASH	0x00
> +extern uint32_t _end_ofs;
> +
> +static void set_buildinfo_to_env(uint32_t scfw, uint32_t secofw,
> +				 char *mkimage, char *atf)
> +{
> +	if (!mkimage || !atf)
> +		return;
> +
> +	env_set("commit_mkimage", mkimage);
> +	env_set("commit_atf", atf);
> +	env_set_hex("commit_scfw", (ulong)scfw);
> +	env_set_hex("commit_secofw", (ulong)secofw); }
> +
>  void build_info(void)
>  {
> +	u32 seco_build = 0, seco_commit = 0;
>  	u32 sc_build = 0, sc_commit = 0;
> +	ulong atf_commit = 0;
> +	char *mkimage_commit, *temp;
> 
>  	/* Get SCFW build and commit id */
>  	sc_misc_build_info(-1, &sc_build, &sc_commit); @@ -35,5 +57,42 @@
> void build_info(void)
>  		printf("SCFW does not support build info\n");
>  		sc_commit = 0; /* Display 0 if build info not supported */
>  	}
> -	printf("Build: SCFW %x\n", sc_commit);
> +
> +	/* Get SECO FW build and commit id */
> +	sc_misc_seco_build_info(-1, &seco_build, &seco_commit);

Use sc_seco_build_info.

> +	if (!seco_build) {
> +		debug("SECO FW does not support build info\n");
> +		/* Display 0 when the build info is not supported */
> +		seco_commit = 0;
> +	}
> +
> +	/*
> +	 * Get imx-mkimage commit id.
> +	 * The imx-mkimage puts the commit hash behind the end of u-boot.bin
> +	 */
> +	mkimage_commit = (char *)(ulong)(CONFIG_SYS_TEXT_BASE + _end_ofs
> +
> +					 fdt_totalsize(gd->fdt_blob));
> +	temp = mkimage_commit + 8;
> +	*temp = '\0';
> +
> +	if (strlen(mkimage_commit) == 0) {
> +		debug("IMX-MKIMAGE does not support build info\n");
> +		mkimage_commit = "0"; /* Display 0 */
> +	}


We no need imx-mkimage, use mkimage in U-Boot no need this piece code.

Regards,
Peng.

> +
> +	/* Get ARM Trusted Firmware commit id */
> +	atf_commit = call_imx_sip(FSL_SIP_BUILDINFO,
> +				  FSL_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
> +	if (atf_commit == 0xffffffff) {
> +		debug("ATF does not support build info\n");
> +		atf_commit = 0x30; /* Display 0 */
> +	}
> +
> +	printf("Build: SCFW %08x, SECO-FW %08x\n"
> +	       "       IMX-MKIMAGE %s, ATF %s\n",
> +	       sc_commit, seco_commit, mkimage_commit, (char
> *)&atf_commit);
> +
> +	/* Set all to env */
> +	set_buildinfo_to_env(sc_commit, seco_commit, mkimage_commit,
> +			     (char *)&atf_commit);
>  }
> --
> 2.17.1

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

* [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info()
  2019-10-22  2:47   ` Peng Fan
@ 2019-10-22  7:40     ` Anatolij Gustschin
  2019-10-24 13:54     ` Anatolij Gustschin
  1 sibling, 0 replies; 11+ messages in thread
From: Anatolij Gustschin @ 2019-10-22  7:40 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Tue, 22 Oct 2019 02:47:28 +0000
Peng Fan peng.fan at 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

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

* [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface
  2019-10-21 15:58 [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Anatolij Gustschin
                   ` (2 preceding siblings ...)
  2019-10-21 17:12 ` [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Patrick Wildt
@ 2019-10-22  7:53 ` Anatolij Gustschin
  3 siblings, 0 replies; 11+ messages in thread
From: Anatolij Gustschin @ 2019-10-22  7:53 UTC (permalink / raw)
  To: u-boot

On Mon, 21 Oct 2019 17:58:49 +0200
Anatolij Gustschin agust at denx.de wrote:
...
> Need to pass total 5 arguments for SIP HAB call on i.MX8MQ,
> so update the interface to add new argument.

with current git master this patch breaks building imx8m-power-domain.c.
I'll fix it v2 patch.

--
Anatolij

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

* [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs
  2019-10-22  2:49   ` Peng Fan
@ 2019-10-22  7:57     ` Anatolij Gustschin
  0 siblings, 0 replies; 11+ messages in thread
From: Anatolij Gustschin @ 2019-10-22  7:57 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Tue, 22 Oct 2019 02:49:53 +0000
Peng Fan peng.fan at nxp.com wrote:
...
> > +	/* Get SECO FW build and commit id */
> > +	sc_misc_seco_build_info(-1, &seco_build, &seco_commit);  
> 
> Use sc_seco_build_info.

OK, will do in v2.

...
> > +	if (strlen(mkimage_commit) == 0) {
> > +		debug("IMX-MKIMAGE does not support build info\n");
> > +		mkimage_commit = "0"; /* Display 0 */
> > +	}
> 
> We no need imx-mkimage, use mkimage in U-Boot no need this piece code.

will drop it in v2 patch.

--
Anatolij

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

* [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info()
  2019-10-22  2:47   ` Peng Fan
  2019-10-22  7:40     ` Anatolij Gustschin
@ 2019-10-24 13:54     ` Anatolij Gustschin
  2019-10-25  1:45       ` Peng Fan
  1 sibling, 1 reply; 11+ messages in thread
From: Anatolij Gustschin @ 2019-10-24 13:54 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Tue, 22 Oct 2019 02:47:28 +0000
Peng Fan peng.fan at 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

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

* [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info()
  2019-10-24 13:54     ` Anatolij Gustschin
@ 2019-10-25  1:45       ` Peng Fan
  0 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2019-10-25  1:45 UTC (permalink / raw)
  To: u-boot

> 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 at 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

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

end of thread, other threads:[~2019-10-25  1:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 15:58 [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Anatolij Gustschin
2019-10-21 15:58 ` [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info() Anatolij Gustschin
2019-10-22  2:47   ` Peng Fan
2019-10-22  7:40     ` Anatolij Gustschin
2019-10-24 13:54     ` Anatolij Gustschin
2019-10-25  1:45       ` Peng Fan
2019-10-21 15:58 ` [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs Anatolij Gustschin
2019-10-22  2:49   ` Peng Fan
2019-10-22  7:57     ` Anatolij Gustschin
2019-10-21 17:12 ` [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface Patrick Wildt
2019-10-22  7:53 ` Anatolij Gustschin

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.