public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Jean Pihet <jpihet@mvista.com>
Cc: linux-arm-kernel@lists.arm.linux.org.uk,
	Pierre Ossman <drzeus-mmc@drzeus.cx>,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	Madhusudhan Chikkature <madhu.cr@ti.com>,
	David Brownell <david-b@pacbell.net>,
	"Jarkko Lavinen (NMP/Helsinki)" <jarkko.lavinen@nokia.com>
Subject: Re: [PATCH] OMAP: MMC: recover from transfer failures (was: Re: [PATCH 5/5] omap mmc: Add new omap hsmmc controller for 2430 and 34xx)
Date: Wed, 7 Jan 2009 17:40:14 +0200	[thread overview]
Message-ID: <20090107154013.GR27566@atomide.com> (raw)
In-Reply-To: <200901071128.43937.jpihet@mvista.com>

Hi,

* Jean Pihet <jpihet@mvista.com> [090107 12:28]:
> Tony, Pierre,
> 
> Here is a 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.
> 
> What do you think?

Looks OK to me, adding Jarkko to Cc.

Tony

> Regards,
> Jean.
> 
>     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.
> 
>     The indication that the mmc host controller is in this error state is
>     that the DATI bit is set in the PSTATE register.  This patch checks
>     to see if the DATI bit is set before starting a new command, and if it
>     is set it resets the data state machine to clear the error.
> 
>     Tested on OMAP3430 chip and intensive MMC/SD device removal while
>     transferring data.
> 
> Regards,
> Jean
> 
> 
> From 48a40925a4d57f6e7e45809a4b5c09b20f9314d7 Mon Sep 17 00:00:00 2001
> From: Jean Pihet <jpihet@mvista.com>
> Date: Tue, 16 Dec 2008 19:44:12 +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.
> 
> The indication that the mmc host controller is in this error state is
> that the DATI bit is set in the PSTATE register.  This patch checks
> to see if the DATI bit is set before starting a new command, and if it
> is set it resets the data state machine to clear the error.
> 
> 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>
> ---
>  drivers/mmc/host/omap_hsmmc.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 1fcc544..b7d111e 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -44,6 +44,7 @@
>  #define OMAP_HSMMC_RSP54       0x0118
>  #define OMAP_HSMMC_RSP76       0x011C
>  #define OMAP_HSMMC_DATA                0x0120
> +#define OMAP_HSMMC_PSTATE      0x0124
>  #define OMAP_HSMMC_HCTL                0x0128
>  #define OMAP_HSMMC_SYSCTL      0x012C
>  #define OMAP_HSMMC_STAT                0x0130
> @@ -89,6 +90,7 @@
>  #define DUAL_VOLT_OCR_BIT      7
>  #define SRC                    (1 << 25)
>  #define SRD                    (1 << 26)
> +#define DATI                   (1 << 1)
>  
>  /*
>   * FIXME: Most likely all the data using these _DEVID defines should come
> @@ -273,6 +275,15 @@ mmc_omap_start_command(struct mmc_omap_host *host, struct 
> mmc_command *cmd,
>                 mmc_hostname(host->mmc), cmd->opcode, cmd->arg);
>         host->cmd = cmd;
>  
> +       if (OMAP_HSMMC_READ(host->base, PSTATE) & DATI) {
> +               dev_dbg(mmc_dev(host->mmc), "mmc_omap_start_command: "
> +                       " resetting data state machine\n");
> +               OMAP_HSMMC_WRITE(host->base, SYSCTL,
> +                       OMAP_HSMMC_READ(host->base, SYSCTL) | SRD);
> +               while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD)
> +                       ;
> +       }
> +
>         /*
>          * Clear status bits and enable interrupts
>          */
> -- 
> 1.5.4.4.21.gc4a6c
> 
> 
> On Wednesday 07 January 2009 11:18:13 Tony Lindgren wrote:
> > * Pierre Ossman <drzeus-mmc@drzeus.cx> [081231 19:59]:
> > > On Tue, 30 Dec 2008 10:36:26 +0200
> > >
> > > Tony Lindgren <tony@atomide.com> wrote:
> > > > Here's one more version that leaves out the unnecessary TWL4030
> > > > dependency in the Kconfig as pointed out by David Brownell.
> > >
> > > Looks ok.
> > >
> > > Acked-by: Pierre Ossman <drzeus@drzeus.cx>
> >
> > Thanks, I'll queue it up with Russell with one change
> > to include <mach/dma.h> instead of <asm/dma.h>.
> >
> > All further patches to this driver will come to you via
> > LKML.
> >
> > Regards,
> >
> > Tony
> >
> > > --
> > >      -- Pierre Ossman
> > >
> > >   Linux kernel, MMC maintainer        http://www.kernel.org
> > >   rdesktop, core developer          http://www.rdesktop.org
> > >
> > >   WARNING: This correspondence is being monitored by the
> > >   Swedish government. Make sure your server uses encryption
> > >   for SMTP traffic and consider using PGP for end-to-end
> > >   encryption.
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> > > in the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > > Please read the FAQ at  http://www.tux.org/lkml/
> >
> > -------------------------------------------------------------------
> > List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
> > FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
> > Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
> 
> 

> From 48a40925a4d57f6e7e45809a4b5c09b20f9314d7 Mon Sep 17 00:00:00 2001
> From: Jean Pihet <jpihet@mvista.com>
> Date: Tue, 16 Dec 2008 19:44:12 +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.
> 
> The indication that the mmc host controller is in this error state is
> that the DATI bit is set in the PSTATE register.  This patch checks
> to see if the DATI bit is set before starting a new command, and if it
> is set it resets the data state machine to clear the error.
> 
> 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>
> ---
>  drivers/mmc/host/omap_hsmmc.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 1fcc544..b7d111e 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -44,6 +44,7 @@
>  #define OMAP_HSMMC_RSP54	0x0118
>  #define OMAP_HSMMC_RSP76	0x011C
>  #define OMAP_HSMMC_DATA		0x0120
> +#define OMAP_HSMMC_PSTATE	0x0124
>  #define OMAP_HSMMC_HCTL		0x0128
>  #define OMAP_HSMMC_SYSCTL	0x012C
>  #define OMAP_HSMMC_STAT		0x0130
> @@ -89,6 +90,7 @@
>  #define DUAL_VOLT_OCR_BIT	7
>  #define SRC			(1 << 25)
>  #define SRD			(1 << 26)
> +#define DATI			(1 << 1)
>  
>  /*
>   * FIXME: Most likely all the data using these _DEVID defines should come
> @@ -273,6 +275,15 @@ mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd,
>  		mmc_hostname(host->mmc), cmd->opcode, cmd->arg);
>  	host->cmd = cmd;
>  
> +	if (OMAP_HSMMC_READ(host->base, PSTATE) & DATI) {
> +		dev_dbg(mmc_dev(host->mmc), "mmc_omap_start_command: "
> +			" resetting data state machine\n");
> +		OMAP_HSMMC_WRITE(host->base, SYSCTL,
> +			OMAP_HSMMC_READ(host->base, SYSCTL) | SRD);
> +		while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD)
> +			;
> +	}
> +
>  	/*
>  	 * Clear status bits and enable interrupts
>  	 */
> -- 
> 1.5.4.4.21.gc4a6c
> 


  reply	other threads:[~2009-01-07 15:40 UTC|newest]

Thread overview: 37+ 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
2009-01-10 22:49   ` Ladislav Michl
2009-01-10 23:00     ` Ladislav Michl
2009-01-13 13:43       ` Tony Lindgren
2009-03-23 17:47         ` Ladislav Michl
2009-03-24 20:04           ` [APPLIED] " Tony Lindgren
2009-01-10 23:03   ` Ladislav Michl
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 [this message]
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
2009-02-02  8:46                   ` Jean Pihet
2009-02-02 19:05                     ` Tony Lindgren
2009-02-03 14:05                       ` [PATCH] OMAP: MMC: recover from transfer failures - Resend Jean Pihet
2009-02-05 20:10                         ` 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
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

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=20090107154013.GR27566@atomide.com \
    --to=tony@atomide.com \
    --cc=david-b@pacbell.net \
    --cc=drzeus-mmc@drzeus.cx \
    --cc=jarkko.lavinen@nokia.com \
    --cc=jpihet@mvista.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=madhu.cr@ti.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