Skip to content
Snippets Groups Projects
Commit 2b429033 authored by Jacob Chen's avatar Jacob Chen Committed by Jaehoon Chung
Browse files

mmc: dw_mmc: push/pop all FIFO data if any data request


When DTO interrupt occurred, there are any remaining data still in FIFO
due to RX FIFO threshold is larger than remaining data. It also
causes that dwmmc didn't trigger RXDR interrupt, so is TX.

It's responsibility of driver to read remaining bytes on seeing DTO
interrupt.

Signed-off-by: default avatarJacob Chen <jacob2.chen@rock-chips.com>
Signed-off-by: default avatarZiyuan Xu <xzy.xu@rock-chips.com>
parent 6dffdbc3
No related branches found
No related tags found
No related merge requests found
...@@ -120,9 +120,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) ...@@ -120,9 +120,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
if (host->fifo_mode && size) { if (host->fifo_mode && size) {
len = 0; len = 0;
if (data->flags == MMC_DATA_READ) { if (data->flags == MMC_DATA_READ &&
if ((dwmci_readl(host, DWMCI_RINTSTS) & (mask & DWMCI_INTMSK_RXDR)) {
DWMCI_INTMSK_RXDR)) { while (size) {
len = dwmci_readl(host, DWMCI_STATUS); len = dwmci_readl(host, DWMCI_STATUS);
len = (len >> DWMCI_FIFO_SHIFT) & len = (len >> DWMCI_FIFO_SHIFT) &
DWMCI_FIFO_MASK; DWMCI_FIFO_MASK;
...@@ -130,12 +130,13 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) ...@@ -130,12 +130,13 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
*buf++ = *buf++ =
dwmci_readl(host, DWMCI_DATA); dwmci_readl(host, DWMCI_DATA);
dwmci_writel(host, DWMCI_RINTSTS, size = size > len ? (size - len) : 0;
DWMCI_INTMSK_RXDR);
} }
} else { dwmci_writel(host, DWMCI_RINTSTS,
if ((dwmci_readl(host, DWMCI_RINTSTS) & DWMCI_INTMSK_RXDR);
DWMCI_INTMSK_TXDR)) { } else if (data->flags == MMC_DATA_WRITE &&
(mask & DWMCI_INTMSK_TXDR)) {
while (size) {
len = dwmci_readl(host, DWMCI_STATUS); len = dwmci_readl(host, DWMCI_STATUS);
len = fifo_depth - ((len >> len = fifo_depth - ((len >>
DWMCI_FIFO_SHIFT) & DWMCI_FIFO_SHIFT) &
...@@ -144,11 +145,11 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) ...@@ -144,11 +145,11 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
dwmci_writel(host, DWMCI_DATA, dwmci_writel(host, DWMCI_DATA,
*buf++); *buf++);
dwmci_writel(host, DWMCI_RINTSTS, size = size > len ? (size - len) : 0;
DWMCI_INTMSK_TXDR);
} }
dwmci_writel(host, DWMCI_RINTSTS,
DWMCI_INTMSK_TXDR);
} }
size = size > len ? (size - len) : 0;
} }
/* Data arrived correctly. */ /* Data arrived correctly. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment