diff mbox

[4/6] mmc: sdhci-esdhc-imx: set the correct max timeout value for uSDHC

Message ID 1386680168-5227-5-git-send-email-b29396@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Aisheng Dong Dec. 10, 2013, 12:56 p.m. UTC
The default sdhci driver write 0xE into timeout counter register to
set the maximum timeout. The value is not correct for uSDHC since the
max counter value for uSDHC is 0xF.
Instead of using common timeout code in sdhci, we implement esdhc_set_timeout
to handle the difference between eSDHC and uSDHC.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

Shawn Guo Dec. 11, 2013, 2:17 a.m. UTC | #1
On Tue, Dec 10, 2013 at 08:56:06PM +0800, Dong Aisheng wrote:
> The default sdhci driver write 0xE into timeout counter register to
> set the maximum timeout. The value is not correct for uSDHC since the
> max counter value for uSDHC is 0xF.
> Instead of using common timeout code in sdhci, we implement esdhc_set_timeout
> to handle the difference between eSDHC and uSDHC.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 97b35e1..c24cb23 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -868,6 +868,16 @@ unsigned int esdhc_get_max_timeout(struct sdhci_host *host)
>  	return max_to / (esdhc_pltfm_get_max_clock(host) / 1000);
>  }
>  
> +void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)

static?

Shawn

> +{
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	struct pltfm_imx_data *imx_data = pltfm_host->priv;
> +
> +	/* use maximum timeout counter */
> +	sdhci_writeb(host, esdhc_is_usdhc(imx_data) ? 0xF : 0xE,
> +			SDHCI_TIMEOUT_CONTROL);
> +}
> +
>  static struct sdhci_ops sdhci_esdhc_ops = {
>  	.read_l = esdhc_readl_le,
>  	.read_w = esdhc_readw_le,
> @@ -881,6 +891,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
>  	.platform_bus_width = esdhc_pltfm_bus_width,
>  	.set_uhs_signaling = esdhc_set_uhs_signaling,
>  	.get_max_timeout = esdhc_get_max_timeout,
> +	.set_timeout = esdhc_set_timeout,
>  };
>  
>  static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
> -- 
> 1.7.2.rc3
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dong Aisheng Dec. 11, 2013, 3:08 a.m. UTC | #2
On Wed, Dec 11, 2013 at 10:17 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Tue, Dec 10, 2013 at 08:56:06PM +0800, Dong Aisheng wrote:
>> The default sdhci driver write 0xE into timeout counter register to
>> set the maximum timeout. The value is not correct for uSDHC since the
>> max counter value for uSDHC is 0xF.
>> Instead of using common timeout code in sdhci, we implement esdhc_set_timeout
>> to handle the difference between eSDHC and uSDHC.
>>
>> Signed-off-by: Dong Aisheng <b29396@freescale.com>
>> ---
>>  drivers/mmc/host/sdhci-esdhc-imx.c |   11 +++++++++++
>>  1 files changed, 11 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index 97b35e1..c24cb23 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -868,6 +868,16 @@ unsigned int esdhc_get_max_timeout(struct sdhci_host *host)
>>       return max_to / (esdhc_pltfm_get_max_clock(host) / 1000);
>>  }
>>
>> +void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
>
> static?
>

Sorry, i missed it when do copy&paste.
Will update it in v2 with another same issue you pointed.

Regards
Dong Aisheng

> Shawn
>
>> +{
>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +     struct pltfm_imx_data *imx_data = pltfm_host->priv;
>> +
>> +     /* use maximum timeout counter */
>> +     sdhci_writeb(host, esdhc_is_usdhc(imx_data) ? 0xF : 0xE,
>> +                     SDHCI_TIMEOUT_CONTROL);
>> +}
>> +
>>  static struct sdhci_ops sdhci_esdhc_ops = {
>>       .read_l = esdhc_readl_le,
>>       .read_w = esdhc_readw_le,
>> @@ -881,6 +891,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
>>       .platform_bus_width = esdhc_pltfm_bus_width,
>>       .set_uhs_signaling = esdhc_set_uhs_signaling,
>>       .get_max_timeout = esdhc_get_max_timeout,
>> +     .set_timeout = esdhc_set_timeout,
>>  };
>>
>>  static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
>> --
>> 1.7.2.rc3
>>
>>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 97b35e1..c24cb23 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -868,6 +868,16 @@  unsigned int esdhc_get_max_timeout(struct sdhci_host *host)
 	return max_to / (esdhc_pltfm_get_max_clock(host) / 1000);
 }
 
+void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+
+	/* use maximum timeout counter */
+	sdhci_writeb(host, esdhc_is_usdhc(imx_data) ? 0xF : 0xE,
+			SDHCI_TIMEOUT_CONTROL);
+}
+
 static struct sdhci_ops sdhci_esdhc_ops = {
 	.read_l = esdhc_readl_le,
 	.read_w = esdhc_readw_le,
@@ -881,6 +891,7 @@  static struct sdhci_ops sdhci_esdhc_ops = {
 	.platform_bus_width = esdhc_pltfm_bus_width,
 	.set_uhs_signaling = esdhc_set_uhs_signaling,
 	.get_max_timeout = esdhc_get_max_timeout,
+	.set_timeout = esdhc_set_timeout,
 };
 
 static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {