diff mbox

[U-Boot] mmc erase fails from U-Boot command line

Message ID 565F4674.8010306@nelint.com
State RFC
Headers show

Commit Message

Eric Nelson Dec. 2, 2015, 7:28 p.m. UTC
Hi Fabio,

On 12/02/2015 11:52 AM, Fabio Estevam wrote:
> Hi Eric,
> 
> On Wed, Dec 2, 2015 at 4:47 PM, Eric Nelson <eric@nelint.com> wrote:
>> Sure. It's a hack, but shows where we're hitting the problem
>> (with the stop command).
>>
>> We haven't been using the "mmc erase" command, but see this when
>> using ums to program eMMC.
> 
> Ok, applied your patch, but still get:
> 
> => mmc erase 4000 1000
> 
> MMC erase: dev # 2, block # 16384, count 4096 ... Timeout waiting for DAT0 to go
>  high!
> mmc erase failed
> 0 blocks erased: ERROR
> =>
> 

You're hitting the block from a different path than we are and it will
be tomorrow before I can get an offending board on my desk.

What happens if you "#if 0" around this block?

http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/fsl_esdhc.c;h=c5054d66bdcda029f0485958c87bd5154ccee591;hb=HEAD#l390

Do you know which command is failing? It should be one of these:
	MMC_CMD_ERASE_GROUP_START
	MMC_CMD_ERASE_GROUP_END
	MMC_CMD_ERASE

http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/mmc_write.c;h=7aea7e943b9e05c8aa537653f4ae8878ecb1b04b;hb=HEAD#l17

I think you can instrument and find out using this:

Comments

Fabio Estevam Dec. 2, 2015, 7:53 p.m. UTC | #1
Hi Eric,

On Wed, Dec 2, 2015 at 5:28 PM, Eric Nelson <eric@nelint.com> wrote:

> You're hitting the block from a different path than we are and it will
> be tomorrow before I can get an offending board on my desk.
>
> What happens if you "#if 0" around this block?

Then the error changes to:

=> mmc erase 4000 1000

MMC erase: dev # 2, block # 16384, count 4096 ... Timeout waiting card ready
0 blocks erased: ERROR

>
> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/fsl_esdhc.c;h=c5054d66bdcda029f0485958c87bd5154ccee591;hb=HEAD#l390
>
> Do you know which command is failing? It should be one of these:
>         MMC_CMD_ERASE_GROUP_START
>         MMC_CMD_ERASE_GROUP_END
>         MMC_CMD_ERASE

It is MMC_CMD_ERASE as shown below.

>
> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/mmc_write.c;h=7aea7e943b9e05c8aa537653f4ae8878ecb1b04b;hb=HEAD#l17
>
> I think you can instrument and find out using this:
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 53084a7..8f5d9e1 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -105,6 +105,9 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd
> *cmd, struct mmc_data *data)
>  #else
>         ret = mmc->cfg->ops->send_cmd(mmc, cmd, data);
>  #endif
> +       if (ret)
> +               printf("error %d from CMD_SEND:%d\n", ret, cmd->cmdidx);
> +
>         return ret;

Applying this change on top of head I get:

=> mmc erase 4000 1000

MMC erase: dev # 2, block # 16384, count 4096 ... Timeout waiting for DAT0 to go
 high!
error -19 from CMD_SEND:38
mmc erase failed
0 blocks erased: ERROR
=>

Thanks
Eric Nelson Dec. 4, 2015, 4:35 p.m. UTC | #2
Hi Fabio,

On 12/02/2015 12:53 PM, Fabio Estevam wrote:
> On Wed, Dec 2, 2015 at 5:28 PM, Eric Nelson <eric@nelint.com> wrote:
> 
...
>>
>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>> index 53084a7..8f5d9e1 100644
>> --- a/drivers/mmc/mmc.c
>> +++ b/drivers/mmc/mmc.c
>> @@ -105,6 +105,9 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd
>> *cmd, struct mmc_data *data)
>>  #else
>>         ret = mmc->cfg->ops->send_cmd(mmc, cmd, data);
>>  #endif
>> +       if (ret)
>> +               printf("error %d from CMD_SEND:%d\n", ret, cmd->cmdidx);
>> +
>>         return ret;
> 
> Applying this change on top of head I get:
> 
> => mmc erase 4000 1000
> 
> MMC erase: dev # 2, block # 16384, count 4096 ... Timeout waiting for DAT0 to go
>  high!
> error -19 from CMD_SEND:38
> mmc erase failed
> 0 blocks erased: ERROR

How easy is this for you to reproduce?

I'm only seeing the error sporadically, which makes it difficult to
test.
Fabio Estevam Dec. 4, 2015, 4:37 p.m. UTC | #3
Hi Eric,

On Fri, Dec 4, 2015 at 2:35 PM, Eric Nelson <eric@nelint.com> wrote:

> How easy is this for you to reproduce?

Very easy as it happens 100% of the times I run 'mmc erase' on a revC2
or revC4 board.

Thanks
diff mbox

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 53084a7..8f5d9e1 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -105,6 +105,9 @@  int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd
*cmd, struct mmc_data *data)
 #else
        ret = mmc->cfg->ops->send_cmd(mmc, cmd, data);
 #endif
+       if (ret)
+               printf("error %d from CMD_SEND:%d\n", ret, cmd->cmdidx);
+
        return ret;
 }