[PATCH 1/3] mmc: zynq_sdhci: Fix timeout issue
Michal Simek
michal.simek at xilinx.com
Wed Feb 23 15:13:30 CET 2022
From: Ashok Reddy Soma <ashok.reddy.soma at xilinx.com>
In the workaround added with 'commit b6f44082d5cd ("mmc: zynq_sdhci: Wait
till sd card detect state is stable")' the timeout variable has post
decrement. Whenever timeout happens, this post decrement is making
timeout=0xffffffff, so timeout error print and return statement are
never reached. Fix it by decrementing it inside the while loop.
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma at xilinx.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---
drivers/mmc/zynq_sdhci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 5cea4c695e8d..f4d69a2f7098 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -773,8 +773,9 @@ static int arasan_sdhci_probe(struct udevice *dev)
u32 timeout = 1000;
while (((sdhci_readl(host, SDHCI_PRESENT_STATE) &
- SDHCI_CARD_STATE_STABLE) == 0) && timeout--) {
+ SDHCI_CARD_STATE_STABLE) == 0) && timeout) {
mdelay(1);
+ timeout--;
}
if (!timeout) {
dev_err(dev, "Sdhci card detect state not stable\n");
--
2.35.1
More information about the U-Boot
mailing list