Skip to contentSkip to conversation

mmc: dw_mmc: Fixes timeout issue for FIFO mode

PATCH In review hmz007 2 participants 6 messages Jan 11, 2022 – Jan 12, 2022 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore
#1 lore raw
In reply to hmz007

Hi,

Quoted 6 lines · On 1/11/22 7:24 PM, hmz007 wrote:

Clearing the DTO interrupt should be unnecessary, and it would potentially result in never receiving this interrupt again.

Do power-on or reset from uboot for a while can reproduce the issue:
dwmci_data_transfer: Timeout waiting for data!
mmc_load_image_raw_sector: mmc block read error

Which board did you test? When you do power-on, is it reproduced every time?

Quoted 5 lines

Tested on NanoPi R4S with SanDisk Extreme PRO 32GB.

Fixes 8cb9d3ed3a ("mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode")

Could you change from your ID to your name?

Best Regards,
Jaehoon Chung

Quoted 18 lines
---
 drivers/mmc/dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/dw_mmc.c +1 -1
index a949dad574..8fa26b340b 100644
@@ -168,7 +168,7 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 			if (data->flags == MMC_DATA_READ &&
 			    (mask & (DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO))) {
 				dwmci_writel(host, DWMCI_RINTSTS,
-					     DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO);
+					     DWMCI_INTMSK_RXDR);
 				while (size) {
 					ret = dwmci_fifo_ready(host,
 							DWMCI_FIFO_EMPTY,

hmz007

author
#0 lore raw

PATCH 1/1 mmc: dw_mmc: Fixes timeout issue for FIFO mode

Clearing the DTO interrupt should be unnecessary, and it would potentially result in never receiving this interrupt again.

Do power-on or reset from uboot for a while can reproduce the issue:
dwmci_data_transfer: Timeout waiting for data!
mmc_load_image_raw_sector: mmc block read error

Tested on NanoPi R4S with SanDisk Extreme PRO 32GB.

Fixes 8cb9d3ed3a ("mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode")
---
 drivers/mmc/dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/dw_mmc.c +1 -1
index a949dad574..8fa26b340b 100644
@@ -168,7 +168,7 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 			if (data->flags == MMC_DATA_READ &&
 			    (mask & (DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO))) {
 				dwmci_writel(host, DWMCI_RINTSTS,
-					     DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO);
+					     DWMCI_INTMSK_RXDR);
 				while (size) {
 					ret = dwmci_fifo_ready(host,
 							DWMCI_FIFO_EMPTY,
Signature · 1 line
2.34.1
#2 lore raw
In reply to Jaehoon Chung

Hi,

Quoted 1 line

Which board did you test? When you do power-on, is it reproduced every

time?

I am using Rockchip RK3399 based board - NanoPi R4S for this test. It doesn't appear every time, but it should be encountered once about 20 times.
I have run "setenv bootcmd reset; saveenv; reset" for automated testing.

Quoted 1 line

Could you change from your ID to your name?

This is my first time sending a patch, sorry I didn't notice this, do I need to resend this patch?

BR,
Jensen, Huang

Quoted 48 lines · Jaehoon Chung

Hi,

Quoted 6 lines · On 1/11/22 7:24 PM, hmz007 wrote:

Clearing the DTO interrupt should be unnecessary, and it would potentially result in never receiving this interrupt again.

Do power-on or reset from uboot for a while can reproduce the issue:
dwmci_data_transfer: Timeout waiting for data!
mmc_load_image_raw_sector: mmc block read error

Which board did you test? When you do power-on, is it reproduced every time?

Quoted 4 lines

Tested on NanoPi R4S with SanDisk Extreme PRO 32GB.

Fixes 8cb9d3ed3a ("mmc: dw_mmc: Fixes data read when receiving DTO

interrupt in FIFO mode")

Quoted 1 line

Could you change from your ID to your name?

Best Regards,
Jaehoon Chung

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host

Quoted 9 lines
---
 drivers/mmc/dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/dw_mmc.c +0 -0
index a949dad574..8fa26b340b 100644
@@ -168,7 +168,7 @@ static int dwmci_data_transfer(struct dwmci_host

*host, struct mmc_data *data)

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 169

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -0
                      if (data->flags == MMC_DATA_READ &&
                          (mask & (DWMCI_INTMSK_RXDR |

DWMCI_INTMSK_DTO))) {

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 171

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -1
                              dwmci_writel(host, DWMCI_RINTSTS,
-                                          DWMCI_INTMSK_RXDR |

DWMCI_INTMSK_DTO);

Quoted 5 lines
drivers/mmc/dw_mmc.c +1 -0
+                                          DWMCI_INTMSK_RXDR);
                              while (size) {
                                      ret = dwmci_fifo_ready(host,
                                                      DWMCI_FIFO_EMPTY,
#3 lore raw
Quoted 9 lines · gtXfined H.

Hi,

Quoted 1 line

Which board did you test? When you do power-on, is it reproduced every

time?

I am using Rockchip RK3399 based board - NanoPi R4S for this test. It doesn't appear every time, but it should be encountered once about 20 times.
I have run "setenv bootcmd reset; saveenv; reset" for automated testing.

This patch doesn't clarify.

The below commit had been fixed that doesn't work when data read. "mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode"

It seems that not clearing during reset card.
(power glitch or other problem..?)

Best Regards,
Jaehoon Chung

Quoted 64 lines
Quoted 3 lines

Could you change from your ID to your name?

This is my first time sending a patch, sorry I didn't notice this, do I need to resend this patch?

BR,
Jensen, Huang

Quoted 48 lines · Jaehoon Chung

Hi,

Quoted 6 lines · On 1/11/22 7:24 PM, hmz007 wrote:

Clearing the DTO interrupt should be unnecessary, and it would potentially result in never receiving this interrupt again.

Do power-on or reset from uboot for a while can reproduce the issue:
dwmci_data_transfer: Timeout waiting for data!
mmc_load_image_raw_sector: mmc block read error

Which board did you test? When you do power-on, is it reproduced every time?

Quoted 4 lines

Tested on NanoPi R4S with SanDisk Extreme PRO 32GB.

Fixes 8cb9d3ed3a ("mmc: dw_mmc: Fixes data read when receiving DTO

interrupt in FIFO mode")

Quoted 1 line

Could you change from your ID to your name?

Best Regards,
Jaehoon Chung

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host

Quoted 9 lines
---
 drivers/mmc/dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/dw_mmc.c +0 -0
index a949dad574..8fa26b340b 100644
@@ -168,7 +168,7 @@ static int dwmci_data_transfer(struct dwmci_host

*host, struct mmc_data *data)

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 169

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -0
                      if (data->flags == MMC_DATA_READ &&
                          (mask & (DWMCI_INTMSK_RXDR |

DWMCI_INTMSK_DTO))) {

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 171

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -1
                              dwmci_writel(host, DWMCI_RINTSTS,
-                                          DWMCI_INTMSK_RXDR |

DWMCI_INTMSK_DTO);

Quoted 5 lines
drivers/mmc/dw_mmc.c +1 -0
+                                          DWMCI_INTMSK_RXDR);
                              while (size) {
                                      ret = dwmci_fifo_ready(host,
                                                      DWMCI_FIFO_EMPTY,
#5 lore raw
In reply to a message not in the archive

Hi,

Quoted 17 lines · gtXfined H.

Hi,

I switched back to master branch and only made the following changes.

drivers/mmc/dw_mmc.c +4 -0
@@ -167,6 +167,10 @@ static int dwmci_data_transfer(struct dwmci_host
 *host, struct mmc_data *data)
                        len = 0;
                        if (data->flags == MMC_DATA_READ &&
                            (mask & (DWMCI_INTMSK_RXDR |
 DWMCI_INTMSK_DTO))) {
+                               if (!(mask & DWMCI_INTMSK_DTO) &&
+                                    (dwmci_readl(host, DWMCI_RINTSTS) &
 DWMCI_INTMSK_DTO)) {
+                                       printf("warn: DTO changed to 1\n");
+                               }
Quoted 2 lines

dwmci_writel(host, DWMCI_RINTSTS,
DWMCI_INTMSK_RXDR |

You need to set your email-client environment.
https://www.kernel.org/doc/html/v5.16/process/email-clients.html?highlight=email

Quoted 33 lines
DWMCI_INTMSK_DTO);
                                while (size) {
drivers/mmc/dw_mmc.c +5 -0
@@ -224,6 +228,11 @@ static int dwmci_data_transfer(struct dwmci_host
 *host, struct mmc_data *data)
 
        dwmci_writel(host, DWMCI_RINTSTS, mask);
 
+#ifdef CONFIG_SPL_BUILD
+       printf("mmc: transfer %8p, %5d, in %4ld  (%d, %02x)\n",
+                       buf, data->blocks, get_timer(start), size, mask);
+#endif
+
        return ret;
 }

Then tried the same test and reproduced the timeout issue with the following logs.

U-Boot SPL 2022.01-00373-gfe04d885fb-dirty (Jan 12 2022 - 13:52:15 +0800) Trying to boot from MMC1
mmc: transfer 3fffac8, 1, in 0 (0, 0c)
mmc: transfer 3fffb80, 1, in 2 (0, 0c)
mmc: transfer 3fffd00, 1, in 1 (0, 0c)
warn: DTO changed to 1
mmc: transfer 2001c0, 1, in 1001 (0, 04)
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC1
warn: DTO changed to 1
mmc: transfer 2001c0, 1, in 1001 (0, 04)
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Quoted 2 lines

According to the logs, you can see that the DTO interrupt was unintentionally cleared

I had been tested after set the fifo-mode. It's occurred timeout error. But your patch doesn't work, too. It's not solution to solve this problem.

Well, I have checked some code. It seems that there are some bugs about fifo-mode.

Best Regards,
Jaehoon Chung

Quoted 98 lines

BR,
Jensen, Huang

Quoted 88 lines · Jaehoon Chung
Quoted 9 lines · gtXfined H.

Hi,

Quoted 1 line

Which board did you test? When you do power-on, is it reproduced every

time?

I am using Rockchip RK3399 based board - NanoPi R4S for this test. It doesn't appear every time, but it should be encountered once about 20 times.
I have run "setenv bootcmd reset; saveenv; reset" for automated testing.

This patch doesn't clarify.

The below commit had been fixed that doesn't work when data read. "mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode"

It seems that not clearing during reset card.
(power glitch or other problem..?)

Best Regards,
Jaehoon Chung

Quoted 64 lines
Quoted 3 lines

Could you change from your ID to your name?

This is my first time sending a patch, sorry I didn't notice this, do I need to resend this patch?

BR,
Jensen, Huang

Quoted 48 lines · Jaehoon Chung

Hi,

Quoted 6 lines · On 1/11/22 7:24 PM, hmz007 wrote:

Clearing the DTO interrupt should be unnecessary, and it would potentially result in never receiving this interrupt again.

Do power-on or reset from uboot for a while can reproduce the issue:
dwmci_data_transfer: Timeout waiting for data!
mmc_load_image_raw_sector: mmc block read error

Which board did you test? When you do power-on, is it reproduced every time?

Quoted 4 lines

Tested on NanoPi R4S with SanDisk Extreme PRO 32GB.

Fixes 8cb9d3ed3a ("mmc: dw_mmc: Fixes data read when receiving DTO

interrupt in FIFO mode")

Quoted 1 line

Could you change from your ID to your name?

Best Regards,
Jaehoon Chung

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host

Quoted 9 lines
---
 drivers/mmc/dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/dw_mmc.c +0 -0
index a949dad574..8fa26b340b 100644
@@ -168,7 +168,7 @@ static int dwmci_data_transfer(struct dwmci_host

*host, struct mmc_data *data)

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 169

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -0
                      if (data->flags == MMC_DATA_READ &&
                          (mask & (DWMCI_INTMSK_RXDR |

DWMCI_INTMSK_DTO))) {

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 171

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -1
                              dwmci_writel(host, DWMCI_RINTSTS,
-                                          DWMCI_INTMSK_RXDR |

DWMCI_INTMSK_DTO);

Quoted 5 lines
drivers/mmc/dw_mmc.c +1 -0
+                                          DWMCI_INTMSK_RXDR);
                              while (size) {
                                      ret = dwmci_fifo_ready(host,
                                                      DWMCI_FIFO_EMPTY,
#6 lore raw

Hi,

The modification in the last email is just to debug the timeout error and get a clearer understanding of
the timeout error, it doesn't solve the problem.

But the patch in my first email (sent by git), from what I've tested, does solve the timeout error.

BR,
Jensen, Huang

Quoted 179 lines · Jaehoon Chung

Hi,

Quoted 7 lines · gtXfined H.

Hi,

I switched back to master branch and only made the following changes.

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 175

Quoted 9 lines
drivers/mmc/dw_mmc.c +3 -0
@@ -167,6 +167,10 @@ static int dwmci_data_transfer(struct dwmci_host
 *host, struct mmc_data *data)
                        len = 0;
                        if (data->flags == MMC_DATA_READ &&
                            (mask & (DWMCI_INTMSK_RXDR |
 DWMCI_INTMSK_DTO))) {
+                               if (!(mask & DWMCI_INTMSK_DTO) &&
+                                    (dwmci_readl(host, DWMCI_RINTSTS) &
 DWMCI_INTMSK_DTO)) {
+                                       printf("warn: DTO changed to

1\n");

Quoted 3 lines
drivers/mmc/dw_mmc.c +1 -0
+                               }

dwmci_writel(host, DWMCI_RINTSTS,
DWMCI_INTMSK_RXDR |

You need to set your email-client environment.

https://www.kernel.org/doc/html/v5.16/process/email-clients.html?highlight=email

Quoted 33 lines
DWMCI_INTMSK_DTO);
                                while (size) {
drivers/mmc/dw_mmc.c +5 -0
@@ -224,6 +228,11 @@ static int dwmci_data_transfer(struct dwmci_host
 *host, struct mmc_data *data)
 
        dwmci_writel(host, DWMCI_RINTSTS, mask);
 
+#ifdef CONFIG_SPL_BUILD
+       printf("mmc: transfer %8p, %5d, in %4ld  (%d, %02x)\n",
+                       buf, data->blocks, get_timer(start), size, mask);
+#endif
+
        return ret;
 }

Then tried the same test and reproduced the timeout issue with the following logs.

U-Boot SPL 2022.01-00373-gfe04d885fb-dirty (Jan 12 2022 - 13:52:15 +0800) Trying to boot from MMC1
mmc: transfer 3fffac8, 1, in 0 (0, 0c)
mmc: transfer 3fffb80, 1, in 2 (0, 0c)
mmc: transfer 3fffd00, 1, in 1 (0, 0c)
warn: DTO changed to 1
mmc: transfer 2001c0, 1, in 1001 (0, 04)
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC1
warn: DTO changed to 1
mmc: transfer 2001c0, 1, in 1001 (0, 04)
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Quoted 2 lines

According to the logs, you can see that the DTO interrupt was unintentionally cleared

I had been tested after set the fifo-mode. It's occurred timeout error. But your patch doesn't work, too. It's not solution to solve this problem.

Well, I have checked some code. It seems that there are some bugs about fifo-mode.

Best Regards,
Jaehoon Chung

Quoted 13 lines

BR,
Jensen, Huang

Quoted 4 lines · Jaehoon Chung
Quoted 3 lines · gtXfined H.

Hi,

Quoted 1 line

Which board did you test? When you do power-on, is it reproduced

every

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

time?

I am using Rockchip RK3399 based board - NanoPi R4S for this test. It doesn't appear every time, but it should be encountered once about

20

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

times.
I have run "setenv bootcmd reset; saveenv; reset" for automated

testing.

Quoted 64 lines
Quoted 64 lines

This patch doesn't clarify.

The below commit had been fixed that doesn't work when data read. "mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode"

It seems that not clearing during reset card.
(power glitch or other problem..?)

Best Regards,
Jaehoon Chung

Quoted 52 lines
Quoted 3 lines

Could you change from your ID to your name?

This is my first time sending a patch, sorry I didn't notice this, do I need to resend this patch?

BR,
Jensen, Huang

Quoted 37 lines · Jaehoon Chung

Hi,

Quoted 6 lines · On 1/11/22 7:24 PM, hmz007 wrote:

Clearing the DTO interrupt should be unnecessary, and it would potentially result in never receiving this interrupt again.

Do power-on or reset from uboot for a while can reproduce the issue:
dwmci_data_transfer: Timeout waiting for data!
mmc_load_image_raw_sector: mmc block read error

Which board did you test? When you do power-on, is it reproduced every time?

Quoted 4 lines

Tested on NanoPi R4S with SanDisk Extreme PRO 32GB.

Fixes 8cb9d3ed3a ("mmc: dw_mmc: Fixes data read when receiving DTO

interrupt in FIFO mode")

Quoted 1 line

Could you change from your ID to your name?

Best Regards,
Jaehoon Chung

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host

Quoted 9 lines
---
 drivers/mmc/dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/dw_mmc.c +0 -0
index a949dad574..8fa26b340b 100644
@@ -168,7 +168,7 @@ static int dwmci_data_transfer(struct dwmci_host

*host, struct mmc_data *data)

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -0
                      if (data->flags == MMC_DATA_READ &&
                          (mask & (DWMCI_INTMSK_RXDR |
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

DWMCI_INTMSK_DTO))) {

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 171

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -1
                              dwmci_writel(host, DWMCI_RINTSTS,
-                                          DWMCI_INTMSK_RXDR |

DWMCI_INTMSK_DTO);

Quoted 4 lines
drivers/mmc/dw_mmc.c +1 -0
+                                          DWMCI_INTMSK_RXDR);
                              while (size) {
                                      ret = dwmci_fifo_ready(host,
 

DWMCI_FIFO_EMPTY,

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line