All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
@ 2011-07-18  5:20 ` Tony Lin
  0 siblings, 0 replies; 10+ messages in thread
From: Tony Lin @ 2011-07-18  5:20 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-arm-kernel, cjb

apply workaround for imx eSDHC controller to avoid
missing card interrupt so that SDIO function is workable

Signed-off-by: Tony Lin <tony.lin@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index a19967d..da77cae 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -32,6 +32,8 @@
 #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
 
 #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
+
+#define	SDHCI_CTRL_D3CD			0x08
 /*
  * The CMDTYPE of the CMD register (offset 0xE) should be set to
  * "11" when the STOP CMD12 is issued on imx53 to abort one
@@ -87,14 +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct pltfm_imx_data *imx_data = pltfm_host->priv;
-
-	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
-			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
-		/*
-		 * these interrupts won't work with a custom card_detect gpio
-		 * (only applied to mx25/35)
-		 */
-		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
+	u32 data;
+
+	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE))) {
+		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
+			/*
+			 * these interrupts won't work with a custom
+			 * card_detect gpio (only applied to mx25/35)
+			 */
+			val &= ~(SDHCI_INT_CARD_REMOVE | \
+				SDHCI_INT_CARD_INSERT);
+
+		if (val & SDHCI_INT_CARD_INT) {
+			/*
+			 * clear D3CD bit and set D3CD bit to avoid
+			 * missing card interrupt
+			 * this is a eSDHC controller problem so that
+			 * we need to apply following workaround
+			 */
+			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
+			data &= ~SDHCI_CTRL_D3CD;
+			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
+			data |= SDHCI_CTRL_D3CD;
+			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
+		}
+	}
 
 	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
 				&& (reg == SDHCI_INT_STATUS)
@@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
 		return;
 	case SDHCI_HOST_CONTROL:
 		/* FSL messed up here, so we can just keep those two */
-		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
+		new_val = val & (SDHCI_CTRL_LED | \
+				SDHCI_CTRL_4BITBUS | \
+				SDHCI_CTRL_D3CD);
 		/* ensure the endianess */
 		new_val |= ESDHC_HOST_CONTROL_LE;
 		/* DMA mode bits are shifted */
-- 
1.7.0.4



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

* [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
@ 2011-07-18  5:20 ` Tony Lin
  0 siblings, 0 replies; 10+ messages in thread
From: Tony Lin @ 2011-07-18  5:20 UTC (permalink / raw)
  To: linux-arm-kernel

apply workaround for imx eSDHC controller to avoid
missing card interrupt so that SDIO function is workable

Signed-off-by: Tony Lin <tony.lin@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index a19967d..da77cae 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -32,6 +32,8 @@
 #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
 
 #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
+
+#define	SDHCI_CTRL_D3CD			0x08
 /*
  * The CMDTYPE of the CMD register (offset 0xE) should be set to
  * "11" when the STOP CMD12 is issued on imx53 to abort one
@@ -87,14 +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct pltfm_imx_data *imx_data = pltfm_host->priv;
-
-	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
-			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
-		/*
-		 * these interrupts won't work with a custom card_detect gpio
-		 * (only applied to mx25/35)
-		 */
-		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
+	u32 data;
+
+	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE))) {
+		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
+			/*
+			 * these interrupts won't work with a custom
+			 * card_detect gpio (only applied to mx25/35)
+			 */
+			val &= ~(SDHCI_INT_CARD_REMOVE | \
+				SDHCI_INT_CARD_INSERT);
+
+		if (val & SDHCI_INT_CARD_INT) {
+			/*
+			 * clear D3CD bit and set D3CD bit to avoid
+			 * missing card interrupt
+			 * this is a eSDHC controller problem so that
+			 * we need to apply following workaround
+			 */
+			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
+			data &= ~SDHCI_CTRL_D3CD;
+			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
+			data |= SDHCI_CTRL_D3CD;
+			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
+		}
+	}
 
 	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
 				&& (reg == SDHCI_INT_STATUS)
@@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
 		return;
 	case SDHCI_HOST_CONTROL:
 		/* FSL messed up here, so we can just keep those two */
-		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
+		new_val = val & (SDHCI_CTRL_LED | \
+				SDHCI_CTRL_4BITBUS | \
+				SDHCI_CTRL_D3CD);
 		/* ensure the endianess */
 		new_val |= ESDHC_HOST_CONTROL_LE;
 		/* DMA mode bits are shifted */
-- 
1.7.0.4

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

* RE: [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
  2011-07-18  5:20 ` Tony Lin
@ 2011-07-27  6:38   ` Lin Tony-B19295
  -1 siblings, 0 replies; 10+ messages in thread
From: Lin Tony-B19295 @ 2011-07-27  6:38 UTC (permalink / raw)
  To: Lin Tony-B19295, linux-mmc; +Cc: cjb, linux-arm-kernel

Does anybody have any comment?
Anybody tried this patch?

BR
Tony

> -----Original Message-----
> From: linux-arm-kernel-bounces@lists.infradead.org [mailto:linux-arm-
> kernel-bounces@lists.infradead.org] On Behalf Of Tony Lin
> Sent: Monday, July 18, 2011 1:20 PM
> To: linux-mmc@vger.kernel.org
> Cc: cjb@laptop.org; linux-arm-kernel@lists.infradead.org
> Subject: [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
> 
> apply workaround for imx eSDHC controller to avoid missing card interrupt
> so that SDIO function is workable
> 
> Signed-off-by: Tony Lin <tony.lin@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++---
> -----
>  1 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-
> esdhc-imx.c
> index a19967d..da77cae 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -32,6 +32,8 @@
>  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
> 
>  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
> +
> +#define	SDHCI_CTRL_D3CD			0x08
>  /*
>   * The CMDTYPE of the CMD register (offset 0xE) should be set to
>   * "11" when the STOP CMD12 is issued on imx53 to abort one @@ -87,14
> +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val,
> int reg)  {
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
> -
> -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
> -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
> -		/*
> -		 * these interrupts won't work with a custom card_detect gpio
> -		 * (only applied to mx25/35)
> -		 */
> -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
> +	u32 data;
> +
> +	if (unlikely((reg == SDHCI_INT_ENABLE || reg ==
> SDHCI_SIGNAL_ENABLE))) {
> +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
> +			/*
> +			 * these interrupts won't work with a custom
> +			 * card_detect gpio (only applied to mx25/35)
> +			 */
> +			val &= ~(SDHCI_INT_CARD_REMOVE | \
> +				SDHCI_INT_CARD_INSERT);
> +
> +		if (val & SDHCI_INT_CARD_INT) {
> +			/*
> +			 * clear D3CD bit and set D3CD bit to avoid
> +			 * missing card interrupt
> +			 * this is a eSDHC controller problem so that
> +			 * we need to apply following workaround
> +			 */
> +			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
> +			data &= ~SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> +			data |= SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> +		}
> +	}
> 
>  	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
>  				&& (reg == SDHCI_INT_STATUS)
> @@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host,
> u8 val, int reg)
>  		return;
>  	case SDHCI_HOST_CONTROL:
>  		/* FSL messed up here, so we can just keep those two */
> -		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
> +		new_val = val & (SDHCI_CTRL_LED | \
> +				SDHCI_CTRL_4BITBUS | \
> +				SDHCI_CTRL_D3CD);
>  		/* ensure the endianess */
>  		new_val |= ESDHC_HOST_CONTROL_LE;
>  		/* DMA mode bits are shifted */
> --
> 1.7.0.4
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



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

* [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
@ 2011-07-27  6:38   ` Lin Tony-B19295
  0 siblings, 0 replies; 10+ messages in thread
From: Lin Tony-B19295 @ 2011-07-27  6:38 UTC (permalink / raw)
  To: linux-arm-kernel

Does anybody have any comment?
Anybody tried this patch?

BR
Tony

> -----Original Message-----
> From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-
> kernel-bounces at lists.infradead.org] On Behalf Of Tony Lin
> Sent: Monday, July 18, 2011 1:20 PM
> To: linux-mmc at vger.kernel.org
> Cc: cjb at laptop.org; linux-arm-kernel at lists.infradead.org
> Subject: [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
> 
> apply workaround for imx eSDHC controller to avoid missing card interrupt
> so that SDIO function is workable
> 
> Signed-off-by: Tony Lin <tony.lin@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++---
> -----
>  1 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-
> esdhc-imx.c
> index a19967d..da77cae 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -32,6 +32,8 @@
>  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
> 
>  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
> +
> +#define	SDHCI_CTRL_D3CD			0x08
>  /*
>   * The CMDTYPE of the CMD register (offset 0xE) should be set to
>   * "11" when the STOP CMD12 is issued on imx53 to abort one @@ -87,14
> +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val,
> int reg)  {
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
> -
> -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
> -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
> -		/*
> -		 * these interrupts won't work with a custom card_detect gpio
> -		 * (only applied to mx25/35)
> -		 */
> -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
> +	u32 data;
> +
> +	if (unlikely((reg == SDHCI_INT_ENABLE || reg ==
> SDHCI_SIGNAL_ENABLE))) {
> +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
> +			/*
> +			 * these interrupts won't work with a custom
> +			 * card_detect gpio (only applied to mx25/35)
> +			 */
> +			val &= ~(SDHCI_INT_CARD_REMOVE | \
> +				SDHCI_INT_CARD_INSERT);
> +
> +		if (val & SDHCI_INT_CARD_INT) {
> +			/*
> +			 * clear D3CD bit and set D3CD bit to avoid
> +			 * missing card interrupt
> +			 * this is a eSDHC controller problem so that
> +			 * we need to apply following workaround
> +			 */
> +			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
> +			data &= ~SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> +			data |= SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> +		}
> +	}
> 
>  	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
>  				&& (reg == SDHCI_INT_STATUS)
> @@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host,
> u8 val, int reg)
>  		return;
>  	case SDHCI_HOST_CONTROL:
>  		/* FSL messed up here, so we can just keep those two */
> -		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
> +		new_val = val & (SDHCI_CTRL_LED | \
> +				SDHCI_CTRL_4BITBUS | \
> +				SDHCI_CTRL_D3CD);
>  		/* ensure the endianess */
>  		new_val |= ESDHC_HOST_CONTROL_LE;
>  		/* DMA mode bits are shifted */
> --
> 1.7.0.4
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
  2011-07-18  5:20 ` Tony Lin
@ 2011-07-27  7:47   ` Uwe Kleine-König
  -1 siblings, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2011-07-27  7:47 UTC (permalink / raw)
  To: Tony Lin; +Cc: linux-mmc, cjb, linux-arm-kernel, kernel

Hello Tony,

On Mon, Jul 18, 2011 at 01:20:02PM +0800, Tony Lin wrote:
> apply workaround for imx eSDHC controller to avoid
> missing card interrupt so that SDIO function is workable
Fixing a few typos (but note, I'm not a native speaker):

	mmc/sdhci-esdhc-imx: fix losing card interrupt

	Apply workaround for the imx eSDHC controller to avoid missing a
	card interrupt.

	Signed-off-by: ...

> Signed-off-by: Tony Lin <tony.lin@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++--------
>  1 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index a19967d..da77cae 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -32,6 +32,8 @@
>  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
>  
>  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
> +
> +#define	SDHCI_CTRL_D3CD			0x08
>  /*
>   * The CMDTYPE of the CMD register (offset 0xE) should be set to
>   * "11" when the STOP CMD12 is issued on imx53 to abort one
> @@ -87,14 +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
>  {
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
> -
> -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
> -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
> -		/*
> -		 * these interrupts won't work with a custom card_detect gpio
> -		 * (only applied to mx25/35)
> -		 */
> -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
> +	u32 data;
> +
> +	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE))) {
> +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
> +			/*
> +			 * these interrupts won't work with a custom
> +			 * card_detect gpio (only applied to mx25/35)
hmm, ok, this was here before, but I wonder about the "only applied to
mx25/35" part. How is that meant? I don't see logic to prevent other
socs using this workaround.

> +			 */
> +			val &= ~(SDHCI_INT_CARD_REMOVE | \
> +				SDHCI_INT_CARD_INSERT);
> +
> +		if (val & SDHCI_INT_CARD_INT) {
> +			/*
> +			 * clear D3CD bit and set D3CD bit to avoid
> +			 * missing card interrupt
> +			 * this is a eSDHC controller problem so that
> +			 * we need to apply following workaround
s/following/this/ ? If not, according to my (non-native) English you
need to add a "the" before "following".

> +			 */
> +			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
> +			data &= ~SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> +			data |= SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
Is there some Documentation about this problem? If yes, maybe add a link
to it? Alternatively describe the problem more exact in a comment
please.

> +		}
> +	}
>  
>  	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
>  				&& (reg == SDHCI_INT_STATUS)
> @@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
>  		return;
>  	case SDHCI_HOST_CONTROL:
>  		/* FSL messed up here, so we can just keep those two */
> -		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
> +		new_val = val & (SDHCI_CTRL_LED | \
> +				SDHCI_CTRL_4BITBUS | \
> +				SDHCI_CTRL_D3CD);
This makes the comment wrong---now there are three bits that can be
preserved.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
@ 2011-07-27  7:47   ` Uwe Kleine-König
  0 siblings, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2011-07-27  7:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Tony,

On Mon, Jul 18, 2011 at 01:20:02PM +0800, Tony Lin wrote:
> apply workaround for imx eSDHC controller to avoid
> missing card interrupt so that SDIO function is workable
Fixing a few typos (but note, I'm not a native speaker):

	mmc/sdhci-esdhc-imx: fix losing card interrupt

	Apply workaround for the imx eSDHC controller to avoid missing a
	card interrupt.

	Signed-off-by: ...

> Signed-off-by: Tony Lin <tony.lin@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++--------
>  1 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index a19967d..da77cae 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -32,6 +32,8 @@
>  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
>  
>  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
> +
> +#define	SDHCI_CTRL_D3CD			0x08
>  /*
>   * The CMDTYPE of the CMD register (offset 0xE) should be set to
>   * "11" when the STOP CMD12 is issued on imx53 to abort one
> @@ -87,14 +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
>  {
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
> -
> -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
> -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
> -		/*
> -		 * these interrupts won't work with a custom card_detect gpio
> -		 * (only applied to mx25/35)
> -		 */
> -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
> +	u32 data;
> +
> +	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE))) {
> +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
> +			/*
> +			 * these interrupts won't work with a custom
> +			 * card_detect gpio (only applied to mx25/35)
hmm, ok, this was here before, but I wonder about the "only applied to
mx25/35" part. How is that meant? I don't see logic to prevent other
socs using this workaround.

> +			 */
> +			val &= ~(SDHCI_INT_CARD_REMOVE | \
> +				SDHCI_INT_CARD_INSERT);
> +
> +		if (val & SDHCI_INT_CARD_INT) {
> +			/*
> +			 * clear D3CD bit and set D3CD bit to avoid
> +			 * missing card interrupt
> +			 * this is a eSDHC controller problem so that
> +			 * we need to apply following workaround
s/following/this/ ? If not, according to my (non-native) English you
need to add a "the" before "following".

> +			 */
> +			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
> +			data &= ~SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> +			data |= SDHCI_CTRL_D3CD;
> +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
Is there some Documentation about this problem? If yes, maybe add a link
to it? Alternatively describe the problem more exact in a comment
please.

> +		}
> +	}
>  
>  	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
>  				&& (reg == SDHCI_INT_STATUS)
> @@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
>  		return;
>  	case SDHCI_HOST_CONTROL:
>  		/* FSL messed up here, so we can just keep those two */
> -		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
> +		new_val = val & (SDHCI_CTRL_LED | \
> +				SDHCI_CTRL_4BITBUS | \
> +				SDHCI_CTRL_D3CD);
This makes the comment wrong---now there are three bits that can be
preserved.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* RE: [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
  2011-07-27  7:47   ` Uwe Kleine-König
@ 2011-07-27  9:27     ` Lin Tony-B19295
  -1 siblings, 0 replies; 10+ messages in thread
From: Lin Tony-B19295 @ 2011-07-27  9:27 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: cjb, linux-mmc, kernel, linux-arm-kernel

> -----Original Message-----
> From: linux-arm-kernel-bounces@lists.infradead.org [mailto:linux-arm-
> kernel-bounces@lists.infradead.org] On Behalf Of Uwe Kleine-K?nig
> Sent: Wednesday, July 27, 2011 3:47 PM
> To: Lin Tony-B19295
> Cc: cjb@laptop.org; linux-mmc@vger.kernel.org; kernel@pengutronix.de;
> linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH 1/1] fix card interrupt losing issue on freescale
> eSDHC
> 
> Hello Tony,
> 
> On Mon, Jul 18, 2011 at 01:20:02PM +0800, Tony Lin wrote:
> > apply workaround for imx eSDHC controller to avoid missing card
> > interrupt so that SDIO function is workable
> Fixing a few typos (but note, I'm not a native speaker):
> 
> 	mmc/sdhci-esdhc-imx: fix losing card interrupt
> 
> 	Apply workaround for the imx eSDHC controller to avoid missing a
> 	card interrupt.
> 
> 	Signed-off-by: ...
> 
> > Signed-off-by: Tony Lin <tony.lin@freescale.com>
> > ---
> >  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++-
> -------
> >  1 files changed, 30 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> > b/drivers/mmc/host/sdhci-esdhc-imx.c
> > index a19967d..da77cae 100644
> > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> > @@ -32,6 +32,8 @@
> >  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
> >
> >  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
> > +
> > +#define	SDHCI_CTRL_D3CD			0x08
> >  /*
> >   * The CMDTYPE of the CMD register (offset 0xE) should be set to
> >   * "11" when the STOP CMD12 is issued on imx53 to abort one @@ -87,14
> > +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32
> > val, int reg)  {
> >  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> >  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
> > -
> > -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
> > -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
> > -		/*
> > -		 * these interrupts won't work with a custom card_detect gpio
> > -		 * (only applied to mx25/35)
> > -		 */
> > -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
> > +	u32 data;
> > +
> > +	if (unlikely((reg == SDHCI_INT_ENABLE || reg ==
> SDHCI_SIGNAL_ENABLE))) {
> > +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
> > +			/*
> > +			 * these interrupts won't work with a custom
> > +			 * card_detect gpio (only applied to mx25/35)
> hmm, ok, this was here before, but I wonder about the "only applied to
> mx25/35" part. How is that meant? I don't see logic to prevent other socs
> using this workaround.
Sorry, not so sure about mx25/35 history. But the flag is set only if it's mx25 or mx35. 
You can check the code in esdhc_pltfm_init.
> 
> > +			 */
> > +			val &= ~(SDHCI_INT_CARD_REMOVE | \
> > +				SDHCI_INT_CARD_INSERT);
> > +
> > +		if (val & SDHCI_INT_CARD_INT) {
> > +			/*
> > +			 * clear D3CD bit and set D3CD bit to avoid
> > +			 * missing card interrupt
> > +			 * this is a eSDHC controller problem so that
> > +			 * we need to apply following workaround
> s/following/this/ ? If not, according to my (non-native) English you need
> to add a "the" before "following".
> 
> > +			 */
> > +			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
> > +			data &= ~SDHCI_CTRL_D3CD;
> > +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> > +			data |= SDHCI_CTRL_D3CD;
> > +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> Is there some Documentation about this problem? If yes, maybe add a link
> to it? Alternatively describe the problem more exact in a comment please.
> 
> > +		}
> > +	}
> >
> >  	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
> >  				&& (reg == SDHCI_INT_STATUS)
> > @@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host,
> u8 val, int reg)
> >  		return;
> >  	case SDHCI_HOST_CONTROL:
> >  		/* FSL messed up here, so we can just keep those two */
> > -		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
> > +		new_val = val & (SDHCI_CTRL_LED | \
> > +				SDHCI_CTRL_4BITBUS | \
> > +				SDHCI_CTRL_D3CD);
> This makes the comment wrong---now there are three bits that can be
> preserved.
> 
Thanks for your comments. Accepted.

> Best regards
> Uwe
> 
> --
> Pengutronix e.K.                           | Uwe Kleine-König
> |
> Industrial Linux Solutions                 | http://www.pengutronix.de/
> |
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



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

* [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
@ 2011-07-27  9:27     ` Lin Tony-B19295
  0 siblings, 0 replies; 10+ messages in thread
From: Lin Tony-B19295 @ 2011-07-27  9:27 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-
> kernel-bounces at lists.infradead.org] On Behalf Of Uwe Kleine-K?nig
> Sent: Wednesday, July 27, 2011 3:47 PM
> To: Lin Tony-B19295
> Cc: cjb at laptop.org; linux-mmc at vger.kernel.org; kernel at pengutronix.de;
> linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH 1/1] fix card interrupt losing issue on freescale
> eSDHC
> 
> Hello Tony,
> 
> On Mon, Jul 18, 2011 at 01:20:02PM +0800, Tony Lin wrote:
> > apply workaround for imx eSDHC controller to avoid missing card
> > interrupt so that SDIO function is workable
> Fixing a few typos (but note, I'm not a native speaker):
> 
> 	mmc/sdhci-esdhc-imx: fix losing card interrupt
> 
> 	Apply workaround for the imx eSDHC controller to avoid missing a
> 	card interrupt.
> 
> 	Signed-off-by: ...
> 
> > Signed-off-by: Tony Lin <tony.lin@freescale.com>
> > ---
> >  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++-
> -------
> >  1 files changed, 30 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> > b/drivers/mmc/host/sdhci-esdhc-imx.c
> > index a19967d..da77cae 100644
> > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> > @@ -32,6 +32,8 @@
> >  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
> >
> >  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
> > +
> > +#define	SDHCI_CTRL_D3CD			0x08
> >  /*
> >   * The CMDTYPE of the CMD register (offset 0xE) should be set to
> >   * "11" when the STOP CMD12 is issued on imx53 to abort one @@ -87,14
> > +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32
> > val, int reg)  {
> >  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> >  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
> > -
> > -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
> > -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
> > -		/*
> > -		 * these interrupts won't work with a custom card_detect gpio
> > -		 * (only applied to mx25/35)
> > -		 */
> > -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
> > +	u32 data;
> > +
> > +	if (unlikely((reg == SDHCI_INT_ENABLE || reg ==
> SDHCI_SIGNAL_ENABLE))) {
> > +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
> > +			/*
> > +			 * these interrupts won't work with a custom
> > +			 * card_detect gpio (only applied to mx25/35)
> hmm, ok, this was here before, but I wonder about the "only applied to
> mx25/35" part. How is that meant? I don't see logic to prevent other socs
> using this workaround.
Sorry, not so sure about mx25/35 history. But the flag is set only if it's mx25 or mx35. 
You can check the code in esdhc_pltfm_init.
> 
> > +			 */
> > +			val &= ~(SDHCI_INT_CARD_REMOVE | \
> > +				SDHCI_INT_CARD_INSERT);
> > +
> > +		if (val & SDHCI_INT_CARD_INT) {
> > +			/*
> > +			 * clear D3CD bit and set D3CD bit to avoid
> > +			 * missing card interrupt
> > +			 * this is a eSDHC controller problem so that
> > +			 * we need to apply following workaround
> s/following/this/ ? If not, according to my (non-native) English you need
> to add a "the" before "following".
> 
> > +			 */
> > +			data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
> > +			data &= ~SDHCI_CTRL_D3CD;
> > +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> > +			data |= SDHCI_CTRL_D3CD;
> > +			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
> Is there some Documentation about this problem? If yes, maybe add a link
> to it? Alternatively describe the problem more exact in a comment please.
> 
> > +		}
> > +	}
> >
> >  	if (unlikely((imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
> >  				&& (reg == SDHCI_INT_STATUS)
> > @@ -165,7 +184,9 @@ static void esdhc_writeb_le(struct sdhci_host *host,
> u8 val, int reg)
> >  		return;
> >  	case SDHCI_HOST_CONTROL:
> >  		/* FSL messed up here, so we can just keep those two */
> > -		new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
> > +		new_val = val & (SDHCI_CTRL_LED | \
> > +				SDHCI_CTRL_4BITBUS | \
> > +				SDHCI_CTRL_D3CD);
> This makes the comment wrong---now there are three bits that can be
> preserved.
> 
Thanks for your comments. Accepted.

> Best regards
> Uwe
> 
> --
> Pengutronix e.K.                           | Uwe Kleine-K?nig
> |
> Industrial Linux Solutions                 | http://www.pengutronix.de/
> |
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
  2011-07-27  9:27     ` Lin Tony-B19295
@ 2011-07-27  9:42       ` Arnaud Patard (Rtp)
  -1 siblings, 0 replies; 10+ messages in thread
From: Arnaud Patard @ 2011-07-27  9:42 UTC (permalink / raw)
  To: Lin Tony-B19295
  Cc: Uwe Kleine-König, cjb, linux-mmc, linux-arm-kernel, kernel

Lin Tony-B19295 <B19295@freescale.com> writes:

Hi,

>> -----Original Message-----
>> From: linux-arm-kernel-bounces@lists.infradead.org [mailto:linux-arm-
>> kernel-bounces@lists.infradead.org] On Behalf Of Uwe Kleine-K?nig
>> Sent: Wednesday, July 27, 2011 3:47 PM
>> To: Lin Tony-B19295
>> Cc: cjb@laptop.org; linux-mmc@vger.kernel.org; kernel@pengutronix.de;
>> linux-arm-kernel@lists.infradead.org
>> Subject: Re: [PATCH 1/1] fix card interrupt losing issue on freescale
>> eSDHC
>> 
>> Hello Tony,
>> 
>> On Mon, Jul 18, 2011 at 01:20:02PM +0800, Tony Lin wrote:
>> > apply workaround for imx eSDHC controller to avoid missing card
>> > interrupt so that SDIO function is workable
>> Fixing a few typos (but note, I'm not a native speaker):
>> 
>> 	mmc/sdhci-esdhc-imx: fix losing card interrupt
>> 
>> 	Apply workaround for the imx eSDHC controller to avoid missing a
>> 	card interrupt.
>> 
>> 	Signed-off-by: ...
>> 
>> > Signed-off-by: Tony Lin <tony.lin@freescale.com>
>> > ---
>> >  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++-
>> -------
>> >  1 files changed, 30 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
>> > b/drivers/mmc/host/sdhci-esdhc-imx.c
>> > index a19967d..da77cae 100644
>> > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> > @@ -32,6 +32,8 @@
>> >  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
>> >
>> >  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
>> > +
>> > +#define	SDHCI_CTRL_D3CD			0x08
>> >  /*
>> >   * The CMDTYPE of the CMD register (offset 0xE) should be set to
>> >   * "11" when the STOP CMD12 is issued on imx53 to abort one @@ -87,14
>> > +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32
>> > val, int reg)  {
>> >  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> >  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
>> > -
>> > -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
>> > -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
>> > -		/*
>> > -		 * these interrupts won't work with a custom card_detect gpio
>> > -		 * (only applied to mx25/35)
>> > -		 */
>> > -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
>> > +	u32 data;
>> > +
>> > +	if (unlikely((reg == SDHCI_INT_ENABLE || reg ==
>> SDHCI_SIGNAL_ENABLE))) {
>> > +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
>> > +			/*
>> > +			 * these interrupts won't work with a custom
>> > +			 * card_detect gpio (only applied to mx25/35)
>> hmm, ok, this was here before, but I wonder about the "only applied to
>> mx25/35" part. How is that meant? I don't see logic to prevent other socs
>> using this workaround.
> Sorry, not so sure about mx25/35 history. But the flag is set only if it's mx25 or mx35. 
> You can check the code in esdhc_pltfm_init.

btw, I didn't notice when looking at the patch but this flag has been
renamed and maybe will be gone. See :
- latest commits on this file on mmc for-next:
http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commitdiff;h=e8cd77e467f7bb1d4b942037c47b087334a484d4
- last patch of the imx mmc fixes for cd/wp:
http://lists.infradead.org/pipermail/linux-arm-kernel/2011-June/052743.html

So, imho, it would be better to use an other way to check for mx25/35 as
current one won't work (at least won't compile but won't work as
intended if the last patch mentionned is merged. There are other systems
using gpio for cd or wp which are not mx25/35).

Arnaud

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

* [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC
@ 2011-07-27  9:42       ` Arnaud Patard (Rtp)
  0 siblings, 0 replies; 10+ messages in thread
From: Arnaud Patard (Rtp) @ 2011-07-27  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

Lin Tony-B19295 <B19295@freescale.com> writes:

Hi,

>> -----Original Message-----
>> From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-
>> kernel-bounces at lists.infradead.org] On Behalf Of Uwe Kleine-K?nig
>> Sent: Wednesday, July 27, 2011 3:47 PM
>> To: Lin Tony-B19295
>> Cc: cjb at laptop.org; linux-mmc at vger.kernel.org; kernel at pengutronix.de;
>> linux-arm-kernel at lists.infradead.org
>> Subject: Re: [PATCH 1/1] fix card interrupt losing issue on freescale
>> eSDHC
>> 
>> Hello Tony,
>> 
>> On Mon, Jul 18, 2011 at 01:20:02PM +0800, Tony Lin wrote:
>> > apply workaround for imx eSDHC controller to avoid missing card
>> > interrupt so that SDIO function is workable
>> Fixing a few typos (but note, I'm not a native speaker):
>> 
>> 	mmc/sdhci-esdhc-imx: fix losing card interrupt
>> 
>> 	Apply workaround for the imx eSDHC controller to avoid missing a
>> 	card interrupt.
>> 
>> 	Signed-off-by: ...
>> 
>> > Signed-off-by: Tony Lin <tony.lin@freescale.com>
>> > ---
>> >  drivers/mmc/host/sdhci-esdhc-imx.c |   39 +++++++++++++++++++++++++++-
>> -------
>> >  1 files changed, 30 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
>> > b/drivers/mmc/host/sdhci-esdhc-imx.c
>> > index a19967d..da77cae 100644
>> > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> > @@ -32,6 +32,8 @@
>> >  #define  SDHCI_VENDOR_SPEC_SDIO_QUIRK	0x00000002
>> >
>> >  #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
>> > +
>> > +#define	SDHCI_CTRL_D3CD			0x08
>> >  /*
>> >   * The CMDTYPE of the CMD register (offset 0xE) should be set to
>> >   * "11" when the STOP CMD12 is issued on imx53 to abort one @@ -87,14
>> > +89,31 @@ static void esdhc_writel_le(struct sdhci_host *host, u32
>> > val, int reg)  {
>> >  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> >  	struct pltfm_imx_data *imx_data = pltfm_host->priv;
>> > -
>> > -	if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
>> > -			&& (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)))
>> > -		/*
>> > -		 * these interrupts won't work with a custom card_detect gpio
>> > -		 * (only applied to mx25/35)
>> > -		 */
>> > -		val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
>> > +	u32 data;
>> > +
>> > +	if (unlikely((reg == SDHCI_INT_ENABLE || reg ==
>> SDHCI_SIGNAL_ENABLE))) {
>> > +		if (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD_WP)
>> > +			/*
>> > +			 * these interrupts won't work with a custom
>> > +			 * card_detect gpio (only applied to mx25/35)
>> hmm, ok, this was here before, but I wonder about the "only applied to
>> mx25/35" part. How is that meant? I don't see logic to prevent other socs
>> using this workaround.
> Sorry, not so sure about mx25/35 history. But the flag is set only if it's mx25 or mx35. 
> You can check the code in esdhc_pltfm_init.

btw, I didn't notice when looking at the patch but this flag has been
renamed and maybe will be gone. See :
- latest commits on this file on mmc for-next:
http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commitdiff;h=e8cd77e467f7bb1d4b942037c47b087334a484d4
- last patch of the imx mmc fixes for cd/wp:
http://lists.infradead.org/pipermail/linux-arm-kernel/2011-June/052743.html

So, imho, it would be better to use an other way to check for mx25/35 as
current one won't work (at least won't compile but won't work as
intended if the last patch mentionned is merged. There are other systems
using gpio for cd or wp which are not mx25/35).

Arnaud

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

end of thread, other threads:[~2011-07-27  9:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-18  5:20 [PATCH 1/1] fix card interrupt losing issue on freescale eSDHC Tony Lin
2011-07-18  5:20 ` Tony Lin
2011-07-27  6:38 ` Lin Tony-B19295
2011-07-27  6:38   ` Lin Tony-B19295
2011-07-27  7:47 ` Uwe Kleine-König
2011-07-27  7:47   ` Uwe Kleine-König
2011-07-27  9:27   ` Lin Tony-B19295
2011-07-27  9:27     ` Lin Tony-B19295
2011-07-27  9:42     ` Arnaud Patard
2011-07-27  9:42       ` Arnaud Patard (Rtp)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.