Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94dd5b33 authored by James Hogan's avatar James Hogan Committed by Chris Ball
Browse files

mmc: dw_mmc: reset FIFO after an error



If an error occurs mid way through a transaction (such as a missing CRC
status response after the 2nd block written out of 3), then the FIFO may
still contain data which will interfere with the next transaction.
Therefore after an error has been detected, reset the fifo using the
CTRL register.

Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
Acked-by: default avatarWill Newton <will.newton@imgtec.com>
Tested-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 55c5efbc
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -849,7 +849,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
	struct mmc_command *cmd;
	struct mmc_command *cmd;
	enum dw_mci_state state;
	enum dw_mci_state state;
	enum dw_mci_state prev_state;
	enum dw_mci_state prev_state;
	u32 status;
	u32 status, ctrl;


	spin_lock(&host->lock);
	spin_lock(&host->lock);


@@ -929,6 +929,16 @@ static void dw_mci_tasklet_func(unsigned long priv)
						status);
						status);
					data->error = -EIO;
					data->error = -EIO;
				}
				}
				/*
				 * After an error, there may be data lingering
				 * in the FIFO, so reset it - doing so
				 * generates a block interrupt, hence setting
				 * the scatter-gather pointer to NULL.
				 */
				host->sg = NULL;
				ctrl = mci_readl(host, CTRL);
				ctrl |= SDMMC_CTRL_FIFO_RESET;
				mci_writel(host, CTRL, ctrl);
			} else {
			} else {
				data->bytes_xfered = data->blocks * data->blksz;
				data->bytes_xfered = data->blocks * data->blksz;
				data->error = 0;
				data->error = 0;