summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/mmci.c
diff options
context:
space:
mode:
authorLudovic Barre <ludovic.barre@st.com>2018-10-08 14:08:49 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2018-10-09 09:13:04 +0200
commitb79220b3e0af5037b2ae90a5d2c32bc1a1e627fb (patch)
treeedb3d648868d3841cce4aa4ffd4988f246c30453 /drivers/mmc/host/mmci.c
parentd2141547f594d396f85010ba0b37d0e9491943b6 (diff)
downloadlinux-b79220b3e0af5037b2ae90a5d2c32bc1a1e627fb.tar.bz2
mmc: mmci: add variant property to not read datacnt
This patch adds a boolean property to not read datacnt register. Needed to support the STM32 sdmmc variant. MMCIDATACNT register should be read only after the data transfer is completed. When reading after an error event the read data count value may be different from the real number of data bytes transferred. Signed-off-by: Ludovic Barre <ludovic.barre@st.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/mmci.c')
-rw-r--r--drivers/mmc/host/mmci.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 66aa59f54cd9..760759919f7f 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1123,8 +1123,12 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
* can be as much as a FIFO-worth of data ahead. This
* matters for FIFO overruns only.
*/
- remain = readl(host->base + MMCIDATACNT);
- success = data->blksz * data->blocks - remain;
+ if (!host->variant->datacnt_useless) {
+ remain = readl(host->base + MMCIDATACNT);
+ success = data->blksz * data->blocks - remain;
+ } else {
+ success = 0;
+ }
dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ, status 0x%08x at 0x%08x\n",
status_err, success);