eMMC errors on RK3588 (rock5b)

Jonas Karlman jonas at kwiboo.se
Mon May 29 22:43:45 CEST 2023


Hi again,
On 2023-05-29 17:27, Jonas Karlman wrote:
> Hi Eugen,
> 
> On 2023-05-25 11:23, Eugen Hristev wrote:
>> Hi Jonas,
>>
>> I tried some basic eMMC read/write commands, and in my setup with 
>> rock5b, it fails at single/multiple block read/write , even if 
>> sometimes, the initial read works fine.
>>
>> Here is some log :
>>
>> => mmc read 0x50000000 64 1
> [snip]
>> MMC read: dev # 0, block # 100, count 1 ...
>> 1 blocks read: OK
>> => mmc write 0x50000000 64 1
>> MMC write: dev # 0, block # 100, count 1 ... 
> [snip]
>> 0 blocks written: ERROR
>> => mmc write 0x50000000 64 5
>> MMC write: dev # 0, block # 100, count 5 ...
> [snip]
>> 0 blocks written: ERROR
>> => mmc read 0x50000000 64 5
>> MMC read: dev # 0, block # 100, count 5 ...
> [snip]
>> 0 blocks read: ERROR
>> => mmc read 0x50000000 64 1
> [snip]
>> MMC read: dev # 0, block # 100, count 1 ...
>> 0 blocks read: ERROR
>> =>
>>
>> So now after this attempt, there is a timeout when reading too.
>>
>> Can you try to reproduce this on your setup as well ?
> 
> I was able to reproduce similar issue on rk356x, did not test on rk3588
> yet. Also going to try similar write commands on the rk3399 (arasan)
> compatible of the rk sdhci driver, guess both rk35xx (dwc) compatible is
> affected.

I tested on rk3399 and there was no problem loading u-boot-rockchip.bin
from SD-card and writing it to eMMC using the following commands:

Load u-boot-rockchip.bin to @512 MiB DRAM from SD-card:
=> load mmc 1:1 20000000 u-boot-rockchip.bin
9264128 bytes read in 402 ms (22 MiB/s)

Select eMMC device:
=> mmc dev 0
switch to partitions #0, OK
mmc0(part 0) is current device

Erase 12 MiB starting from sector 64:
=> mmc erase 40 6000
MMC erase: dev # 0, block # 64, count 24576 ... 24576 blocks erased: OK

Write 12 MiB from @512 MiB DRAM to sector 64:
=> mmc write 20000000 40 6000
MMC write: dev # 0, block # 64, count 24576 ... 24576 blocks written: OK

So something in controller or driver cause write issues on rk35xx.

> 
> Something odd that I noticed was that write sometime reported OK when
> a read command for same blocks was issued, e.g. something similar worked
> in some of my testing:
> 
> Select eMMC device to reset state:
> => mmc dev 0
> 
> Read 256KiB (TPL+SPL) from sector 64 to @512 MiB DRAM:
> => mmc read 20000000 40 200
> 
> Erase 256KiB from sector 64:
> => mmc erase 40 200
> 
> Write 256KiB (TPL+SPL) from @512 MiB DRAM to sector 64:
> => mmc write 20000000 40 200

Count param was in bytes in my prior mail, corrected to block count above.

Regards,
Jonas

> 
> After something fails the use of "mmc dev 0" could be used to reset into
> a working read state. Some retry/reset handling may be needed in driver
> to fully support write commands.
> 
> A quick peek at vendor u-boot: rk u-boot include some form of retry
> logic for write and hardkernel u-boot implement some sort of sw reset.
> 
> Regards,
> Jonas
> 
>>
>> P.S. booting from eMMC works fine. When I am trying this, I am booting 
>> from the eMMC.
>>
>> Thanks !
> 



More information about the U-Boot mailing list