aboutsummaryrefslogtreecommitdiffstats
path: root/plat/intel
diff options
context:
space:
mode:
authorHadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>2019-12-24 14:43:22 +0800
committerAbdul Halim, Muhammad Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>2020-01-16 10:56:43 +0800
commitf2decc7690dc4d71708a20f6085ae11c9d068c5a (patch)
tree81740b7ddbda07ca1494ef85d019f6489b15919f /plat/intel
parent9c8f3af50a227cb095a629c0877ff82111c801a9 (diff)
downloadplatform_external_arm-trusted-firmware-f2decc7690dc4d71708a20f6085ae11c9d068c5a.tar.gz
platform_external_arm-trusted-firmware-f2decc7690dc4d71708a20f6085ae11c9d068c5a.tar.bz2
platform_external_arm-trusted-firmware-f2decc7690dc4d71708a20f6085ae11c9d068c5a.zip
intel: Add function to check fpga readiness
Create a function to check for fpga readiness, and move the checking out of bridge enable function. Signed-off-by: Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com> Change-Id: I3f473ffeffa9ce181a48977560c8bda19c6123c0
Diffstat (limited to 'plat/intel')
-rw-r--r--plat/intel/soc/agilex/bl2_plat_setup.c4
-rw-r--r--plat/intel/soc/common/include/socfpga_mailbox.h1
-rw-r--r--plat/intel/soc/common/soc/socfpga_mailbox.c10
-rw-r--r--plat/intel/soc/common/soc/socfpga_reset_manager.c32
-rw-r--r--plat/intel/soc/stratix10/bl2_plat_setup.c4
5 files changed, 28 insertions, 23 deletions
diff --git a/plat/intel/soc/agilex/bl2_plat_setup.c b/plat/intel/soc/agilex/bl2_plat_setup.c
index 022ead6d7..9587d4859 100644
--- a/plat/intel/soc/agilex/bl2_plat_setup.c
+++ b/plat/intel/soc/agilex/bl2_plat_setup.c
@@ -75,7 +75,9 @@ void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1,
init_ncore_ccu();
init_hard_memory_controller();
mailbox_init();
- socfpga_bridges_enable();
+
+ if (!intel_mailbox_is_fpga_not_ready())
+ socfpga_bridges_enable();
}
diff --git a/plat/intel/soc/common/include/socfpga_mailbox.h b/plat/intel/soc/common/include/socfpga_mailbox.h
index c5f2fbe77..c4b9e5967 100644
--- a/plat/intel/soc/common/include/socfpga_mailbox.h
+++ b/plat/intel/soc/common/include/socfpga_mailbox.h
@@ -120,5 +120,6 @@ void mailbox_reset_cold(void);
void mailbox_clear_response(void);
uint32_t intel_mailbox_get_config_status(uint32_t cmd);
+int intel_mailbox_is_fpga_not_ready(void);
#endif /* SOCFPGA_MBOX_H */
diff --git a/plat/intel/soc/common/soc/socfpga_mailbox.c b/plat/intel/soc/common/soc/socfpga_mailbox.c
index eb35c4a08..8d7c1d663 100644
--- a/plat/intel/soc/common/soc/socfpga_mailbox.c
+++ b/plat/intel/soc/common/soc/socfpga_mailbox.c
@@ -316,3 +316,13 @@ uint32_t intel_mailbox_get_config_status(uint32_t cmd)
return MBOX_CFGSTAT_STATE_CONFIG;
}
+
+int intel_mailbox_is_fpga_not_ready(void)
+{
+ int ret = intel_mailbox_get_config_status(MBOX_RECONFIG_STATUS);
+
+ if (ret && ret != MBOX_CFGSTAT_STATE_CONFIG)
+ ret = intel_mailbox_get_config_status(MBOX_CONFIG_STATUS);
+
+ return ret;
+}
diff --git a/plat/intel/soc/common/soc/socfpga_reset_manager.c b/plat/intel/soc/common/soc/socfpga_reset_manager.c
index 7f6316955..32604c914 100644
--- a/plat/intel/soc/common/soc/socfpga_reset_manager.c
+++ b/plat/intel/soc/common/soc/socfpga_reset_manager.c
@@ -101,29 +101,19 @@ static int poll_idle_status(uint32_t addr, uint32_t mask, uint32_t match)
int socfpga_bridges_enable(void)
{
- uint32_t status, poll_addr;
+ /* Clear idle request */
+ mmio_setbits_32(SOCFPGA_SYSMGR(NOC_IDLEREQ_CLR), ~0);
- status = intel_mailbox_get_config_status(MBOX_CONFIG_STATUS);
+ /* De-assert all bridges */
+ mmio_clrbits_32(SOCFPGA_RSTMGR(BRGMODRST), ~0);
- if (!status) {
- /* Clear idle request */
- mmio_setbits_32(SOCFPGA_SYSMGR(NOC_IDLEREQ_CLR), ~0);
-
- /* De-assert all bridges */
- mmio_clrbits_32(SOCFPGA_RSTMGR(BRGMODRST), ~0);
-
- /* Wait until idle ack becomes 0 */
- poll_addr = SOCFPGA_SYSMGR(NOC_IDLEACK);
-
- return poll_idle_status(poll_addr, IDLE_DATA_MASK, 0);
- }
- return status;
+ /* Wait until idle ack becomes 0 */
+ return poll_idle_status(SOCFPGA_SYSMGR(NOC_IDLEACK),
+ IDLE_DATA_MASK, 0);
}
int socfpga_bridges_disable(void)
{
- uint32_t poll_addr;
-
/* Set idle request */
mmio_write_32(SOCFPGA_SYSMGR(NOC_IDLEREQ_SET), ~0);
@@ -131,13 +121,13 @@ int socfpga_bridges_disable(void)
mmio_setbits_32(SOCFPGA_SYSMGR(NOC_TIMEOUT), 1);
/* Wait until each idle ack bit toggle to 1 */
- poll_addr = SOCFPGA_SYSMGR(NOC_IDLEACK);
- if (poll_idle_status(poll_addr, IDLE_DATA_MASK, IDLE_DATA_MASK))
+ if (poll_idle_status(SOCFPGA_SYSMGR(NOC_IDLEACK),
+ IDLE_DATA_MASK, IDLE_DATA_MASK))
return -ETIMEDOUT;
/* Wait until each idle status bit toggle to 1 */
- poll_addr = SOCFPGA_SYSMGR(NOC_IDLESTATUS);
- if (poll_idle_status(poll_addr, IDLE_DATA_MASK, IDLE_DATA_MASK))
+ if (poll_idle_status(SOCFPGA_SYSMGR(NOC_IDLESTATUS),
+ IDLE_DATA_MASK, IDLE_DATA_MASK))
return -ETIMEDOUT;
/* Assert all bridges */
diff --git a/plat/intel/soc/stratix10/bl2_plat_setup.c b/plat/intel/soc/stratix10/bl2_plat_setup.c
index 5eb796936..7d183db0d 100644
--- a/plat/intel/soc/stratix10/bl2_plat_setup.c
+++ b/plat/intel/soc/stratix10/bl2_plat_setup.c
@@ -73,7 +73,9 @@ void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1,
socfpga_delay_timer_init();
init_hard_memory_controller();
mailbox_init();
- socfpga_bridges_enable();
+
+ if (!intel_mailbox_is_fpga_not_ready())
+ socfpga_bridges_enable();
}