imx: kontron-sl-mx8mm: Adjust offset for U-Boot proper in case of eMMC fastboot
PATCH 1/2 imx: kontron-sl-mx8mm: Adjust offset for U-Boot proper in case of eMMC fastboot
From: Frieder Schrempf <[email protected]>
The image offset on SD/MMC devices is 33 KiB, except for eMMC boot if fastboot is enabled. In this case it is 1 KiB. In order to make the the bootloader universal, check the fastboot OTP boot fuse and adjust the offset.
--- board/kontron/sl-mx8mm/spl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
board/kontron/sl-mx8mm/spl.c +20 -0
@@ -186,6 +186,26 @@ static int power_init_board(void)return 0 ; } +unsigned long board_spl_mmc_get_uboot_raw_sector (struct mmc *mmc,unsigned long raw_sect) +{ +/* +* The image offset on SD/MMC devices is 33 KiB, except for eMMC boot if +* fastboot is enabled. In this case it is 1 KiB. In order to make the +* bootloader universal, check the fastboot OTP boot fuse and adjust +* the offset. +*/ +if (!IS_SD (mmc) && (readl (OCOTP_BASE_ADDR +0x470 ) &0x80 )) { +switch (EXT_CSD_EXTRACT_BOOT_PART (mmc->part_config)) { +case EMMC_BOOT_PART_BOOT1 : +case EMMC_BOOT_PART_BOOT2 : + raw_sect -=32 *2 ; +break ; + } + } + +return raw_sect; +} +void board_init_f (ulong dummy) {int ret;
Signature · 1 line
2.51.0
PATCH 2/2 imx: kontron-sl-mx8mm: Implement spl_board_loader_name()
From: Frieder Schrempf <[email protected]>
This allows to print user-friendly names for the boot device probed by SPL to the console.
--- board/kontron/sl-mx8mm/spl.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
board/kontron/sl-mx8mm/spl.c +27 -0
@@ -206,6 +206,33 @@ unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned longreturn raw_sect; } +const char *spl_board_loader_name (u32 boot_device) +{ +static char name[16 ]; +struct mmc *mmc; + +switch (boot_device) { +case BOOT_DEVICE_SPI : +sprintf (name,"SPI NOR" ); +return name; +case BOOT_DEVICE_MMC1 : +mmc_init_device (0 ); + mmc =find_mmc_device (0 ); +mmc_init (mmc); +snprintf (name,sizeof (name),"eMMC %s" , + emmc_hwpart_names[EXT_CSD_EXTRACT_BOOT_PART (mmc->part_config)]); +return name; +case BOOT_DEVICE_MMC2 : +sprintf (name,"SD card" ); +return name; +case BOOT_DEVICE_BOARD : +sprintf (name,"USB OTG" ); +return name; + } + +return NULL ; +} +void board_init_f (ulong dummy) {int ret;
Signature · 1 line
2.51.0
Fabio Estevam
AppliedQuoted 9 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
The image offset on SD/MMC devices is 33 KiB, except for eMMC boot if fastboot is enabled. In this case it is 1 KiB. In order to make the the bootloader universal, check the fastboot OTP boot fuse and adjust the offset.
Signed-off-by Frieder Schrempf <[email protected]>
Applied the series, thanks.