public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Pignat <marc.pignat@hevs.ch>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: Rob Emanuele <rob@emanuele.us>,
	nicolas.ferre@atmel.com, haavard.skinnemoen@atmel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] atmel-mci: Optional controller reset before every command
Date: Wed, 17 Jun 2009 10:32:22 +0200	[thread overview]
Message-ID: <200906171032.23285.marc.pignat@hevs.ch> (raw)
In-Reply-To: <1245200079-6323-3-git-send-email-rob@emanuele.us>

Hi!

On Wednesday 17 June 2009 02:54:36 Rob Emanuele wrote:
> This patch adds the compile time configuration option for the atmel-mci driver to reset the Atmel MCI controller before every command.
> 
> This is sometimes needed for the Atmel controller / board to function properly.
> 
> Signed-off-by: Rob Emanuele <rob@emanuele.us>
> ---
>  drivers/mmc/host/Kconfig     |   10 ++++++++++
>  drivers/mmc/host/atmel-mci.c |   11 ++++++++++-
>  2 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index a0eaf69..5875125 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -161,6 +161,16 @@ config MMC_ATMELMCI
>  
>  endchoice
>  
> +config MMC_ATMELMCI_ALWAYS_RESET
> +	bool "Reset before every request.  Sometimes needed for buggy chips."
> +	depends on MMC_ATMELMCI
> +	help
> +	  There are reports that some buggy controllers work better
> +	  with a reset before every command.  This may improve your
> +	  controller's reliability.
> +
> +	  If unsure, say N.
> +
>  config MMC_ATMELMCI_DMA
>  	bool "Atmel MCI DMA support (EXPERIMENTAL)"
>  	depends on MMC_ATMELMCI && AVR32 && DMA_ENGINE && EXPERIMENTAL
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 98b25de..e5894f6 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -63,6 +63,15 @@ struct atmel_mci_dma {
>  #endif
>  };
>  
> +/*
> + * Configuration options from the kernel config
> + */
> +#ifdef CONFIG_MMC_ATMELMCI_ALWAYS_RESET
> +#define MMC_ALWAYS_RESET 1
> +#else
> +#define MMC_ALWAYS_RESET 0
> +#endif

Some chips are known to hang after (some) transfer. There is no need for this
configuration option, I think we should just do : 

#define MMC_ALWAYS_RESET (cpu_is_at91rm9200() || add_your_cpu_name_here())

> +
>  /**
>   * struct atmel_mci - MMC controller state shared between all slots
>   * @lock: Spinlock protecting the queue and associated data.
> @@ -720,7 +729,7 @@ static void atmci_start_request(struct atmel_mci *host,
>  	host->completed_events = 0;
>  	host->data_status = 0;
>  
> -	if (host->need_reset) {
> +	if (host->need_reset || MMC_ALWAYS_RESET) {
>  		mci_writel(host, CR, MCI_CR_SWRST);
>  		mci_writel(host, CR, MCI_CR_MCIEN);
>  		mci_writel(host, MR, host->mode_reg);

Another option is to always reset the controller.

The reset operation won't hurt, it is simple and fast, and the code will be
simpler and better tested.

Best regards

Marc

  reply	other threads:[~2009-06-17  8:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17  0:54 [PATCH 1/6] atmel-mci: Unified Atmel MCI drivers (AVR32 & AT91) Rob Emanuele
2009-06-17  0:54 ` [PATCH 2/6] atmel-mci: Platform configuration to the the atmel-mci driver Rob Emanuele
2009-06-17 10:27   ` Nicolas Ferre
2009-06-18 19:58   ` Andrew Victor
2009-06-18 20:00     ` Andrew Victor
2009-06-17  0:54 ` [PATCH 3/6] atmel-mci: Optional controller reset before every command Rob Emanuele
2009-06-17  8:32   ` Marc Pignat [this message]
2009-06-17 18:27     ` Robert Emanuele
2009-06-17  0:54 ` [PATCH 4/6] atmel-mci: CLKDIV cap to restrict the MCI controller speed Rob Emanuele
2009-06-17  0:54 ` [PATCH 5/6] atmel-mci: Power control option for each MMC Slot Rob Emanuele
2009-06-17  8:08   ` Marc Pignat
2009-06-17  0:54 ` [PATCH 6/6] atmel-mci: Platform driver MMC slot power control Rob Emanuele
2009-06-17  1:23   ` Ryan Mallon
2009-06-17  9:56 ` [PATCH 1/6] atmel-mci: Unified Atmel MCI drivers (AVR32 & AT91) Nicolas Ferre
2009-06-17 10:08   ` Haavard Skinnemoen
2009-06-23 16:28     ` Nicolas Ferre
     [not found] ` <95818a17c2b96d3769f4e1d3de26208647111758.1245778411.git.nicolas.ferre@atmel.com>
2009-06-23 17:39   ` [PATCH 1/2] " Nicolas Ferre
2009-09-02  7:31     ` Haavard Skinnemoen
     [not found]   ` <f8889fb59887a970581697beb313363a6a065606.1245778411.git.nicolas.ferre@atmel.com>
2009-06-23 17:39     ` [PATCH 2/2] AT91: atmel-mci: Platform configuration to the the atmel-mci driver Nicolas Ferre
2009-06-23 21:36     ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-26 19:26       ` Robert Emanuele

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=200906171032.23285.marc.pignat@hevs.ch \
    --to=marc.pignat@hevs.ch \
    --cc=haavard.skinnemoen@atmel.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=rob@emanuele.us \
    /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