All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] new version workaround for FSL's eSDHC controller
@ 2012-01-16  6:13 r66093
  2012-01-16  6:13 ` [PATCH 1/4 v3] ESDHC: add PIO mode support r66093
  2012-02-05  1:18 ` [PATCH 0/4] new version workaround for FSL's eSDHC controller Chris Ball
  0 siblings, 2 replies; 9+ messages in thread
From: r66093 @ 2012-01-16  6:13 UTC (permalink / raw)
  To: linux-mmc; +Cc: Jerry Huang

From: Jerry Huang <Chang-Ming.Huang@freescale.com>

The below new verison patches are the workaround for FSL's eSDHC controller.
all patches have been acked-by Anton Vorontsov <cbouatmailru@gmail.com>.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>


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

* [PATCH 1/4 v3] ESDHC: add PIO mode support
  2012-01-16  6:13 [PATCH 0/4] new version workaround for FSL's eSDHC controller r66093
@ 2012-01-16  6:13 ` r66093
  2012-01-16  6:13   ` [PATCH 2/4 v3] ESDHC: set the timeout to the max value r66093
  2012-02-05  1:18 ` [PATCH 0/4] new version workaround for FSL's eSDHC controller Chris Ball
  1 sibling, 1 reply; 9+ messages in thread
From: r66093 @ 2012-01-16  6:13 UTC (permalink / raw)
  To: linux-mmc; +Cc: Jerry Huang, Gao Guanhua, Chris Ball

From: Jerry Huang <Chang-Ming.Huang@freescale.com>

For some FSL ESDHC controller(e.g. P2020E, Rev1.0), the SDHC can not work on
DMA mode because of the hardware bug, so we set a broken dma flag and use
PIO mode.

Signed-off-by: Gao Guanhua <B22826@freescale.com>
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Chris Ball <cjb@laptop.org>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
changes for v2:
	- change the property to compatible for quirks
changes for v3:
	- add the Acked-by

 drivers/mmc/host/sdhci-pltfm.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 03970bc..67b9ab0 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -2,7 +2,7 @@
  * sdhci-pltfm.c Support for SDHCI platform devices
  * Copyright (c) 2009 Intel Corporation
  *
- * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ * Copyright (c) 2007, 2011 Freescale Semiconductor, Inc.
  * Copyright (c) 2009 MontaVista Software, Inc.
  *
  * Authors: Xiaobo Xie <X.Xie@freescale.com>
@@ -71,6 +71,9 @@ void sdhci_get_of_property(struct platform_device *pdev)
 		if (sdhci_of_wp_inverted(np))
 			host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
 
+		if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
+			host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
+
 		clk = of_get_property(np, "clock-frequency", &size);
 		if (clk && size == sizeof(*clk) && *clk)
 			pltfm_host->clock = be32_to_cpup(clk);
-- 
1.7.5.4



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

* [PATCH 2/4 v3] ESDHC: set the timeout to the max value
  2012-01-16  6:13 ` [PATCH 1/4 v3] ESDHC: add PIO mode support r66093
@ 2012-01-16  6:13   ` r66093
  2012-01-16  6:13     ` [PATCH 3/4 v5] ESDHC: Power management for ESDHC r66093
  0 siblings, 1 reply; 9+ messages in thread
From: r66093 @ 2012-01-16  6:13 UTC (permalink / raw)
  To: linux-mmc; +Cc: Jerry Huang, Gao Guanhua, Xie Xiaobo, Chris Ball

From: Jerry Huang <Chang-Ming.Huang@freescale.com>

When access the card on some FSL platform board (e.g p2020, p1010, mpc8536),
the following error is reported with the timeout value calculated:

mmc0: Got data interrupt 0x00000020 even though no data operation was
in progress.
mmc0: Got data interrupt 0x00000020 even though no data operation was
in progress.

So we skip the calculation of timeout and use the max value to fix it.

Signed-off-by: Gao Guanhua <B22826@freescale.com>
Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Chris Ball <cjb@laptop.org>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
changes for v2:
	- change the property to compatible for quirks
changes for v3:
	- add the Acked-by

 drivers/mmc/host/sdhci-pltfm.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 67b9ab0..04fa130 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -74,6 +74,13 @@ void sdhci_get_of_property(struct platform_device *pdev)
 		if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
 			host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
 
+		if (of_device_is_compatible(np, "fsl,p2020-esdhc")
+				|| of_device_is_compatible(np,
+					"fsl,p1010-esdhc")
+				|| of_device_is_compatible(np,
+					"fsl,mpc8536-esdhc"))
+			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+
 		clk = of_get_property(np, "clock-frequency", &size);
 		if (clk && size == sizeof(*clk) && *clk)
 			pltfm_host->clock = be32_to_cpup(clk);
-- 
1.7.5.4



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

* [PATCH 3/4 v5] ESDHC: Power management for ESDHC
  2012-01-16  6:13   ` [PATCH 2/4 v3] ESDHC: set the timeout to the max value r66093
@ 2012-01-16  6:13     ` r66093
  2012-01-16  6:13       ` [PATCH 4/4 v5] ESDHC: Workaround for data crc error on p1010rdb r66093
  0 siblings, 1 reply; 9+ messages in thread
From: r66093 @ 2012-01-16  6:13 UTC (permalink / raw)
  To: linux-mmc; +Cc: Jerry Huang, Jiang Yutang, Chris Ball

From: Jerry Huang <Chang-Ming.Huang@freescale.com>

For FSL ESDHC controllor, when enter the sleep, the controller will power off,
therefore the register will lost its valuse, and driver should save value of
register during suspend and used during resume.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: Jiang Yutang <b14898@freescale.com>
CC: Chris Ball <cjb@laptop.org>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
changes for v2:
	- change the property to compatible for quirks
changes for v3:
	- fix one compile error
changes for v4:
	- use hooks to suspend/resume the special platform
changes for v5:
	- add the Acked-by

 drivers/mmc/host/sdhci-of-esdhc.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index c21be67..385a4ff 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -104,6 +104,21 @@ static int esdhc_of_get_cd(struct sdhci_host *host)
 	return present;
 }
 
+#ifdef CONFIG_PM
+static u32 esdhc_proctl;
+static void esdhc_of_suspend(struct sdhci_host *host)
+{
+	esdhc_proctl = sdhci_be32bs_readl(host, SDHCI_HOST_CONTROL);
+}
+
+static void esdhc_of_resume(struct sdhci_host *host)
+{
+	esdhc_of_enable_dma(host);
+	sdhci_be32bs_writel(host, esdhc_proctl, SDHCI_HOST_CONTROL);
+
+}
+#endif
+
 static struct sdhci_ops sdhci_esdhc_ops = {
 	.read_l = sdhci_be32bs_readl,
 	.read_w = esdhc_readw,
@@ -116,6 +131,10 @@ static struct sdhci_ops sdhci_esdhc_ops = {
 	.get_max_clock = esdhc_of_get_max_clock,
 	.get_min_clock = esdhc_of_get_min_clock,
 	.get_cd = esdhc_of_get_cd,
+#ifdef CONFIG_PM
+	.platform_suspend = esdhc_of_suspend,
+	.platform_resume = esdhc_of_resume,
+#endif
 };
 
 static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
-- 
1.7.5.4



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

* [PATCH 4/4 v5] ESDHC: Workaround for data crc error on p1010rdb
  2012-01-16  6:13     ` [PATCH 3/4 v5] ESDHC: Power management for ESDHC r66093
@ 2012-01-16  6:13       ` r66093
  2012-02-04 22:22         ` Chris Ball
  0 siblings, 1 reply; 9+ messages in thread
From: r66093 @ 2012-01-16  6:13 UTC (permalink / raw)
  To: linux-mmc; +Cc: Jerry Huang, Priyanka Jain, Chris Ball

From: Jerry Huang <Chang-Ming.Huang@freescale.com>

SD card read was failing (data crc error)on some cards at
maximum possible frequency on P1010(CCB frequency set to 400MHz).
Some clock deviations are also observed at this frequency.
Hence reduced the mmc clock freq.

Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
Singed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Chris Ball <cjb@laptop.org>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
changes for v2:
	- change the property to compatible for quirks
changes for v3:
	- fix one compile error
changes for v4:
	- use hooks to suspend/resume the special platform
changes for v5:
	- add the Acked-by

 drivers/mmc/host/sdhci-esdhc.h |    9 ++++++++-
 drivers/mmc/host/sdhci-pltfm.c |    3 +++
 include/linux/mmc/sdhci.h      |    2 ++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h
index b97b2f5..8e00174 100644
--- a/drivers/mmc/host/sdhci-esdhc.h
+++ b/drivers/mmc/host/sdhci-esdhc.h
@@ -1,7 +1,7 @@
 /*
  * Freescale eSDHC controller driver generics for OF and pltfm.
  *
- * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ * Copyright (c) 2007,2011 Freescale Semiconductor, Inc.
  * Copyright (c) 2009 MontaVista Software, Inc.
  * Copyright (c) 2010 Pengutronix e.K.
  *   Author: Wolfram Sang <w.sang@pengutronix.de>
@@ -56,6 +56,13 @@ static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
 	if (clock == 0)
 		goto out;
 
+	if (host->quirks2 & SDHCI_QUIRK2_RELAX_FREQ) {
+		if (clock > 20000000)
+			clock -= 5000000;
+		if (clock > 40000000)
+			clock -= 5000000;
+	}
+
 	while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
 		pre_div *= 2;
 
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 04fa130..c932316 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -81,6 +81,9 @@ void sdhci_get_of_property(struct platform_device *pdev)
 					"fsl,mpc8536-esdhc"))
 			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 
+		if (of_device_is_compatible(np, "fsl,p1010-esdhc"))
+			host->quirks2 |= SDHCI_QUIRK2_RELAX_FREQ;
+
 		clk = of_get_property(np, "clock-frequency", &size);
 		if (clk && size == sizeof(*clk) && *clk)
 			pltfm_host->clock = be32_to_cpup(clk);
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e4b6935..f7c1e13 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -91,6 +91,8 @@ struct sdhci_host {
 	unsigned int quirks2;	/* More deviations from spec. */
 
 #define SDHCI_QUIRK2_OWN_CARD_DETECTION			(1<<0)
+/* Controller operates the cards at reduced frequency */
+#define SDHCI_QUIRK2_RELAX_FREQ				(1<<1)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */
-- 
1.7.5.4



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

* Re: [PATCH 4/4 v5] ESDHC: Workaround for data crc error on p1010rdb
  2012-01-16  6:13       ` [PATCH 4/4 v5] ESDHC: Workaround for data crc error on p1010rdb r66093
@ 2012-02-04 22:22         ` Chris Ball
  2012-02-07  8:03           ` Huang Changming-R66093
  2012-02-08  3:34           ` Huang Changming-R66093
  0 siblings, 2 replies; 9+ messages in thread
From: Chris Ball @ 2012-02-04 22:22 UTC (permalink / raw)
  To: r66093; +Cc: linux-mmc, Jerry Huang, Priyanka Jain

Hi Jerry,

On Mon, Jan 16 2012, r66093@freescale.com wrote:
> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
>
> SD card read was failing (data crc error)on some cards at
> maximum possible frequency on P1010(CCB frequency set to 400MHz).
> Some clock deviations are also observed at this frequency.
> Hence reduced the mmc clock freq.
>
> Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
> Singed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> CC: Chris Ball <cjb@laptop.org>
> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
> ---
> changes for v2:
> 	- change the property to compatible for quirks
> changes for v3:
> 	- fix one compile error
> changes for v4:
> 	- use hooks to suspend/resume the special platform
> changes for v5:
> 	- add the Acked-by
>
>  drivers/mmc/host/sdhci-esdhc.h |    9 ++++++++-
>  drivers/mmc/host/sdhci-pltfm.c |    3 +++
>  include/linux/mmc/sdhci.h      |    2 ++
>  3 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h
> index b97b2f5..8e00174 100644
> --- a/drivers/mmc/host/sdhci-esdhc.h
> +++ b/drivers/mmc/host/sdhci-esdhc.h
> @@ -1,7 +1,7 @@
>  /*
>   * Freescale eSDHC controller driver generics for OF and pltfm.
>   *
> - * Copyright (c) 2007 Freescale Semiconductor, Inc.
> + * Copyright (c) 2007,2011 Freescale Semiconductor, Inc.
>   * Copyright (c) 2009 MontaVista Software, Inc.
>   * Copyright (c) 2010 Pengutronix e.K.
>   *   Author: Wolfram Sang <w.sang@pengutronix.de>
> @@ -56,6 +56,13 @@ static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
>  	if (clock == 0)
>  		goto out;
>  
> +	if (host->quirks2 & SDHCI_QUIRK2_RELAX_FREQ) {
> +		if (clock > 20000000)
> +			clock -= 5000000;
> +		if (clock > 40000000)
> +			clock -= 5000000;
> +	}
> +
>  	while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
>  		pre_div *= 2;
>  
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 04fa130..c932316 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -81,6 +81,9 @@ void sdhci_get_of_property(struct platform_device *pdev)
>  					"fsl,mpc8536-esdhc"))
>  			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
>  
> +		if (of_device_is_compatible(np, "fsl,p1010-esdhc"))
> +			host->quirks2 |= SDHCI_QUIRK2_RELAX_FREQ;
> +
>  		clk = of_get_property(np, "clock-frequency", &size);
>  		if (clk && size == sizeof(*clk) && *clk)
>  			pltfm_host->clock = be32_to_cpup(clk);
> diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
> index e4b6935..f7c1e13 100644
> --- a/include/linux/mmc/sdhci.h
> +++ b/include/linux/mmc/sdhci.h
> @@ -91,6 +91,8 @@ struct sdhci_host {
>  	unsigned int quirks2;	/* More deviations from spec. */
>  
>  #define SDHCI_QUIRK2_OWN_CARD_DETECTION			(1<<0)
> +/* Controller operates the cards at reduced frequency */
> +#define SDHCI_QUIRK2_RELAX_FREQ				(1<<1)
>  
>  	int irq;		/* Device IRQ */
>  	void __iomem *ioaddr;	/* Mapped address */

I don't think this should be implemented as a global SDHCI quirk,
because I don't think it's ever going to be used on non-ESDHC hardware.
Since you're already handling the clock change in an esdhc-only
function, can you just use your "fsl,p1010-esdhc" test to set some
driver-local flag to use later, instead of involving sdhci.h?

Thanks.  (No need to resend the other patches, I'll take this one
separately when it's been reworked.)

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

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

* Re: [PATCH 0/4] new version workaround for FSL's eSDHC controller
  2012-01-16  6:13 [PATCH 0/4] new version workaround for FSL's eSDHC controller r66093
  2012-01-16  6:13 ` [PATCH 1/4 v3] ESDHC: add PIO mode support r66093
@ 2012-02-05  1:18 ` Chris Ball
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Ball @ 2012-02-05  1:18 UTC (permalink / raw)
  To: r66093; +Cc: linux-mmc, Jerry Huang

Hi,

On Mon, Jan 16 2012, r66093@freescale.com wrote:
> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
>
> The below new verison patches are the workaround for FSL's eSDHC controller.
> all patches have been acked-by Anton Vorontsov <cbouatmailru@gmail.com>.
>
> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>

I've pushed patches {1, 2, 3} and will wait for you to resend patch 4
individually.  Thanks,

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

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

* RE: [PATCH 4/4 v5] ESDHC: Workaround for data crc error on p1010rdb
  2012-02-04 22:22         ` Chris Ball
@ 2012-02-07  8:03           ` Huang Changming-R66093
  2012-02-08  3:34           ` Huang Changming-R66093
  1 sibling, 0 replies; 9+ messages in thread
From: Huang Changming-R66093 @ 2012-02-07  8:03 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Jain Priyanka-B32167

Chris,
Thanks.

I will think about how to handle it and rework it.

> -----Original Message-----
> From: Chris Ball [mailto:cjb@laptop.org]
> Sent: Sunday, February 05, 2012 6:22 AM
> To: Huang Changming-R66093
> Cc: linux-mmc@vger.kernel.org; Huang Changming-R66093; Jain Priyanka-
> B32167
> Subject: Re: [PATCH 4/4 v5] ESDHC: Workaround for data crc error on
> p1010rdb
> 
> Hi Jerry,
> 
> On Mon, Jan 16 2012, r66093@freescale.com wrote:
> > From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> >
> > SD card read was failing (data crc error)on some cards at maximum
> > possible frequency on P1010(CCB frequency set to 400MHz).
> > Some clock deviations are also observed at this frequency.
> > Hence reduced the mmc clock freq.
> >
> > Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
> > Singed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> > CC: Chris Ball <cjb@laptop.org>
> > Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
> > ---
> > changes for v2:
> > 	- change the property to compatible for quirks changes for v3:
> > 	- fix one compile error
> > changes for v4:
> > 	- use hooks to suspend/resume the special platform changes for v5:
> > 	- add the Acked-by
> >
> >  drivers/mmc/host/sdhci-esdhc.h |    9 ++++++++-
> >  drivers/mmc/host/sdhci-pltfm.c |    3 +++
> >  include/linux/mmc/sdhci.h      |    2 ++
> >  3 files changed, 13 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-esdhc.h
> > b/drivers/mmc/host/sdhci-esdhc.h index b97b2f5..8e00174 100644
> > --- a/drivers/mmc/host/sdhci-esdhc.h
> > +++ b/drivers/mmc/host/sdhci-esdhc.h
> > @@ -1,7 +1,7 @@
> >  /*
> >   * Freescale eSDHC controller driver generics for OF and pltfm.
> >   *
> > - * Copyright (c) 2007 Freescale Semiconductor, Inc.
> > + * Copyright (c) 2007,2011 Freescale Semiconductor, Inc.
> >   * Copyright (c) 2009 MontaVista Software, Inc.
> >   * Copyright (c) 2010 Pengutronix e.K.
> >   *   Author: Wolfram Sang <w.sang@pengutronix.de>
> > @@ -56,6 +56,13 @@ static inline void esdhc_set_clock(struct sdhci_host
> *host, unsigned int clock)
> >  	if (clock == 0)
> >  		goto out;
> >
> > +	if (host->quirks2 & SDHCI_QUIRK2_RELAX_FREQ) {
> > +		if (clock > 20000000)
> > +			clock -= 5000000;
> > +		if (clock > 40000000)
> > +			clock -= 5000000;
> > +	}
> > +
> >  	while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
> >  		pre_div *= 2;
> >
> > diff --git a/drivers/mmc/host/sdhci-pltfm.c
> > b/drivers/mmc/host/sdhci-pltfm.c index 04fa130..c932316 100644
> > --- a/drivers/mmc/host/sdhci-pltfm.c
> > +++ b/drivers/mmc/host/sdhci-pltfm.c
> > @@ -81,6 +81,9 @@ void sdhci_get_of_property(struct platform_device
> *pdev)
> >  					"fsl,mpc8536-esdhc"))
> >  			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
> >
> > +		if (of_device_is_compatible(np, "fsl,p1010-esdhc"))
> > +			host->quirks2 |= SDHCI_QUIRK2_RELAX_FREQ;
> > +
> >  		clk = of_get_property(np, "clock-frequency", &size);
> >  		if (clk && size == sizeof(*clk) && *clk)
> >  			pltfm_host->clock = be32_to_cpup(clk); diff --git
> > a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index
> > e4b6935..f7c1e13 100644
> > --- a/include/linux/mmc/sdhci.h
> > +++ b/include/linux/mmc/sdhci.h
> > @@ -91,6 +91,8 @@ struct sdhci_host {
> >  	unsigned int quirks2;	/* More deviations from spec. */
> >
> >  #define SDHCI_QUIRK2_OWN_CARD_DETECTION			(1<<0)
> > +/* Controller operates the cards at reduced frequency */
> > +#define SDHCI_QUIRK2_RELAX_FREQ				(1<<1)
> >
> >  	int irq;		/* Device IRQ */
> >  	void __iomem *ioaddr;	/* Mapped address */
> 
> I don't think this should be implemented as a global SDHCI quirk, because
> I don't think it's ever going to be used on non-ESDHC hardware.
> Since you're already handling the clock change in an esdhc-only function,
> can you just use your "fsl,p1010-esdhc" test to set some driver-local
> flag to use later, instead of involving sdhci.h?
> 
> Thanks.  (No need to resend the other patches, I'll take this one
> separately when it's been reworked.)
> 
> - Chris.
> --
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child



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

* RE: [PATCH 4/4 v5] ESDHC: Workaround for data crc error on p1010rdb
  2012-02-04 22:22         ` Chris Ball
  2012-02-07  8:03           ` Huang Changming-R66093
@ 2012-02-08  3:34           ` Huang Changming-R66093
  1 sibling, 0 replies; 9+ messages in thread
From: Huang Changming-R66093 @ 2012-02-08  3:34 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Jain Priyanka-B32167

Hi, Chris,
I have reworked it and send it to the maillist, please review it.

Best regards
Jerry Huang

> -----Original Message-----
> From: Chris Ball [mailto:cjb@laptop.org]
> Sent: Sunday, February 05, 2012 6:22 AM
> To: Huang Changming-R66093
> Cc: linux-mmc@vger.kernel.org; Huang Changming-R66093; Jain Priyanka-
> B32167
> Subject: Re: [PATCH 4/4 v5] ESDHC: Workaround for data crc error on
> p1010rdb
> 
> Hi Jerry,
> 
> On Mon, Jan 16 2012, r66093@freescale.com wrote:
> > From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> >
> > SD card read was failing (data crc error)on some cards at maximum
> > possible frequency on P1010(CCB frequency set to 400MHz).
> > Some clock deviations are also observed at this frequency.
> > Hence reduced the mmc clock freq.
> >
> > Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
> > Singed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> > CC: Chris Ball <cjb@laptop.org>
> > Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
> > ---
> > changes for v2:
> > 	- change the property to compatible for quirks changes for v3:
> > 	- fix one compile error
> > changes for v4:
> > 	- use hooks to suspend/resume the special platform changes for v5:
> > 	- add the Acked-by
> >
> >  drivers/mmc/host/sdhci-esdhc.h |    9 ++++++++-
> >  drivers/mmc/host/sdhci-pltfm.c |    3 +++
> >  include/linux/mmc/sdhci.h      |    2 ++
> >  3 files changed, 13 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-esdhc.h
> > b/drivers/mmc/host/sdhci-esdhc.h index b97b2f5..8e00174 100644
> > --- a/drivers/mmc/host/sdhci-esdhc.h
> > +++ b/drivers/mmc/host/sdhci-esdhc.h
> > @@ -1,7 +1,7 @@
> >  /*
> >   * Freescale eSDHC controller driver generics for OF and pltfm.
> >   *
> > - * Copyright (c) 2007 Freescale Semiconductor, Inc.
> > + * Copyright (c) 2007,2011 Freescale Semiconductor, Inc.
> >   * Copyright (c) 2009 MontaVista Software, Inc.
> >   * Copyright (c) 2010 Pengutronix e.K.
> >   *   Author: Wolfram Sang <w.sang@pengutronix.de>
> > @@ -56,6 +56,13 @@ static inline void esdhc_set_clock(struct sdhci_host
> *host, unsigned int clock)
> >  	if (clock == 0)
> >  		goto out;
> >
> > +	if (host->quirks2 & SDHCI_QUIRK2_RELAX_FREQ) {
> > +		if (clock > 20000000)
> > +			clock -= 5000000;
> > +		if (clock > 40000000)
> > +			clock -= 5000000;
> > +	}
> > +
> >  	while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
> >  		pre_div *= 2;
> >
> > diff --git a/drivers/mmc/host/sdhci-pltfm.c
> > b/drivers/mmc/host/sdhci-pltfm.c index 04fa130..c932316 100644
> > --- a/drivers/mmc/host/sdhci-pltfm.c
> > +++ b/drivers/mmc/host/sdhci-pltfm.c
> > @@ -81,6 +81,9 @@ void sdhci_get_of_property(struct platform_device
> *pdev)
> >  					"fsl,mpc8536-esdhc"))
> >  			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
> >
> > +		if (of_device_is_compatible(np, "fsl,p1010-esdhc"))
> > +			host->quirks2 |= SDHCI_QUIRK2_RELAX_FREQ;
> > +
> >  		clk = of_get_property(np, "clock-frequency", &size);
> >  		if (clk && size == sizeof(*clk) && *clk)
> >  			pltfm_host->clock = be32_to_cpup(clk); diff --git
> > a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index
> > e4b6935..f7c1e13 100644
> > --- a/include/linux/mmc/sdhci.h
> > +++ b/include/linux/mmc/sdhci.h
> > @@ -91,6 +91,8 @@ struct sdhci_host {
> >  	unsigned int quirks2;	/* More deviations from spec. */
> >
> >  #define SDHCI_QUIRK2_OWN_CARD_DETECTION			(1<<0)
> > +/* Controller operates the cards at reduced frequency */
> > +#define SDHCI_QUIRK2_RELAX_FREQ				(1<<1)
> >
> >  	int irq;		/* Device IRQ */
> >  	void __iomem *ioaddr;	/* Mapped address */
> 
> I don't think this should be implemented as a global SDHCI quirk, because
> I don't think it's ever going to be used on non-ESDHC hardware.
> Since you're already handling the clock change in an esdhc-only function,
> can you just use your "fsl,p1010-esdhc" test to set some driver-local
> flag to use later, instead of involving sdhci.h?
> 
> Thanks.  (No need to resend the other patches, I'll take this one
> separately when it's been reworked.)
> 
> - Chris.
> --
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child



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

end of thread, other threads:[~2012-02-08  3:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16  6:13 [PATCH 0/4] new version workaround for FSL's eSDHC controller r66093
2012-01-16  6:13 ` [PATCH 1/4 v3] ESDHC: add PIO mode support r66093
2012-01-16  6:13   ` [PATCH 2/4 v3] ESDHC: set the timeout to the max value r66093
2012-01-16  6:13     ` [PATCH 3/4 v5] ESDHC: Power management for ESDHC r66093
2012-01-16  6:13       ` [PATCH 4/4 v5] ESDHC: Workaround for data crc error on p1010rdb r66093
2012-02-04 22:22         ` Chris Ball
2012-02-07  8:03           ` Huang Changming-R66093
2012-02-08  3:34           ` Huang Changming-R66093
2012-02-05  1:18 ` [PATCH 0/4] new version workaround for FSL's eSDHC controller Chris Ball

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.