Skip to contentSkip to conversation

arm: socfpga: soc64: Add mask support when enable/disable bridges

PATCH New Jit Loon Lim 1 participant 2 messages Nov 23, 2022

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

PATCH 1/2 arm: socfpga: soc64: Add mask support when enable/disable bridges

From: Ley Foon Tan <[email protected]>

HSD #18016042797-1: The existing ignore the "mask" value when call to socfpga_bridges_reset().

This patch add the mask support when bridge enable/disable.

Mask value:
BIT0: soc2fpga
BIT1: lwhps2fpga
BIT2: fpga2soc

These bridges available only in Stratix 10:
BIT3: f2sdram0
BIT4: f2sdram1
BIT5: f2sdram2

---
 .../include/mach/reset_manager_soc64.h        |   9 +-
 arch/arm/mach-socfpga/misc_soc64.c            |   2 +-
 arch/arm/mach-socfpga/reset_manager_s10.c     | 154 +++++++++++-------
 3 files changed, 101 insertions(+), 64 deletions(-)
arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h +2 -7
index 9589b61749..b662b4450d 100644
@@ -9,7 +9,8 @@
 void reset_deassert_peripherals_handoff(void);
 int cpu_has_been_warmreset(void);
 void print_reset_info(void);
-void socfpga_bridges_reset(int enable);
+void socfpga_bridges_reset(int enable, unsigned int mask);
+void socfpga_bridges_reset_psci(int enable, unsigned int mask);
 
 #define RSTMGR_SOC64_STATUS	0x00
 #define RSTMGR_SOC64_HDSKEN	0x10
@@ -29,12 +30,6 @@ void socfpga_bridges_reset(int enable);
 #define RSTMGR_BRGMODRST_F2SDRAM1_MASK	BIT(4)
 #define RSTMGR_BRGMODRST_F2SDRAM2_MASK	BIT(5)
 #define RSTMGR_BRGMODRST_DDRSCH_MASK	BIT(6)
-#define BRGMODRST_SOC2FPGA_BRIDGES	(RSTMGR_BRGMODRST_SOC2FPGA_MASK | \
-					 RSTMGR_BRGMODRST_LWSOC2FPGA_MASK)
-#define BRGMODRST_FPGA2SOC_BRIDGES	(RSTMGR_BRGMODRST_FPGA2SOC_MASK | \
-					 RSTMGR_BRGMODRST_F2SDRAM0_MASK | \
-					 RSTMGR_BRGMODRST_F2SDRAM1_MASK | \
-					 RSTMGR_BRGMODRST_F2SDRAM2_MASK)
 
 #define RSTMGR_HDSKEN_FPGAHSEN		BIT(2)
 #define RSTMGR_HDSKREQ_FPGAHSREQ	BIT(2)
arch/arm/mach-socfpga/misc_soc64.c +1 -1
index 2acdfad07b..49b241b7b8 100644
@@ -87,5 +87,5 @@ void do_bridge_reset(int enable, unsigned int mask)
 		return;
 	}
 
-	socfpga_bridges_reset(enable);
+	socfpga_bridges_reset(enable, mask);
 }
arch/arm/mach-socfpga/reset_manager_s10.c +98 -56

251 lines not on this page · raw message

Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 arm: socfpga: soc64: Add mask support to INTEL_SIP_SMC_HPS_SET_BRIDGES

From: Ley Foon Tan <[email protected]>

HSD #18016042797-2: Add mask support to INTEL_SIP_SMC_HPS_SET_BRIDGES SMC call.

---
 arch/arm/mach-socfpga/reset_manager_s10.c | 10 +++++++---
 include/linux/intel-smc.h                 | 14 ++++++++++----
 2 files changed, 17 insertions(+), 7 deletions(-)
arch/arm/mach-socfpga/reset_manager_s10.c +7 -3
index 128cdbbbe3..bc643218d2 100644
@@ -266,11 +266,15 @@ static __always_inline void socfpga_s2f_bridges_reset(int enable,
 void socfpga_bridges_reset(int enable, unsigned int mask)
 {
 	if (!IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_SPL_ATF)) {
-		u64 arg = enable;
+		u64 arg[2];
 		int ret;
 
-		ret = invoke_smc(INTEL_SIP_SMC_HPS_SET_BRIDGES, &arg, 1, NULL,
-				 0);
+		/* Set bit-1 to indicate has mask value in arg[1]. */
+		arg[0] = (enable & BIT(0)) | BIT(1);
+		arg[1] = mask;
+
+		ret = invoke_smc(INTEL_SIP_SMC_HPS_SET_BRIDGES, arg,
+				 ARRAY_SIZE(arg), NULL, 0);
 		if (ret)
 			printf("Failed to %s the HPS bridges, error %d\n",
 			       enable ? "enable" : "disable", ret);
include/linux/intel-smc.h +10 -4
index a54eff43ad..e15fa3d4da 100644
@@ -482,10 +482,16 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
  * Call register usage:
  * a0 INTEL_SIP_SMC_HPS_SET_BRIDGES
  * a1 Set bridges status:
- *      0 - Disable
- *      1 - Enable
- * a2-7 not used
- *
+ *	Bit 0: 0 - Disable, 1 - Enable
+ *	Bit 1: 1 - Has mask value in a2
+ * a2 Mask value
+ *	Bit 0: soc2fpga
+ *	Bit 1: lwhps2fpga
+ *	Bit 2: fpga2soc
+ *	Bit 3: f2sdram0	(For Stratix 10 only)
+ *	Bit 4: f2sdram1	(For Stratix 10 only)
+ *	Bit 5: f2sdram2	(For Stratix 10 only)
+ * a3-7 not used
  * Return status
  * a0 INTEL_SIP_SMC_STATUS_OK
  */
Signature · 1 line
2.26.2