From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: "Hans-Jürgen Koch" <hjk@linutronix.de>,
"Ville Syrjälä" <syrjala@sci.fi>,
"Linux Kernel list" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/7] mmc: at91_mci: show timeouts
Date: Fri, 30 May 2008 14:44:31 +0200 [thread overview]
Message-ID: <483FF6AF.20803@atmel.com> (raw)
In-Reply-To: <483FE9E7.7020707@atmel.com>
From: Marc Pignat <marc.pignat@hevs.ch>
Detect command timeout (or mci controller hangs).
Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: Hans J Koch <hjk@linutronix.de>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
drivers/mmc/host/at91_mci.c | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 543b64b..4b4518f 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -125,8 +125,33 @@ struct at91mci_host
/* 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
*/
@@ -557,9 +582,10 @@ static void at91_mci_process_next(struct
at91mci_host *host)
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);
+ }
}
/*
@@ -618,6 +644,8 @@ static void at91_mci_request(struct mmc_host *mmc,
struct mmc_request *mrq)
host->request = mrq;
host->flags = 0;
+ mod_timer(&host->timer, jiffies + HZ);
+
at91_mci_process_next(host);
}
@@ -940,6 +968,8 @@ static int __init at91_mci_probe(struct
platform_device *pdev)
mmc_add_host(mmc);
+ setup_timer(&host->timer, at91_timeout_timer, (unsigned long)host);
+
/*
* monitor card insertion/removal if we can
*/
@@ -1000,6 +1030,7 @@ static int __exit at91_mci_remove(struct
platform_device *pdev)
}
at91_mci_disable(host);
+ del_timer_sync(&host->timer);
mmc_remove_host(mmc);
free_irq(host->irq, host);
--
1.5.3.7
next prev parent reply other threads:[~2008-05-30 12:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 11:49 [PATCH 0/7] mmc: at91_mci: rework to allow better transfer Nicolas Ferre
2008-05-30 12:18 ` [PATCH 5/7] mmc: at91_mci: update bytes_xfered value once xfer done Nicolas Ferre
2008-06-01 14:44 ` Russell King - ARM Linux
2008-05-30 12:26 ` [PATCH 6/7] mmc: at91_mci: add sdio irq management Nicolas Ferre
2008-05-30 12:28 ` [PATCH 7/7] mmc: at91_mci: do not read irq status twice as it will forget some errors Nicolas Ferre
2008-05-30 12:43 ` [PATCH 1/7] mmc: at91_mci: support for block size not modulo 4 Nicolas Ferre
2008-05-30 12:44 ` Nicolas Ferre [this message]
2008-05-30 12:45 ` [PATCH 3/7] mmc: at91_mci: avoid timeouts Nicolas Ferre
2008-05-30 12:45 ` [PATCH 4/7] mmc: at91_mci: add multiwrite switch Nicolas Ferre
[not found] ` <483FED84.50100@atmel.com>
2008-05-30 12:57 ` [PATCH 1/7] mmc: at91_mci: support for block size not modulo 4 Marc Pignat
[not found] ` <483FEE58.5000500@atmel.com>
2008-06-01 14:42 ` [PATCH 4/7] mmc: at91_mci: add multiwrite switch Russell King - ARM Linux
2008-06-09 10:42 ` Pierre Ossman
2008-06-09 13:08 ` Russell King - ARM Linux
2008-06-09 13:42 ` Pierre Ossman
2008-06-09 13:53 ` Russell King - ARM Linux
2008-06-09 13:58 ` Pierre Ossman
2008-06-09 10:46 ` [PATCH 0/7] mmc: at91_mci: rework to allow better transfer Pierre Ossman
2008-06-10 9:54 ` Nicolas Ferre
2008-06-14 16:28 ` Pierre Ossman
2008-06-18 10:04 ` Nicolas Ferre
2008-06-18 10:47 ` Erik Mouw
2008-06-18 11:16 ` Erik Mouw
2008-06-18 11:40 ` Hans J. Koch
2008-06-18 11:47 ` David Woodhouse
2008-06-18 13:35 ` Erik Mouw
2008-06-18 13:37 ` David Woodhouse
2008-06-18 15:17 ` Erik Mouw
2008-06-20 16:30 ` Pierre Ossman
[not found] ` <6306c640806201005n17aba42ag6f0bc344256a1ad@mail.gmail.com>
2008-06-20 17:25 ` Pierre Ossman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=483FF6AF.20803@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=hjk@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=syrjala@sci.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox