Skip to content

Commit

Permalink
atmel-mci: Don't overwrite error bits when NOTBUSY is set
Browse files Browse the repository at this point in the history
After a data error, we wait for the NOTBUSY bit to be set so that we can
be sure the data transfer is completely finished. However, when NOTBUSY
is set, the interrupt handler copies the contents of SR into
data_status, overwriting any error bits we may have detected earlier.

To avoid this, initialize data_status to 0 before starting a request, and
don't overwrite it unless it still contains 0.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
  • Loading branch information
Haavard Skinnemoen committed Oct 5, 2008
1 parent 65e8b08 commit ca55f46
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mmc/host/atmel-mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ static void atmci_start_request(struct atmel_mci *host,

host->pending_events = 0;
host->completed_events = 0;
host->data_status = 0;

if (host->need_reset) {
mci_writel(host, CR, MCI_CR_SWRST);
Expand Down Expand Up @@ -1408,7 +1409,8 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
if (pending & MCI_NOTBUSY) {
mci_writel(host, IDR,
ATMCI_DATA_ERROR_FLAGS | MCI_NOTBUSY);
host->data_status = status;
if (!host->data_status)
host->data_status = status;
smp_wmb();
atmci_set_pending(host, EVENT_DATA_COMPLETE);
tasklet_schedule(&host->tasklet);
Expand Down

0 comments on commit ca55f46

Please sign in to comment.