[PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes

Hi,
we found 3 issues recently with this driver which needs to be fixed.
Thanks, Michal
Ashok Reddy Soma (3): mmc: zynq_sdhci: Fix timeout issue mmc: zynq_sdhci: Change granularity of timeout to 1us mmc: zynq_sdhci: Enable card detect workaround for ZynqMP
drivers/mmc/zynq_sdhci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)

From: Ashok Reddy Soma ashok.reddy.soma@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@xilinx.com Signed-off-by: Michal Simek michal.simek@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");

From: Ashok Reddy Soma ashok.reddy.soma@xilinx.com
The timeout used in 'commit b6f44082d5cd ("mmc: zynq_sdhci: Wait till sd card detect state is stable")' workaround is 1000ms at a granularity of 1msec. Change it to 1usec, to not waste time incase the cd is stable.
Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com ---
drivers/mmc/zynq_sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index f4d69a2f7098..7d62d05eda71 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -770,11 +770,11 @@ static int arasan_sdhci_probe(struct udevice *dev) * 1000msec till the card detect state gets stable. */ if (IS_ENABLED(CONFIG_ARCH_VERSAL)) { - u32 timeout = 1000; + u32 timeout = 1000000;
while (((sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_STATE_STABLE) == 0) && timeout) { - mdelay(1); + udelay(1); timeout--; } if (!timeout) {

From: Ashok Reddy Soma ashok.reddy.soma@xilinx.com
Card detect state stable issue is observed on few ZynqMP boards(SOM), so enable the workaround 'commit b6f44082d5cd ("mmc: zynq_sdhci: Wait till sd card detect state is stable")' for ZynqMP platforms also.
Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com ---
drivers/mmc/zynq_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 7d62d05eda71..33d00b06c777 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -769,7 +769,7 @@ static int arasan_sdhci_probe(struct udevice *dev) * causing sd card timeout error. Workaround this by adding a wait for * 1000msec till the card detect state gets stable. */ - if (IS_ENABLED(CONFIG_ARCH_VERSAL)) { + if (IS_ENABLED(CONFIG_ARCH_ZYNQMP) || IS_ENABLED(CONFIG_ARCH_VERSAL)) { u32 timeout = 1000000;
while (((sdhci_readl(host, SDHCI_PRESENT_STATE) &

st 23. 2. 2022 v 15:13 odesÃlatel Michal Simek michal.simek@xilinx.com napsal:
Hi,
we found 3 issues recently with this driver which needs to be fixed.
Thanks, Michal
Ashok Reddy Soma (3): mmc: zynq_sdhci: Fix timeout issue mmc: zynq_sdhci: Change granularity of timeout to 1us mmc: zynq_sdhci: Enable card detect workaround for ZynqMP
drivers/mmc/zynq_sdhci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
-- 2.35.1
Applied. M
participants (2)
-
Michal Simek
-
Michal Simek