/* Latest in the scatterlist that has been enabled for transfer */
int transfer_index;
+
+ /* Timer for timeouts */
+ struct timer_list timer;
};
+static void at91_timeout_timer(unsigned long data)
+{
+ struct at91mci_host *host;
+
+ host = (struct at91mci_host *)data;
+
+ if (host->request) {
+ dev_err(host->mmc->parent, "Timeout waiting end of packet\n");
+
+ if (host->cmd && host->cmd->data) {
+ host->cmd->data->error = -ETIMEDOUT;
+ } else {
+ if (host->cmd)
+ host->cmd->error = -ETIMEDOUT;
+ else
+ host->request->cmd->error = -ETIMEDOUT;
+ }
+
+ mmc_request_done(host->mmc, host->request);
+ }
+}
+
/*
* Copy from sg to a dma block - used for transfers
*/
else if ((!(host->flags & FL_SENT_STOP)) && host->request->stop) {
host->flags |= FL_SENT_STOP;
at91_mci_send_command(host, host->request->stop);
- }
- else
+ } else {
+ del_timer(&host->timer);
mmc_request_done(host->mmc, host->request);
+ }
}
/*
host->request = mrq;
host->flags = 0;
+ mod_timer(&host->timer, jiffies + HZ);
+
at91_mci_process_next(host);
}
mmc_add_host(mmc);
+ setup_timer(&host->timer, at91_timeout_timer, (unsigned long)host);
+
/*
* monitor card insertion/removal if we can
*/
}
at91_mci_disable(host);
+ del_timer_sync(&host->timer);
mmc_remove_host(mmc);
free_irq(host->irq, host);