View Issue Details

IDProjectCategoryView StatusLast Update
0004899UBootU-Bootpublic2021-10-05 12:24
Reporterderksen Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Target Versionfsimx8mm-Y2021.04Fixed in Versionfsimx8mm-Y2021.04 
Summary0004899: fsimx8mm: Add MMC loading/saving, refactor fsimage code
Descriptionfsimx8mm: Add MMC loading/saving, refactor fsimage code

Move the code for the fsimage commands directly to cmd/fsimage.c. Now
board/F+S/common/fs_image_common.[ch] only contains some generic helper
functions and the state machine for loading BOARD-CFG and FIRMWARE in
SPL. This means we have to provide some function signatures, the F&S
header struct and a few more items in fs_image_common.h.

We need fs_board_get_name_from_boot_dev() also in SPL, so move the code
in fs_board_common.c to the correct section.

Have a rather simple initialization for legacy MMC with only the two
functions board_mmc_init() and board_mmc_getcd() in our spl.c. Remove
the old stuff that used fs_mmc_common.c.

When the system is booted from NAND/eMMC, then BOARD-CFG and FIRMWARE
always need to be loaded both from the current boot device. Only when
the system boots from USB, we may need to load a BOARD-CFG from the
fused boot device first. So re-arrange the loader code in spl.c. This
shows that we do not need the FSIMG_JOB_* values in spl.c anymore, so
move them from fs_image_common.h to fs_image_common.c.

The MMC code in SPL can only load data with MMC block granularity, i.e.
only starting on a block boundary and only in multiples of 512 bytes.
But when we add a more generic function fs_image_gen_load_mmc() to
fs_image_common.c that can load data from arbitrary offsets and with
arbitrary size from MMC, simliar to nand_spl_load_image(), we can
see that the code for loading from NAND and loading from MMC is nearly
identical. So we can collapse both variants. This makes the code for
loading BOARD-CFG and FIRMWARE from NAND and MMC very simple now.

Add functions fs_image_get_storage_info() and fs_image_get_storage_size()
to load an array of start entries and a size entry from nboot-info. These
functions together with a new struct storage_info simplify the nboot-info
access considerably.

In cmd/fsimage.c, add an implementation to load FIRMWARE from MMC to DRAM
and to save an NBoot image from DRAM to MMC.

In case of NAND, also check if MTD partitions for UBoot match the values
in nboot-info.

Activate writing of the fuses in command fsimage fuse.

Set CONFIG_CMD_MMC in fsimx8mm_defconfig, otherwise it is not visible
at some places in fsimx8mm.h. Remove fsimx8mm_mmc_defconfig, it is not
needed anymore.
Forum Link


There are no notes attached to this issue.