+ if (is_fpgamgr_early_user_mode() || is_fpgamgr_user_mode()) {
+ if (!is_regular_boot_valid()) {
+ /*
+ * Ensure all signals in stable state before triggering
+ * warm reset. This value is recommended from stress
+ * test.
+ */
+ mdelay(10);
+
+#if IS_ENABLED(CONFIG_CADENCE_QSPI)
+ /*
+ * Trigger software reset to QSPI flash.
+ * On some boards, the QSPI flash reset may not be
+ * connected to the HPS warm reset.
+ */
+ qspi_flash_software_reset();
+#endif
+
+ ret = readl(socfpga_get_rstmgr_addr() +
+ RSTMGR_A10_SYSWARMMASK);
+ /*
+ * Masking s2f & FPGA manager module reset from warm
+ * reset
+ */
+ writel(ret & (~(ALT_RSTMGR_SYSWARMMASK_S2F_SET_MSK |
+ ALT_RSTMGR_FPGAMGRWARMMASK_S2F_SET_MSK)),
+ socfpga_get_rstmgr_addr() +
+ RSTMGR_A10_SYSWARMMASK);
+
+ /*
+ * BootROM will configure both IO and pin mux after a
+ * warm reset
+ */
+ ret = readl(socfpga_get_sysmgr_addr() +
+ SYSMGR_A10_ROMCODE_CTRL);
+ writel(ret | BOOTROM_CONFIGURES_IO_PINMUX,
+ socfpga_get_sysmgr_addr() +
+ SYSMGR_A10_ROMCODE_CTRL);
+
+ /*
+ * Up to here, image is considered valid and should be
+ * set as valid before warm reset is triggered
+ */
+ writel(FSBL_IMAGE_IS_VALID, socfpga_get_sysmgr_addr() +
+ SYSMGR_A10_ROMCODE_INITSWSTATE);
+
+ /*
+ * Set this flag to scratch register, so that a proper
+ * boot progress before / after warm reset can be
+ * tracked by FSBL
+ */
+ set_regular_boot(true);
+
+ schedule();
+
+ reset_cpu();
+ }
+
+ /*
+ * Reset this flag to scratch register, so that a proper
+ * boot progress before / after warm reset can be
+ * tracked by FSBL
+ */
+ set_regular_boot(false);
+
+ ret = readl(socfpga_get_rstmgr_addr() +
+ RSTMGR_A10_SYSWARMMASK);
+
+ /*
+ * Unmasking s2f & FPGA manager module reset from warm
+ * reset
+ */
+ writel(ret | ALT_RSTMGR_SYSWARMMASK_S2F_SET_MSK |
+ ALT_RSTMGR_FPGAMGRWARMMASK_S2F_SET_MSK,
+ socfpga_get_rstmgr_addr() + RSTMGR_A10_SYSWARMMASK);
+
+ /*
+ * Up to here, MPFE hang workaround is considered done and
+ * should be reset as invalid until FSBL successfully loading
+ * SSBL, and prepare jumping to SSBL, then only setting as
+ * valid
+ */
+ writel(FSBL_IMAGE_IS_INVALID, socfpga_get_sysmgr_addr() +
+ SYSMGR_A10_ROMCODE_INITSWSTATE);
+