diff mbox

[U-Boot] Revert "mmc: retry the cmd8 to meet 74 clocks requirement in the spec"

Message ID 1321349739-15212-1-git-send-email-macpaul@andestech.com
State Accepted
Commit afd5932b2c27c750ba7dbe39125916a45d2e1c13
Delegated to: Andy Fleming
Headers show

Commit Message

Macpaul Lin Nov. 15, 2011, 9:35 a.m. UTC
This reverts commit 02f3029f1810b99869254d0cf0a71946a008a728.

This patch add 3 times retry to CMD8 because the Marvell mmc controller
doesn't obey the power ramp up process in the SD specification 6.4.1.
(Please refer to figure 6.1 and 6.2 in the specification.)

The CMD0 should be send after power ramp up has been finished.
However, the Marvell mmc contorller must do power ramp up after the
first CMD0 command has been send.

This patch also affect existing platforms like Nokia N900 and other
platforms.

Signed-off-by: Macpaul Lin <macpaul@andestech.com>
---
 drivers/mmc/mmc.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)

Comments

Lei Wen Nov. 15, 2011, 9:41 a.m. UTC | #1
On Tue, Nov 15, 2011 at 5:35 PM, Macpaul Lin <macpaul@andestech.com> wrote:
> This reverts commit 02f3029f1810b99869254d0cf0a71946a008a728.
>
> This patch add 3 times retry to CMD8 because the Marvell mmc controller
> doesn't obey the power ramp up process in the SD specification 6.4.1.
> (Please refer to figure 6.1 and 6.2 in the specification.)
>
> The CMD0 should be send after power ramp up has been finished.
> However, the Marvell mmc contorller must do power ramp up after the
> first CMD0 command has been send.
>
> This patch also affect existing platforms like Nokia N900 and other
> platforms.
>
> Signed-off-by: Macpaul Lin <macpaul@andestech.com>
> ---
>  drivers/mmc/mmc.c |   16 ++--------------
>  1 files changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 37ce6e8..21665ec 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1190,7 +1190,7 @@ block_dev_desc_t *mmc_get_dev(int dev)
>
>  int mmc_init(struct mmc *mmc)
>  {
> -       int err, retry = 3;
> +       int err;
>
>        if (mmc->has_init)
>                return 0;
> @@ -1213,19 +1213,7 @@ int mmc_init(struct mmc *mmc)
>        mmc->part_num = 0;
>
>        /* Test for SD version 2 */
> -       /*
> -        * retry here for 3 times, as for some controller it has dynamic
> -        * clock gating, and only toggle out clk when the first cmd0 send
> -        * out, while some card strictly obey the 74 clocks rule, the interval
> -        * may not be sufficient between the cmd0 and this cmd8, retry to
> -        * fulfil the clock requirement
> -        */
> -       do {
> -               err = mmc_send_if_cond(mmc);
> -       } while (--retry > 0 && err);
> -
> -       if (err)
> -               return err;
> +       err = mmc_send_if_cond(mmc);
>
>        /* Now try to get the SD card's operating condition */
>        err = sd_send_op_cond(mmc);
> --
> 1.7.3.5
>
>

Acked-by: Lei Wen <leiwen@marvell.com>
Stephen Warren Nov. 19, 2011, 7:36 p.m. UTC | #2
On 01/-10/-28163 12:59 PM, Macpaul Lin wrote:
> This reverts commit 02f3029f1810b99869254d0cf0a71946a008a728.
> 
> This patch add 3 times retry to CMD8 because the Marvell mmc controller
> doesn't obey the power ramp up process in the SD specification 6.4.1.
> (Please refer to figure 6.1 and 6.2 in the specification.)
> 
> The CMD0 should be send after power ramp up has been finished.
> However, the Marvell mmc contorller must do power ramp up after the
> first CMD0 command has been send.
> 
> This patch also affect existing platforms like Nokia N900 and other
> platforms.
> 
> Signed-off-by: Macpaul Lin <macpaul@andestech.com>
> Acked-by: Lei Wen <leiwen@marvell.com>

Acked-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

As background, I'm working on patches to support the Toshiba AC100 /
Dynabook AZ in mainline U-Boot. The internal MMC didn't work at all
until this revert was applied. The SD slot worked perfectly though. I
guess this is related to the MMC itself not supporting this
(SD-specific?) command, and the patch caused MMC mode never to be attempted.
Pali Rohár Nov. 19, 2011, 7:45 p.m. UTC | #3
On Saturday 19 November 2011 12:36:00 Stephen Warren wrote:
> On 01/-10/-28163 12:59 PM, Macpaul Lin wrote:
> > This reverts commit 02f3029f1810b99869254d0cf0a71946a008a728.
> > 
> > This patch add 3 times retry to CMD8 because the Marvell mmc controller
> > doesn't obey the power ramp up process in the SD specification 6.4.1.
> > (Please refer to figure 6.1 and 6.2 in the specification.)
> > 
> > The CMD0 should be send after power ramp up has been finished.
> > However, the Marvell mmc contorller must do power ramp up after the
> > first CMD0 command has been send.
> > 
> > This patch also affect existing platforms like Nokia N900 and other
> > platforms.
> > 
> > Signed-off-by: Macpaul Lin <macpaul@andestech.com>
> > Acked-by: Lei Wen <leiwen@marvell.com>
> 
> Acked-by: Stephen Warren <swarren@nvidia.com>
> Tested-by: Stephen Warren <swarren@nvidia.com>
> 
> As background, I'm working on patches to support the Toshiba AC100 /
> Dynabook AZ in mainline U-Boot. The internal MMC didn't work at all
> until this revert was applied. The SD slot worked perfectly though. I
> guess this is related to the MMC itself not supporting this
> (SD-specific?) command, and the patch caused MMC mode never to be attempted.

Same for Nokia N900 (SD slot working fine). After reverting commit 
02f3029f1810b99869254d0cf0a71946a008a728 internal eMMC working too.
Andy Fleming Nov. 25, 2011, 11:44 p.m. UTC | #4
On Tue, Nov 15, 2011 at 3:35 AM, Macpaul Lin <macpaul@andestech.com> wrote:
> This reverts commit 02f3029f1810b99869254d0cf0a71946a008a728.
>
> This patch add 3 times retry to CMD8 because the Marvell mmc controller
> doesn't obey the power ramp up process in the SD specification 6.4.1.
> (Please refer to figure 6.1 and 6.2 in the specification.)
>
> The CMD0 should be send after power ramp up has been finished.
> However, the Marvell mmc contorller must do power ramp up after the
> first CMD0 command has been send.
>
> This patch also affect existing platforms like Nokia N900 and other
> platforms.
>
> Signed-off-by: Macpaul Lin <macpaul@andestech.com>

Applied, thanks everyone!
diff mbox

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 37ce6e8..21665ec 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1190,7 +1190,7 @@  block_dev_desc_t *mmc_get_dev(int dev)
 
 int mmc_init(struct mmc *mmc)
 {
-	int err, retry = 3;
+	int err;
 
 	if (mmc->has_init)
 		return 0;
@@ -1213,19 +1213,7 @@  int mmc_init(struct mmc *mmc)
 	mmc->part_num = 0;
 
 	/* Test for SD version 2 */
-	/*
-	 * retry here for 3 times, as for some controller it has dynamic
-	 * clock gating, and only toggle out clk when the first cmd0 send
-	 * out, while some card strictly obey the 74 clocks rule, the interval
-	 * may not be sufficient between the cmd0 and this cmd8, retry to
-	 * fulfil the clock requirement
-	 */
-	do {
-		err = mmc_send_if_cond(mmc);
-	} while (--retry > 0 && err);
-
-	if (err)
-		return err;
+	err = mmc_send_if_cond(mmc);
 
 	/* Now try to get the SD card's operating condition */
 	err = sd_send_op_cond(mmc);