From: Ang, Chee Hong Date: Fri, 3 May 2019 08:18:27 +0000 (-0700) Subject: ARM: socfpga: stratix10: Probe FPGA status before bridge enable X-Git-Tag: v2019.07-rc2~17^2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=32e308dd796f34f85d1c088e3218fa3403a9080f;p=oweals%2Fu-boot.git ARM: socfpga: stratix10: Probe FPGA status before bridge enable 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 --- diff --git a/arch/arm/mach-socfpga/misc_s10.c b/arch/arm/mach-socfpga/misc_s10.c index 60c96090ce..29abc4a54c 100644 --- a/arch/arm/mach-socfpga/misc_s10.c +++ b/arch/arm/mach-socfpga/misc_s10.c @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -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); }