]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: socfpga: stratix10: Probe FPGA status before bridge enable
authorAng, Chee Hong <chee.hong.ang@intel.com>
Fri, 3 May 2019 08:18:27 +0000 (01:18 -0700)
committerMarek Vasut <marex@denx.de>
Mon, 6 May 2019 10:44:45 +0000 (12:44 +0200)
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.

Signed-off-by: Ang, Chee Hong <chee.hong.ang@intel.com>
arch/arm/mach-socfpga/misc_s10.c

index 60c96090ce1c47ad2151e23d1986811f3006f38b..29abc4a54c33fe2c4169d33244c3cdd30f6468d8 100644 (file)
@@ -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, unsigned int mask)
 {
+       /* 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);
 }