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

Palacios, Hector
2015-11-13T12:26:19Z

Hi Fabio,

On Thu, 12 Nov 2015 21:56, Fabio Estevam wrote:
> Hi Hector and Cliff,
>
> On Mon, Oct 19, 2015 at 9:06 AM, Hector Palacios
> <hector.palacios@digi.com> wrote:
>
>> This issue is reproducible on Freescale's SABRESD on both SD card and eMMC with v2015.04. The
>> issue has been there always, I believe. Apparently the command erases the first block, but the
>> operation returns an error, so it aborts and it doesn't continue erasing futher blocks.
>>
>> I opened a similar thread a while ago:
>> http://lists.denx.de/pipermail/u-boot/2015-June/215912.html
>
>
> I am running mainline U-boot on a mx6qsabresd and it works fine here:
>
> => mmc dev 2
> switch to partitions #0, OK
> mmc2(part 0) is current device
> => mmc erase 4000 1000
>
> MMC erase: dev # 2, block # 16384, count 4096 ... 4096 blocks erased: OK
> =>

I can reproduce it with latest U-Boot on a mx6qsabresd both on the SD card and on the eMMC:

U-Boot 2015.10-00638-g9ac4fc82071c (Nov 13 2015 - 12:44:11 +0100)

CPU: Freescale i.MX6Q rev1.2 996 MHz (running at 792 MHz)
CPU: Automotive temperature grade (-40C to 125C) at 45C
Reset cause: POR
Board: MX6-SabreSD
I2C: ready
DRAM: 1 GiB
PMIC: PFUZE100 ID=0x10
MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
*** Warning - bad CRC, using default environment

PCI: pcie phy link never came up
No panel detected: default to Hannstar-XGA
Display: Hannstar-XGA (1024x768)
In: serial
Out: serial
Err: serial
Net: FEC [PRIME]
Hit any key to stop autoboot: 0

SDCARD test:

=> mmc dev 1
switch to partitions #0, OK
mmc1 is current device
=> mmc erase 4000 1000

MMC erase: dev # 1, block # 16384, count 4096 ... Timeout waiting for DAT0 to go high!
mmc erase failed
0 blocks erased: ERROR

eMMC test:

=> mmc dev 2
switch to partitions #0, OK
mmc2(part 0) is current device
=> 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
=>

Could it be a silicon revision issue?
My CPU is i.MX6Q rev1.2.

I tested on two SABRESD units with similar results.
In the second board, erasing the SD card (mmc erase 4000 1000) occasionally works (it takes around 30 seconds). But the rest of times fails after a random number of blocks:
=> mmc erase 4000 1000

MMC erase: dev # 1, block # 16384, count 4096 ... Timeout waiting for DAT0 to go high!
mmc erase failed
1412 blocks erased: ERROR

The eMMC however *always* fails in both SABRESD boards (and in my custom board) after erasing sector #0.
My eMMC is v4.5 and SABRESD is v4.4.1, but both of them fail:

=> mmcinfo (SABRE)
Device: FSL_SDHC
Manufacturer ID: 45
OEM: 100
Name: SEM08
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.4.1
High Capacity: Yes
Capacity: 7.4 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 16 MiB
User Capacity: 7.4 GiB WRREL
Boot Capacity: 2 MiB ENH
RPMB Capacity: 128 KiB ENH

=> mmcinfo (custom board)
Device: FSL_SDHC
Manufacturer ID: fe
OEM: 14e
Name: P1XXX
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.5
High Capacity: Yes
Capacity: 3.6 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 4 MiB
User Capacity: 3.6 GiB
Boot Capacity: 16 MiB ENH
RPMB Capacity: 128 KiB ENH

Regards,
--
H?ctor Palacios