Skip to contentSkip to conversation

mmc: zynqmp_sdhci: Driver fixes

PATCH Applied Michal Simek 2 participants 5 messages Feb 23, 2022 – Mar 7, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 5cea4c695e8d..f4d69a2f7098 100644
@@ -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
#2 lore raw

PATCH 2/3 mmc: zynq_sdhci: Change granularity of timeout to 1us

In reply to Michal Simek

From: 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
index f4d69a2f7098..7d62d05eda71 100644
@@ -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
#3 lore raw

PATCH 3/3 mmc: zynq_sdhci: Enable card detect workaround for ZynqMP

In reply to Michal Simek

From: 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
index 7d62d05eda71..33d00b06c777 100644
@@ -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
Applied
#4 lore raw
In reply to Michal Simek

st 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,
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

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