I add some debug print in the mmc_bread function of /drivers/mmc/mmc.c
#ifdef CONFIG_BLK
static ulong mmc_bread(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
void *dst)
#else
static ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, void *dst)
#endif
{
#ifdef CONFIG_BLK
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
#endif
int dev_num = block_dev->devnum;
int err;
lbaint_t cur, blocks_todo = blkcnt;
unsigned long time;
if (blkcnt == 0)
return 0;
struct mmc *mmc = find_mmc_device(dev_num);
if (!mmc)
return 0;
err = blk_dselect_hwpart(block_dev, block_dev->hwpart);
if (err < 0)
return 0;
if ((start + blkcnt) > block_dev->lba) {
#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
printf("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
start + blkcnt, block_dev->lba);
#endif
return 0;
}
printf("<%d>mmc_bread blocks_todo = %lu start = %lu",
dev_num,
blocks_todo,
start);
if (mmc_set_blocklen(mmc, mmc->read_bl_len)) {
debug("%s: Failed to set blocklen\n", __func__);
return 0;
}
time = get_timer(0);
do {
cur = (blocks_todo > mmc->cfg->b_max) ?
mmc->cfg->b_max : blocks_todo;
if (mmc_read_blocks(mmc, dst, start, cur) != cur)
{
debug("%s: Failed to read blocks\n", __func__);
return 0;
}
blocks_todo -= cur;
start += cur;
dst += cur * mmc->read_bl_len;
} while (blocks_todo > 0);
time = get_timer(time);
printf("use %lu ms\n",time);
return blkcnt;
}
on the U-Boot command line running following command:
set devtype mmc
run scan_dev_for_boot_part
I get as following serial boot log:
…
<0>mmc_bread blocks_todo = 1 start = 17043889use 1 ms
filename:/boot/extlinux/extlinux.conf addr:2185232384
213 bytes read in 166 ms (1000 Bytes/s)
p2771-0000 eMMC boot options
1: primary kernel
Enter choice: 1: primary kernel
Retrieving file: /boot/Image addr_buf: ffb28220
…
<0>mmc_bread blocks_todo = 1 start = 1use 2 ms
<0>mmc_bread blocks_todo = 8 start = 2use 3 ms
<0>mmc_bread blocks_todo = 1 start = 4097use 2 ms
<0>mmc_bread blocks_todo = 2 start = 4099use 3 ms
<0>mmc_bread blocks_todo = 1 start = 4105use 2 ms
<0>mmc_bread blocks_todo = 1 start = 12553use 2 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 1 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 2 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 2 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 2 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 1 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 2 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 2 ms
<0>mmc_bread blocks_todo = 1 start = 78089use 2 ms
<0>mmc_bread blocks_todo = 1 start = 4109use 2 ms
<0>mmc_bread blocks_todo = 1 start = 16781569use 2 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 2 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 1 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 2 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 1 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 2 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 1 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 2 ms
<0>mmc_bread blocks_todo = 1 start = 16847105use 2 ms
<0>mmc_bread blocks_todo = 1 start = 4109use 2 ms
…
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 2 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 2 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 2 ms
<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms
<0>mmc_bread blocks_todo = 1376 start = 1415169use 19 ms
<0>mmc_bread blocks_todo = 2 start = 1401505use 2 ms
<0>mmc_bread blocks_todo = 1 start = 1401507use 2 ms
filename:/boot/Image addr:2148007936
21423296 bytes read in 34753 ms (601.6 KiB/s)
append: root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 OS=l4t fbcon=map:0 net.ifnames=0 memtype=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x03100000 nvdumper_reserved=0x2772e0000 gpt tegra_fbmem2=0x800000@0x969ed000 lut_mem2=0x2008@0x969ea000 tegraid=18.1.2.0.0 tegra_keep_boot_clocks maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.2.1 androidboot.serialno=0420819050367 bl_prof_dataptr=0x10000@0x277040000 sdhci_tegra.en_boot_part_access=1 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4
boot_get_fdt argc = 3select 92000000
Flattened Device Tree blob at 92000000
Booting using the fdt blob at 0x92000000
reserving fdt memory region: addr=80000000 size=10000
Using Device Tree in place at 0000000092000000, end 000000009203baab
…
this type message "<0>mmc_bread blocks_todo = 8 start = 17090473use 3 ms" repeat almost 5000 times.
It seem like there are many same address(such as block start number 17090473) access.
For this board(slowly start-up), I have installed some software package.
If I use the entire flash command to re-flash this board, the issues will go away.
Can you give me any suggestion on how to fix the issues ?