Skip to contentSkip to conversation

ARM: socfpga: stratix10: Probe FPGA status before bridge enable

PATCH New chee.hong.ang at intel.com 2 participants 2 messages May 3, 2019

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

PATCH 1/1 ARM: socfpga: stratix10: Probe FPGA status before bridge enable

From: "Ang, Chee Hong" <[email protected]>

Send CONFIG_STATUS and RECONFIG_STATUS mailbox commands to Secure Device Manager (SDM) to get the status of FPGA and make sure the FPGA is in user mode before enable the bridge.

---
 arch/arm/mach-socfpga/misc_s10.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/mach-socfpga/misc_s10.c +12 -0
index 113eace..0e4133f 100644
@@ -16,6 +16,7 @@
 #include <asm/arch/misc.h>
 #include <asm/pl310.h>
 #include <linux/libfdt.h>
+#include <asm/arch/mailbox_s10.h>
 
 #include <dt-bindings/reset/altr,rst-mgr-s10.h>
 
@@ -152,5 +153,16 @@ int arch_early_init_r(void)
 
 void do_bridge_reset(int enable)
 {
+	/* Check FPGA status before bridge enable */
+	if (enable) {
+		int ret = mbox_get_fpga_config_status(MBOX_RECONFIG_STATUS);
+
+		if (ret && ret != MBOX_CFGSTAT_STATE_CONFIG)
+			ret = mbox_get_fpga_config_status(MBOX_CONFIG_STATUS);
+
+		if (ret)
+			return;
+	}
+
 	socfpga_bridges_reset(enable);
 }
Signature · 1 line
2.7.4
Applied
#1 lore raw

PATCH 1/1 ARM: socfpga: stratix10: Probe FPGA status before bridge enable

Quoted 31 lines · chee.hong.ang at intel.com

From: "Ang, Chee Hong" <[email protected]>

Send CONFIG_STATUS and RECONFIG_STATUS mailbox commands to Secure Device Manager (SDM) to get the status of FPGA and make sure the FPGA is in user mode before enable the bridge.

---
 arch/arm/mach-socfpga/misc_s10.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/mach-socfpga/misc_s10.c +4 -0
index 113eace..0e4133f 100644
@@ -16,6 +16,7 @@
 #include <asm/arch/misc.h>
 #include <asm/pl310.h>
 #include <linux/libfdt.h>
+#include <asm/arch/mailbox_s10.h>
 
 #include <dt-bindings/reset/altr,rst-mgr-s10.h>
 
@@ -152,5 +153,16 @@ int arch_early_init_r(void)
 
 void do_bridge_reset(int enable)
 {
+	/* Check FPGA status before bridge enable */
+	if (enable) {
+		int ret = mbox_get_fpga_config_status(MBOX_RECONFIG_STATUS);

arch/arm/mach-socfpga/misc_s10.c int arch_early_init_r(void) · line 168

Quoted 10 lines
arch/arm/mach-socfpga/misc_s10.c +8 -0
+
+		if (ret && ret != MBOX_CFGSTAT_STATE_CONFIG)
+			ret = mbox_get_fpga_config_status(MBOX_CONFIG_STATUS);
+
+		if (ret)
+			return;
+	}
+
 	socfpga_bridges_reset(enable);
 }

Applied, thanks

Signature · 2 lines
Best regards,
Marek Vasut