Skip to contentSkip to conversation

mach-imx: Adding new argument for SIP call interface

PATCH New Anatolij Gustschin 3 participants 6 messages Oct 26, 2019 – Nov 4, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mach-imx: Adding new argument for SIP call interface

From: Ye Li <[email protected]>

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

[agust: fixed imx8m-power-domain build]

---
Changes in v2:
- fix build breakage in imx8m-power-domain.c

 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 +-
 drivers/power/domain/imx8m-power-domain.c | 6 ++++--
 5 files changed, 12 insertions(+), 7 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +2 -1
index aa66fdc88f..139a7638c1 100644
@@ -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);
arch/arm/mach-imx/imx_bootaux.c +2 -2
index 18d7e6819c..3d9422d5a2 100644
@@ -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;
 
arch/arm/mach-imx/sip.c +3 -1
index 968e7cf309..fca520c671 100644
@@ -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);
 
drivers/misc/imx8/fuse.c +1 -1
index 2f2fad2c17..1309215d4d 100644
@@ -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)
drivers/power/domain/imx8m-power-domain.c +4 -2
index 164fb3d31d..40ece9ee3f 100644
@@ -37,7 +37,8 @@ static int imx8m_power_domain_on(struct power_domain *power_domain)
 	if (pdata->has_pd)
 		power_domain_on(&pdata->pd);
 
-	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN, pdata->resource_id, 1);
+	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN,
+		     pdata->resource_id, 1, 0);
 
 	return 0;
 }
@@ -51,7 +52,8 @@ static int imx8m_power_domain_off(struct power_domain *power_domain)
 	if (pdata->resource_id < 0)
 		return -EINVAL;
 
-	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN, pdata->resource_id, 0);
+	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN,
+		     pdata->resource_id, 0, 0);
 
 	if (pdata->has_pd)
 		power_domain_off(&pdata->pd);
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/2 imx8: output SECO-FW and ATF commit IDs

Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617) but drop imx-mkimage commit ID reading since we now use in tree mkimage.

---
Changes in v2:
- reword subject and commit description
- use in tree sc_seco_build_info() instead of adding sc_misc_seco_build_info()
- drop output of imx-mkimage commit ID code
- drop setting the IDs to environment because build_info() is called before environment init and setting variables doesn't work yet

 arch/arm/mach-imx/imx8/misc.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx8/misc.c +25 -1
index fe73e29eee..00fe4670bb 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 #include <common.h>
 #include <asm/arch/sci/sci.h>
+#include <asm/mach-imx/sys_proto.h>
 
 int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
 {
@@ -25,9 +26,14 @@ 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
+
 void build_info(void)
 {
+	u32 seco_build = 0, seco_commit = 0;
 	u32 sc_build = 0, sc_commit = 0;
+	ulong atf_commit = 0;
 
 	/* Get SCFW build and commit id */
 	sc_misc_build_info(-1, &sc_build, &sc_commit);
@@ -35,5 +41,23 @@ 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_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 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, ATF %s\n",
+	       sc_commit, seco_commit, (char *)&atf_commit);
 }
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/2 imx8: output SECO-FW and ATF commit IDs

Quoted 62 lines

Subject: [PATCH v2 2/2] imx8: output SECO-FW and ATF commit IDs

Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617) but drop imx-mkimage commit ID reading since we now use in tree mkimage.

---
Changes in v2:
- reword subject and commit description
- use in tree sc_seco_build_info() instead of adding sc_misc_seco_build_info()
- drop output of imx-mkimage commit ID code
- drop setting the IDs to environment because build_info() is called before environment init and setting variables doesn't work yet

 arch/arm/mach-imx/imx8/misc.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx8/misc.c index fe73e29eee..00fe4670bb 100644

arch/arm/mach-imx/imx8/misc.c +1 -0
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 #include <common.h>
 #include <asm/arch/sci/sci.h>
+#include <asm/mach-imx/sys_proto.h>
 
 int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
 { @@ -25,9 +26,14 @@ int sc_pm_setup_uart(sc_rsrc_t uart_rsrc,

sc_pm_clock_rate_t clk_rate)

arch/arm/mach-imx/imx8/misc.c +5 -0
 	return 0;
 }
 
+#define FSL_SIP_BUILDINFO			0xC2000003
+#define FSL_SIP_BUILDINFO_GET_COMMITHASH	0x00
+
 void build_info(void)
 {
+	u32 seco_build = 0, seco_commit = 0;
 	u32 sc_build = 0, sc_commit = 0;
+	ulong atf_commit = 0;
 
 	/* Get SCFW build and commit id */
 	sc_misc_build_info(-1, &sc_build, &sc_commit); @@ -35,5 +41,23 @@

void build_info(void)

arch/arm/mach-imx/imx8/misc.c +11 -1
 		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_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 ARM Trusted Firmware commit id */
+	atf_commit = call_imx_sip(FSL_SIP_BUILDINFO,

arch/arm/mach-imx/imx8/misc.c void build_info(void)

Quoted 10 lines
arch/arm/mach-imx/imx8/misc.c +8 -1
+				  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, ATF %s\n",
+	       sc_commit, seco_commit, (char *)&atf_commit);
 }
--
Quoted 1 line

2.17.1

#3 lore raw

PATCH v2 2/2 imx8: output SECO-FW and ATF commit IDs

In reply to Anatolij Gustschin
Quoted 4 lines

Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617) but drop imx-mkimage commit ID reading since we now use in tree mkimage.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#4 lore raw

PATCH v2 1/2 mach-imx: Adding new argument for SIP call interface

In reply to Anatolij Gustschin
Quoted 124 lines

Subject: [PATCH v2 1/2] mach-imx: Adding new argument for SIP call interface

From: Ye Li <[email protected]>

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

[agust: fixed imx8m-power-domain build]

---
Changes in v2:
- fix build breakage in imx8m-power-domain.c

 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 +-
 drivers/power/domain/imx8m-power-domain.c | 6 ++++--
 5 files changed, 12 insertions(+), 7 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +0 -0
index aa66fdc88f..139a7638c1 100644
@@ -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,

arch/arm/include/asm/mach-imx/sys_proto.h +2 -1
-			   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);
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx_bootaux.c index 18d7e6819c..3d9422d5a2 100644

arch/arm/mach-imx/imx_bootaux.c +1 -1
@@ -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,
arch/arm/mach-imx/imx_bootaux.c +0 -0
 			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

arch/arm/mach-imx/imx_bootaux.c +1 -1
-	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;
arch/arm/mach-imx/sip.c index renamed from arch/arm/mach-imx/sip.c +0 -0

968e7cf309..fca520c671 100644

arch/arm/mach-imx/sip.c +3 -1
@@ -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);
drivers/misc/imx8/fuse.c index renamed from drivers/misc/imx8/fuse.c +0 -0

2f2fad2c17..1309215d4d 100644

drivers/misc/imx8/fuse.c +1 -1
@@ -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) diff --git

a/drivers/power/domain/imx8m-power-domain.c
b/drivers/power/domain/imx8m-power-domain.c
index 164fb3d31d..40ece9ee3f 100644

drivers/power/domain/imx8m-power-domain.c +2 -1
@@ -37,7 +37,8 @@ static int imx8m_power_domain_on(struct
 power_domain *power_domain)
 	if (pdata->has_pd)
 		power_domain_on(&pdata->pd);
 
-	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN,
 pdata->resource_id, 1);
+	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN,
+		     pdata->resource_id, 1, 0);
 
drivers/power/domain/imx8m-power-domain.c +2 -1
 	return 0;
 }
@@ -51,7 +52,8 @@ static int imx8m_power_domain_off(struct
 power_domain *power_domain)
 	if (pdata->resource_id < 0)
 		return -EINVAL;
 
-	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN,
 pdata->resource_id, 0);
+	call_imx_sip(IMX_SIP_GPC, IMX_SIP_GPC_PM_DOMAIN,
+		     pdata->resource_id, 0, 0);
 

drivers/power/domain/imx8m-power-domain.c static int imx8m_power_domain_off(struct power_domain *power_domain) · line 59

Quoted 2 lines
drivers/power/domain/imx8m-power-domain.c +0 -0
 	if (pdata->has_pd)
 		power_domain_off(&pdata->pd);
Quoted 2 lines

--
2.17.1

#5 lore raw

PATCH v2 1/2 mach-imx: Adding new argument for SIP call interface

In reply to Anatolij Gustschin
Quoted 8 lines

From: Ye Li <[email protected]>
Need to pass total 5 arguments for SIP HAB call on i.MX8MQ, so update the interface to add new argument.

[agust: fixed imx8m-power-domain build]

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================