1 --- a/drivers/mmc/host/atmel-mci.c
2 +++ b/drivers/mmc/host/atmel-mci.c
3 @@ -77,6 +77,7 @@ struct atmel_mci {
5 struct platform_device *pdev;
9 struct dentry *debugfs_root;
10 struct dentry *debugfs_regs;
11 @@ -866,6 +867,12 @@ static void atmci_tasklet_func(unsigned long priv)
12 data->bytes_xfered = data->blocks * data->blksz;
13 atmci_data_complete(host, data);
15 + /* See if there is a pending STOP which can be sent */
16 + if (host->pending_stop && mci_cmd_is_complete(host)) {
17 + host->pending_stop = 0;
18 + if (mrq->stop && !mci_set_stop_sent_is_completed(host))
19 + send_stop_cmd(host->mmc, mrq->data, 0);
23 static void atmci_cmd_interrupt(struct mmc_host *mmc, u32 status)
24 @@ -918,9 +925,16 @@ static void atmci_xfer_complete(struct dma_request *_req)
25 * drivers) or when interrupts are disabled for a long time.
27 mci_set_dma_complete(host);
28 - if (data->stop && mci_cmd_is_complete(host)
29 - && !mci_set_stop_sent_is_completed(host))
30 - send_stop_cmd(host->mmc, data, 0);
33 + if (!mci_cmd_is_complete(host)) {
34 + /* Just remember a STOP must be sent */
35 + host->pending_stop = 1;
36 + } else if (!mci_set_stop_sent_is_completed(host)) {
37 + send_stop_cmd(host->mmc, data, 0);
38 + host->pending_stop = 0;
43 * Regardless of what the documentation says, we have to wait