All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Pierre Ossman <drzeus@drzeus.cx>
Cc: "Nicolas Ferre" <nicolas.ferre@atmel.com>,
	"Hans-Jürgen Koch" <hjk@linutronix.de>,
	"Ville Syrjälä" <syrjala@sci.fi>,
	"Linux Kernel list" <linux-kernel@vger.kernel.org>,
	"ARM Linux Mailing List"
	<linux-arm-kernel@lists.arm.linux.org.uk>,
	"Eric BENARD" <ebenard@free.fr>,
	"Andrew Victor" <linux@maxim.org.za>
Subject: [PATCH 7/7] mmc: at91_mci: do not read irq status twice as it will forget some errors
Date: Fri, 30 May 2008 14:28:45 +0200	[thread overview]
Message-ID: <483FF2FD.7020609@atmel.com> (raw)
In-Reply-To: <483FE9E7.7020707@atmel.com>

Reading AT91_MCI_SR again at the end of transfer can corrupt the
error reporting. Some fields in the SR register are read-and-clear.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/mmc/host/at91_mci.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 92a0200..9948fe1 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -660,10 +660,9 @@ static void at91_mci_process_next(struct at91mci_host *host)
 /*
  * Handle a command that has been completed
  */
-static void at91_mci_completed_command(struct at91mci_host *host)
+static void at91_mci_completed_command(struct at91mci_host *host, unsigned int status)
 {
 	struct mmc_command *cmd = host->cmd;
-	unsigned int status;
 
 	at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
 
@@ -677,10 +676,9 @@ static void at91_mci_completed_command(struct at91mci_host *host)
 		host->buffer = NULL;
 	}
 
-	status = at91_mci_read(host, AT91_MCI_SR);
-
-	pr_debug("Status = %08X [%08X %08X %08X %08X]\n",
-		 status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
+	pr_debug("Status = %08X/%08x [%08X %08X %08X %08X]\n",
+		 status, at91_mci_read(host, AT91_MCI_SR),
+		 cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
 
 	if (status & AT91_MCI_ERRORS) {
 		if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
@@ -877,7 +875,7 @@ static irqreturn_t at91_mci_irq(int irq, void *devid)
 	if (completed) {
 		pr_debug("Completed command\n");
 		at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
-		at91_mci_completed_command(host);
+		at91_mci_completed_command(host, int_status);
 	} else
 		at91_mci_write(host, AT91_MCI_IDR, int_status & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
 
-- 
1.5.3.7



  parent reply	other threads:[~2008-05-30 12:29 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 ` Nicolas Ferre [this message]
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 ` [PATCH 2/7] mmc: at91_mci: show timeouts Nicolas Ferre
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=483FF2FD.7020609@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=drzeus@drzeus.cx \
    --cc=ebenard@free.fr \
    --cc=hjk@linutronix.de \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@maxim.org.za \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.