]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: dw_mmc: Fixes data read when receiving DTO interrupt in FIFO mode
authorLey Foon Tan <ley.foon.tan@intel.com>
Mon, 26 Apr 2021 03:35:05 +0000 (11:35 +0800)
committerPeng Fan <peng.fan@nxp.com>
Tue, 22 Jun 2021 04:02:11 +0000 (12:02 +0800)
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>
drivers/mmc/dw_mmc.c

index 7c8a312fa71a31dbbff8a11ac3a205a4339091bc..a949dad57402d454bc95a29f96ab545b7f5cbbae 100644 (file)
@@ -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) {