All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode
@ 2021-04-26  3:35 ` Ley Foon Tan
  2021-04-26 22:15   ` Jaehoon Chung
  0 siblings, 1 reply; 2+ messages in thread
From: Ley Foon Tan @ 2021-04-26  3:35 UTC (permalink / raw)
  To: u-boot

The data read is not working when using FIFO mode.

From DesignWare databook, when a Data_Transfer_Over (DTO) interrupt is
received, the software should read the remaining data from FIFO.

Add DTO interrupt checking on data read path and clear interrupts before
start reading from FIFO. So, it doesn't clear the next pending
interrupts unintentionally after read from FIFO.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 drivers/mmc/dw_mmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 7c8a312fa71a..a949dad57402 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -166,7 +166,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 		if (host->fifo_mode && size) {
 			len = 0;
 			if (data->flags == MMC_DATA_READ &&
-			    (mask & DWMCI_INTMSK_RXDR)) {
+			    (mask & (DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO))) {
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO);
 				while (size) {
 					ret = dwmci_fifo_ready(host,
 							DWMCI_FIFO_EMPTY,
@@ -182,8 +184,6 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 						dwmci_readl(host, DWMCI_DATA);
 					size = size > len ? (size - len) : 0;
 				}
-				dwmci_writel(host, DWMCI_RINTSTS,
-					     DWMCI_INTMSK_RXDR);
 			} else if (data->flags == MMC_DATA_WRITE &&
 				   (mask & DWMCI_INTMSK_TXDR)) {
 				while (size) {
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode
  2021-04-26  3:35 ` [PATCH] mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode Ley Foon Tan
@ 2021-04-26 22:15   ` Jaehoon Chung
  0 siblings, 0 replies; 2+ messages in thread
From: Jaehoon Chung @ 2021-04-26 22:15 UTC (permalink / raw)
  To: u-boot

On 4/26/21 12:35 PM, Ley Foon Tan wrote:
> The data read is not working when using FIFO mode.
> 
>>From DesignWare databook, when a Data_Transfer_Over (DTO) interrupt is
> received, the software should read the remaining data from FIFO.
> 
> Add DTO interrupt checking on data read path and clear interrupts before
> start reading from FIFO. So, it doesn't clear the next pending
> interrupts unintentionally after read from FIFO.
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/dw_mmc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index 7c8a312fa71a..a949dad57402 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -166,7 +166,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>  		if (host->fifo_mode && size) {
>  			len = 0;
>  			if (data->flags == MMC_DATA_READ &&
> -			    (mask & DWMCI_INTMSK_RXDR)) {
> +			    (mask & (DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO))) {
> +				dwmci_writel(host, DWMCI_RINTSTS,
> +					     DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO);
>  				while (size) {
>  					ret = dwmci_fifo_ready(host,
>  							DWMCI_FIFO_EMPTY,
> @@ -182,8 +184,6 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>  						dwmci_readl(host, DWMCI_DATA);
>  					size = size > len ? (size - len) : 0;
>  				}
> -				dwmci_writel(host, DWMCI_RINTSTS,
> -					     DWMCI_INTMSK_RXDR);
>  			} else if (data->flags == MMC_DATA_WRITE &&
>  				   (mask & DWMCI_INTMSK_TXDR)) {
>  				while (size) {
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-26 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210426033525epcas1p127ea8c467926cc8cdfe21e320e216ea0@epcas1p1.samsung.com>
2021-04-26  3:35 ` [PATCH] mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode Ley Foon Tan
2021-04-26 22:15   ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.