public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-esdhc-imx: Fix SDIO interrupts
@ 2013-04-15 15:08 Martin Fuzzey
  2013-05-26 17:12 ` Chris Ball
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Fuzzey @ 2013-04-15 15:08 UTC (permalink / raw)
  To: Sascha Hauer, Chris Ball, linux-mmc

Currently SDIO interrupts do not work on i.MX53 and maybe others.

This was observed with a Marvell 8787 based SDIO wifi adapter
using the mwifiex driver and firmware from the Marvell git
repository.
The symptom was a timeout after firmware download.

Observing the SDIO_DAT1 line showed that an interrupt was requested
(level 0) but no interrupt was generated in software, the line
stayed low until a timeout ocurred and the card was reset.

There is a Freescale errata
	ENGcm11186 "eSDHC misses SDIO interrupt when CINT is disabled"

The workaround suggested by this errata is already implemented and
involves clearing and then setting the D3CD bit in the host control
register [see esdhc_writel_le()]

However, when esdhc_writeb_le() is later used to write to
SDHCI_HOST_CONTROL it always resets the D3CD bit.

To fix this simply add the D3CD bit to the set of bits
not modified by esdhc_writeb_le().

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 78ac002..3c4c63d 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -324,8 +324,10 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
 		/*
 		 * Do not touch buswidth bits here. This is done in
 		 * esdhc_pltfm_bus_width.
+		 * Do not touch the D3CD bit either which is used for the
+		 * SDIO interrupt errata workaround.
 		 */
-		mask = 0xffff & ~ESDHC_CTRL_BUSWIDTH_MASK;
+		mask = 0xffff & ~(ESDHC_CTRL_BUSWIDTH_MASK | ESDHC_CTRL_D3CD);
 
 		esdhc_clrset_le(host, mask, new_val, reg);
 		return;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: sdhci-esdhc-imx: Fix SDIO interrupts
  2013-04-15 15:08 [PATCH] mmc: sdhci-esdhc-imx: Fix SDIO interrupts Martin Fuzzey
@ 2013-05-26 17:12 ` Chris Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2013-05-26 17:12 UTC (permalink / raw)
  To: Martin Fuzzey; +Cc: Sascha Hauer, linux-mmc

Hi Martin,

On Mon, Apr 15 2013, Martin Fuzzey wrote:
> Currently SDIO interrupts do not work on i.MX53 and maybe others.
>
> This was observed with a Marvell 8787 based SDIO wifi adapter
> using the mwifiex driver and firmware from the Marvell git
> repository.
> The symptom was a timeout after firmware download.
>
> Observing the SDIO_DAT1 line showed that an interrupt was requested
> (level 0) but no interrupt was generated in software, the line
> stayed low until a timeout ocurred and the card was reset.
>
> There is a Freescale errata
> 	ENGcm11186 "eSDHC misses SDIO interrupt when CINT is disabled"
>
> The workaround suggested by this errata is already implemented and
> involves clearing and then setting the D3CD bit in the host control
> register [see esdhc_writel_le()]
>
> However, when esdhc_writeb_le() is later used to write to
> SDHCI_HOST_CONTROL it always resets the D3CD bit.
>
> To fix this simply add the D3CD bit to the set of bits
> not modified by esdhc_writeb_le().
>
> Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 78ac002..3c4c63d 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -324,8 +324,10 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
>  		/*
>  		 * Do not touch buswidth bits here. This is done in
>  		 * esdhc_pltfm_bus_width.
> +		 * Do not touch the D3CD bit either which is used for the
> +		 * SDIO interrupt errata workaround.
>  		 */
> -		mask = 0xffff & ~ESDHC_CTRL_BUSWIDTH_MASK;
> +		mask = 0xffff & ~(ESDHC_CTRL_BUSWIDTH_MASK | ESDHC_CTRL_D3CD);
>  
>  		esdhc_clrset_le(host, mask, new_val, reg);
>  		return;

I didn't see any review comments from other -imx developers -- I've
applied this to mmc-next now, hopefully someone will yell if there's
any reason not to.

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-26 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15 15:08 [PATCH] mmc: sdhci-esdhc-imx: Fix SDIO interrupts Martin Fuzzey
2013-05-26 17:12 ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox