Commit 620dd58b authored by Deepika Bhavnani's avatar Deepika Bhavnani
Browse files

SMMUv3:Changed retry loop to delay timer(GENFW-3329)



Instead of retry polling, timer of 1ms is used to poll
Signed-off-by: default avatarDeepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I7e028dc68138d2888e3cf0cbed744f5e6bc6ff42
parent 5d71d3f6
...@@ -7,23 +7,27 @@ ...@@ -7,23 +7,27 @@
#include <common/debug.h> #include <common/debug.h>
#include <cdefs.h> #include <cdefs.h>
#include <drivers/arm/smmu_v3.h> #include <drivers/arm/smmu_v3.h>
#include <drivers/delay_timer.h>
#include <lib/mmio.h> #include <lib/mmio.h>
/* SMMU poll number of retries */ /* SMMU poll number of retries */
#define SMMU_POLL_RETRY 1000000 #define SMMU_POLL_TIMEOUT_US U(1000)
static int __init smmuv3_poll(uintptr_t smmu_reg, uint32_t mask, static int __init smmuv3_poll(uintptr_t smmu_reg, uint32_t mask,
uint32_t value) uint32_t value)
{ {
uint32_t reg_val, retries = SMMU_POLL_RETRY; uint32_t reg_val;
uint64_t timeout;
/* Set 1ms timeout value */
timeout = timeout_init_us(SMMU_POLL_TIMEOUT_US);
do { do {
reg_val = mmio_read_32(smmu_reg); reg_val = mmio_read_32(smmu_reg);
if ((reg_val & mask) == value) if ((reg_val & mask) == value)
return 0; return 0;
} while (--retries != 0U); } while (!timeout_elapsed(timeout));
ERROR("Failed to poll SMMUv3 register @%p\n", (void *)smmu_reg); ERROR("Timeout polling SMMUv3 register @%p\n", (void *)smmu_reg);
ERROR("Read value 0x%x, expected 0x%x\n", reg_val, ERROR("Read value 0x%x, expected 0x%x\n", reg_val,
value == 0U ? reg_val & ~mask : reg_val | mask); value == 0U ? reg_val & ~mask : reg_val | mask);
return -1; return -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment