diff mbox

[U-Boot] mmc: fsl_esdhc: increase data transaction timeout to 500ms

Message ID 1451456370-14206-1-git-send-email-yangbo.lu@nxp.com
State Accepted, archived
Commit e978a31b631ac40d786f80b4254c323dcc4e1a82
Delegated to: York Sun
Headers show

Commit Message

Yangbo Lu Dec. 30, 2015, 6:19 a.m. UTC
The MMC spec says "It is strongly recommended for hosts to implement
more than 500ms timeout value even if the card indicates the 250ms
maximum busy length."  Even the previous value of 300ms is known to
be insufficient for some cards. So, increase the timeout to 500ms.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/mmc/fsl_esdhc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

York Sun Jan. 14, 2016, 6:09 p.m. UTC | #1
On 12/29/2015 10:27 PM, Yangbo Lu wrote:
> The MMC spec says "It is strongly recommended for hosts to implement
> more than 500ms timeout value even if the card indicates the 250ms
> maximum busy length."  Even the previous value of 300ms is known to
> be insufficient for some cards. So, increase the timeout to 500ms.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
>  drivers/mmc/fsl_esdhc.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index c5054d6..12820cf 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -252,8 +252,15 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
>  	 * Rounding up to next power of 2
>  	 * => timeout + 13 = log2(mmc->clock/4) + 1
>  	 * => timeout + 13 = fls(mmc->clock/4)
> +	 *
> +	 * However, the MMC spec "It is strongly recommended for hosts to
> +	 * implement more than 500ms timeout value even if the card
> +	 * indicates the 250ms maximum busy length."  Even the previous
> +	 * value of 300ms is known to be insufficient for some cards.
> +	 * So, we use
> +	 * => timeout + 13 = fls(mmc->clock/2)
>  	 */
> -	timeout = fls(mmc->clock/4);
> +	timeout = fls(mmc->clock/2);
>  	timeout -= 13;
>  
>  	if (timeout > 14)
> 

Pantelis,

With your ack, I can take this in, unless you want to merge it.

York
York Sun Jan. 27, 2016, 5:09 p.m. UTC | #2
On 12/29/2015 10:27 PM, Yangbo Lu wrote:
> The MMC spec says "It is strongly recommended for hosts to implement
> more than 500ms timeout value even if the card indicates the 250ms
> maximum busy length."  Even the previous value of 300ms is known to
> be insufficient for some cards. So, increase the timeout to 500ms.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
>  drivers/mmc/fsl_esdhc.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 

Applied to u-boot-fsl-qoriq master. Awaiting upstream.

Thanks.

York
diff mbox

Patch

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index c5054d6..12820cf 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -252,8 +252,15 @@  static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 	 * Rounding up to next power of 2
 	 * => timeout + 13 = log2(mmc->clock/4) + 1
 	 * => timeout + 13 = fls(mmc->clock/4)
+	 *
+	 * However, the MMC spec "It is strongly recommended for hosts to
+	 * implement more than 500ms timeout value even if the card
+	 * indicates the 250ms maximum busy length."  Even the previous
+	 * value of 300ms is known to be insufficient for some cards.
+	 * So, we use
+	 * => timeout + 13 = fls(mmc->clock/2)
 	 */
-	timeout = fls(mmc->clock/4);
+	timeout = fls(mmc->clock/2);
 	timeout -= 13;
 
 	if (timeout > 14)