linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Pihet <jpihet@mvista.com>
To: Tony Lindgren <tony@atomide.com>,
	Adrian Hunter <ext-adrian.hunter@nokia.com>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-omap@vger.kernel.org,
	"Jarkko Lavinen (NMP/Helsinki)" <jarkko.lavinen@nokia.com>,
	Pierre Ossman <drzeus-mmc@drzeus.cx>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] OMAP: MMC: recover from transfer failures - Resend
Date: Tue, 3 Feb 2009 15:05:58 +0100	[thread overview]
Message-ID: <200902031505.58697.jpihet@mvista.com> (raw)
In-Reply-To: <20090202190503.GT7215@atomide.com>

[-- Attachment #1: Type: text/plain, Size: 3081 bytes --]

Hi,

This is a re-send of the patch that fixes a MMC host controller deadlock. The 
problem happens when removing the MMC/SD device when a transfer is on-going.

It has been tested on OMAP3430 but this fix should apply to OMAP2 chips as 
well, as seen from the TRMs.

Regards,
Jean

From d143f6b2e705aa4e9d2b032097fd1c82f8163262 Mon Sep 17 00:00:00 2001
From: Jean Pihet <jpihet@mvista.com>
Date: Thu, 8 Jan 2009 12:35:21 +0100
Subject: [PATCH] OMAP: MMC: recover from transfer failures

Timeouts during a command that has a data phase can result in the
next command issued after the command that failed not being processed,
i.e. no interrupt ever occurs to indicate the command has completed.
This failure can result in a deadlock.

This patch resets the data state machine to clear the error in
case of a command timeout.

Tested on OMAP3430 chip and intensive MMC/SD device removal while
transferring data.

Signed-off-by: Andy Lowe <alowe@mvista.com>
Signed-off-by: Jean Pihet <jpihet@mvista.com>
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
 drivers/mmc/host/omap_hsmmc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d5c1e9d..97150c0 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -464,8 +464,15 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
                                }
                                end_cmd = 1;
                        }
-                       if (host->data)
+                       if (host->data) {
                                mmc_dma_cleanup(host);
+                               OMAP_HSMMC_WRITE(host->base, SYSCTL,
+                                       OMAP_HSMMC_READ(host->base,
+                                                       SYSCTL) | SRD);
+                               while (OMAP_HSMMC_READ(host->base,
+                                               SYSCTL) & SRD)
+                                       ;
+                       }
                }
                if ((status & DATA_TIMEOUT) ||
                        (status & DATA_CRC)) {
--
1.5.4.4.21.gc4a6c


On Monday 02 February 2009 20:05:06 Tony Lindgren wrote:
> Hi,
>
> * Jean Pihet <jpihet@mvista.com> [090202 00:46]:
> > Tony,
> >
> > Has this patch been applied to the linux-omap tree? Does it need to go
> > the patchwork?
> >
> > Cf. http://marc.info/?l=linux-omap&m=123141577308177&w=2
>
> I'm not applying MMC patches, we need to move that discussion to LKML
> and keep Pierre involved.
>
> Jarkko Lavinen was planning to set up a git branch against the mainline
> tree for the omap mmc patches, so until we have that, let's just let the
> patches float on the list for a while.
>
> But yeah, if you want patchwork to pick up your patch so it does not
> get lost, just please resend it to the linux-omap list and it should
> get automatically picked up by patchwork.
>
> Regards,
>
> Tony



[-- Attachment #2: OMAP-MMC-recover-from-transfer-failures.patch --]
[-- Type: text/x-diff, Size: 1546 bytes --]

From d143f6b2e705aa4e9d2b032097fd1c82f8163262 Mon Sep 17 00:00:00 2001
From: Jean Pihet <jpihet@mvista.com>
Date: Thu, 8 Jan 2009 12:35:21 +0100
Subject: [PATCH] OMAP: MMC: recover from transfer failures

Timeouts during a command that has a data phase can result in the
next command issued after the command that failed not being processed,
i.e. no interrupt ever occurs to indicate the command has completed.
This failure can result in a deadlock.

This patch resets the data state machine to clear the error in
case of a command timeout.

Tested on OMAP3430 chip and intensive MMC/SD device removal while
transferring data.

Signed-off-by: Andy Lowe <alowe@mvista.com>
Signed-off-by: Jean Pihet <jpihet@mvista.com>
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
 drivers/mmc/host/omap_hsmmc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d5c1e9d..97150c0 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -464,8 +464,15 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
 				}
 				end_cmd = 1;
 			}
-			if (host->data)
+			if (host->data) {
 				mmc_dma_cleanup(host);
+				OMAP_HSMMC_WRITE(host->base, SYSCTL,
+					OMAP_HSMMC_READ(host->base,
+							SYSCTL) | SRD);
+				while (OMAP_HSMMC_READ(host->base,
+						SYSCTL) & SRD)
+					;
+			}
 		}
 		if ((status & DATA_TIMEOUT) ||
 			(status & DATA_CRC)) {
-- 
1.5.4.4.21.gc4a6c


  parent reply	other threads:[~2009-02-03 14:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-07 21:45 [PATCH 0/5] Omap MMC init updates and new controller for 2.6.29 merge window Tony Lindgren
2008-12-07 21:46 ` [PATCH 1/5] omap mmc: Remove broken MMC init code Tony Lindgren
2008-12-07 21:47 ` [PATCH 2/5] omap mmc: Add better MMC low-level init Tony Lindgren
2008-12-07 21:49 ` [PATCH 3/5] omap mmc: Add low-level initialization for hsmmc controller Tony Lindgren
2008-12-07 21:50 ` [PATCH 4/5] omap mmc: force MMC module reset on boot Tony Lindgren
2008-12-07 21:51 ` [PATCH 5/5] omap mmc: Add new omap hsmmc controller for 2430 and 34xx Tony Lindgren
2008-12-21 16:17   ` Pierre Ossman
2008-12-29 16:55     ` Tony Lindgren
2008-12-30  8:36       ` Tony Lindgren
2008-12-31 17:59         ` Pierre Ossman
2009-01-07 10:18           ` Tony Lindgren
2009-01-07 10:28             ` [PATCH] OMAP: MMC: recover from transfer failures (was: Re: [PATCH 5/5] omap mmc: Add new omap hsmmc controller for 2430 and 34xx) Jean Pihet
2009-01-07 15:40               ` Tony Lindgren
2009-01-08  9:02               ` [PATCH] OMAP: MMC: recover from transfer failures Adrian Hunter
2009-01-08 11:49                 ` Jean Pihet
2009-01-08 12:17                   ` Adrian Hunter
2008-12-15 22:26 ` git pull request for omap mmc init changes (Re: [PATCH 0/5] Omap MMC init updates and new controller for 2.6.29 merge window) Tony Lindgren
     [not found] ` <200902020946.16508.jpihet@mvista.com>
     [not found]   ` <20090202190503.GT7215@atomide.com>
2009-02-03 14:05     ` Jean Pihet [this message]
2009-02-05 20:10       ` [PATCH] OMAP: MMC: recover from transfer failures - Resend Andrew Morton
2009-02-05 20:32         ` Paul Walmsley
2009-02-06 13:22           ` Jean Pihet
2009-02-06 13:53             ` Pierre Ossman
2009-02-06 15:53               ` [PATCH] OMAP: MMC: replace infinite loops with timeouts (was Re: [PATCH] OMAP: MMC: recover from transfer failures - Resend) Jean Pihet
2009-02-09 15:58                 ` Adrian Hunter
2009-02-11  9:41                   ` Jean Pihet
2009-02-09 17:58               ` [PATCH] OMAP: MMC: recover from transfer failures - Resend Jarkko Lavinen
2009-02-09 18:46                 ` Tony Lindgren
2009-02-10  0:09             ` Paul Walmsley
2009-02-08 20:27           ` David Brownell

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=200902031505.58697.jpihet@mvista.com \
    --to=jpihet@mvista.com \
    --cc=drzeus-mmc@drzeus.cx \
    --cc=ext-adrian.hunter@nokia.com \
    --cc=jarkko.lavinen@nokia.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /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;
as well as URLs for NNTP newsgroup(s).