From: Dinesh Maniyam <[email protected]> Unexpected behavior and error can occur if FPGA is accessed in unknown state. Always checking with FPGA in user mode is required to ensure system stability.
Signed-off-by: Tien Fong Chee <[email protected]> Signed-off-by: Dinesh Maniyam <[email protected]> --- Changes in v2: - Mark unused mask argument __maybe_unused - Use a single puts() for the error message History: -------- [v1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/ arch/arm/mach-socfpga/misc_arria10.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-socfpga/misc_arria10.c b/arch/arm/mach-socfpga/misc_arria10.c index 7e0f3875b7c..4ed727b6c2e 100644 --- a/arch/arm/mach-socfpga/misc_arria10.c +++ b/arch/arm/mach-socfpga/misc_arria10.c @@ -13,6 +13,7 @@ #include <ns16550.h> #include <spi_flash.h> #include <watchdog.h> +#include <asm/arch/fpga_manager.h> #include <asm/arch/misc.h> #include <asm/arch/pinmux.h> #include <asm/arch/reset_manager.h> @@ -124,12 +125,17 @@ int print_cpuinfo(void) } #endif -void do_bridge_reset(int enable, unsigned int mask) +void do_bridge_reset(int enable, unsigned int mask __maybe_unused) { - if (enable) - socfpga_reset_deassert_bridges_handoff(); - else + if (enable) { + if (is_fpgamgr_user_mode()) { + socfpga_reset_deassert_bridges_handoff(); + } else { + puts("Bridges: failed to enable because FPGA is not in user mode\n"); + } + } else { socfpga_bridges_reset(); + } } /* -- 2.43.7
