public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Pierre Ossman <drzeus@drzeus.cx>
Cc: ARM Linux Mailing List <linux-arm-kernel@lists.arm.linux.org.uk>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Marc Pignat <marc.pignat@hevs.ch>
Subject: [PATCH] at91_mci: manage cmd error and data error independently
Date: Tue, 10 Jun 2008 11:27:29 +0200	[thread overview]
Message-ID: <484E4901.3060705@atmel.com> (raw)
In-Reply-To: <20080609130854.2237c05a@mjolnir.drzeus.cx>

In at91_mci_completed_command() function, this patch distinguishes 
command error and data error. It reports it in the corresponding 
error field.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Related to this thread :

Pierre Ossman :

> On Fri, 06 Jun 2008 17:31:15 +0200
> Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
>
>   
>> Hi Pierre,
>>
>> Here are the results of a mmc_test run played on at91_mci after applying 
>> this patch series :
>> http://lkml.org/lkml/2008/5/30/201
>>
>> I skipped some of the tests just to concentrate on those ones.
>>
>> Can you tell me if the test is correct : are the errors reported for the 
>> xfer_size tests the normal behavior (I assume yes because a failure is 
>> simulated) ?
>>     
>
> No. You're supposed to get an OK there as well. Basically it tests that
> the driver doesn't report some unexpected error (-ETIMEDOUT is the
> desired one) or overreports the number of written bytes.
>   
Ok, so here is the first correction of the driver reporting the proper 
values in read.

It goes on top of this series :
http://lkml.org/lkml/2008/5/30/201

 drivers/mmc/host/at91_mci.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 9948fe1..86a3c5b 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -663,6 +664,7 @@ static void at91_mci_process_next(struct at91mci_host *host)
 static void at91_mci_completed_command(struct at91mci_host *host, unsigned int status)
 {
 	struct mmc_command *cmd = host->cmd;
+	struct mmc_data *data = cmd->data;
 
 	at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
 
@@ -685,15 +687,25 @@ static void at91_mci_completed_command(struct at91mci_host *host, unsigned int s
 			cmd->error = 0;
 		}
 		else {
-			if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE))
-				cmd->error = -ETIMEDOUT;
-			else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE))
-				cmd->error = -EILSEQ;
-			else
-				cmd->error = -EIO;
+			if (status & (AT91_MCI_DTOE | AT91_MCI_DCRCE)) {
+				if (data) {
+					if (status & AT91_MCI_DTOE)
+						data->error = -ETIMEDOUT;
+					else if (status & AT91_MCI_DCRCE)
+						data->error = -EILSEQ;
+				}
+			} else {
+				if (status & AT91_MCI_RTOE)
+					cmd->error = -ETIMEDOUT;
+				else if (status & AT91_MCI_RCRCE)
+					cmd->error = -EILSEQ;
+				else
+					cmd->error = -EIO;
+			}
 
-			pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n",
-				 cmd->error, cmd->opcode, cmd->retries);
+			pr_debug("Error detected and set to %d/%d (cmd = %d, retries = %d)\n",
+				cmd->error, data ? data->error : 0,
+				 cmd->opcode, cmd->retries);
 		}
 	}
 	else
-- 
1.5.3.7



      reply	other threads:[~2008-06-10  9:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 15:31 mmc_test : some results Nicolas Ferre
2008-06-09  0:21 ` Gururaja Hebbar K R
2008-06-09  7:54   ` Nicolas Ferre
2008-06-09 11:08 ` Pierre Ossman
2008-06-10  9:27   ` Nicolas Ferre [this message]

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=484E4901.3060705@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=drzeus@drzeus.cx \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.pignat@hevs.ch \
    /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