mmc: zynqmp_sdhci: Driver fixes
Subsystems (2)
cover 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(-)
Signature · 1 line
2.35.1
PATCH 1/3 mmc: zynq_sdhci: Fix timeout issue
From: Ashok Reddy Soma <[email protected]>
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.
---
drivers/mmc/zynq_sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/zynq_sdhci.c +2 -1
@@ -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" );
Signature · 1 line
2.35.1
PATCH 2/3 mmc: zynq_sdhci: Change granularity of timeout to 1us
In reply to Michal SimekFrom: Ashok Reddy Soma <[email protected]>
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.
---
drivers/mmc/zynq_sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/zynq_sdhci.c +2 -2
@@ -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) {
Signature · 1 line
2.35.1
PATCH 3/3 mmc: zynq_sdhci: Enable card detect workaround for ZynqMP
In reply to Michal SimekFrom: Ashok Reddy Soma <[email protected]>
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.
---
drivers/mmc/zynq_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/zynq_sdhci.c +1 -1
@@ -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) &
Signature · 1 line
2.35.1
Michal Simek
Appliedst 23. 2. 2022 v 15:13 odesílatel Michal Simek <[email protected]> napsal:
Quoted 14 lines
Hi,
we found 3 issues recently with this driver which needs to be fixed.
Thanks,
MichalAshok 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
Quoted 6 lines
drivers/mmc/zynq_sdhci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)--
2.35.1
Applied.
M
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs