* [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes
@ 2022-02-23 14:13 Michal Simek
2022-02-23 14:13 ` [PATCH 1/3] mmc: zynq_sdhci: Fix timeout issue Michal Simek
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Michal Simek @ 2022-02-23 14:13 UTC (permalink / raw)
To: u-boot, git; +Cc: Jaehoon Chung, Peng Fan
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] mmc: zynq_sdhci: Fix timeout issue
2022-02-23 14:13 [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
@ 2022-02-23 14:13 ` Michal Simek
2022-02-23 14:13 ` [PATCH 2/3] mmc: zynq_sdhci: Change granularity of timeout to 1us Michal Simek
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2022-02-23 14:13 UTC (permalink / raw)
To: u-boot, git; +Cc: Ashok Reddy Soma, Jaehoon Chung, Peng Fan
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");
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] mmc: zynq_sdhci: Change granularity of timeout to 1us
2022-02-23 14:13 [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
2022-02-23 14:13 ` [PATCH 1/3] mmc: zynq_sdhci: Fix timeout issue Michal Simek
@ 2022-02-23 14:13 ` Michal Simek
2022-02-23 14:13 ` [PATCH 3/3] mmc: zynq_sdhci: Enable card detect workaround for ZynqMP Michal Simek
2022-03-07 7:55 ` [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
3 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2022-02-23 14:13 UTC (permalink / raw)
To: u-boot, git; +Cc: Ashok Reddy Soma, Jaehoon Chung, Peng Fan
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) {
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] mmc: zynq_sdhci: Enable card detect workaround for ZynqMP
2022-02-23 14:13 [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
2022-02-23 14:13 ` [PATCH 1/3] mmc: zynq_sdhci: Fix timeout issue Michal Simek
2022-02-23 14:13 ` [PATCH 2/3] mmc: zynq_sdhci: Change granularity of timeout to 1us Michal Simek
@ 2022-02-23 14:13 ` Michal Simek
2022-03-07 7:55 ` [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
3 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2022-02-23 14:13 UTC (permalink / raw)
To: u-boot, git; +Cc: Ashok Reddy Soma, Jaehoon Chung, Peng Fan
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) &
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes
2022-02-23 14:13 [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
` (2 preceding siblings ...)
2022-02-23 14:13 ` [PATCH 3/3] mmc: zynq_sdhci: Enable card detect workaround for ZynqMP Michal Simek
@ 2022-03-07 7:55 ` Michal Simek
3 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2022-03-07 7:55 UTC (permalink / raw)
To: U-Boot, git; +Cc: Jaehoon Chung, Peng Fan
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
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-07 7:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 14:13 [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
2022-02-23 14:13 ` [PATCH 1/3] mmc: zynq_sdhci: Fix timeout issue Michal Simek
2022-02-23 14:13 ` [PATCH 2/3] mmc: zynq_sdhci: Change granularity of timeout to 1us Michal Simek
2022-02-23 14:13 ` [PATCH 3/3] mmc: zynq_sdhci: Enable card detect workaround for ZynqMP Michal Simek
2022-03-07 7:55 ` [PATCH 0/3] mmc: zynqmp_sdhci: Driver fixes Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).