aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPali Rohár2022-08-05 22:09:41 +0200
committerMarek Behún2022-09-16 18:46:14 +0200
commit5a428e751044525f95d15f180188cc7433648b82 (patch)
tree67f1eeffebf3c13ff1b6380eca1dfa422577e3ac /drivers/mmc
parent7696b80ec5e90ec3c2fa759cfe129918ce0e0a26 (diff)
mmc: fsl_esdhc_spl: Add support for builds without CONFIG_SYS_MMC_U_BOOT_OFFS
When fixed offset via CONFIG_SYS_MMC_U_BOOT_OFFS is not specified then expects that U-Boot proper is placed immediately after SPL without any additional padding. This allows to generate smaller SPL+U-Boot final binary as it is not required to specify fixed offset to U-Boot proper at SPL compile time. In this case offset to U-Boot proper is calculated at SPL compile time in linker script. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Marek Behún <kabel@kernel.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/fsl_esdhc_spl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c
index dd6d5fa81ea..aa00d7e2014 100644
--- a/drivers/mmc/fsl_esdhc_spl.c
+++ b/drivers/mmc/fsl_esdhc_spl.c
@@ -9,6 +9,10 @@
#include <mmc.h>
#include <malloc.h>
+#ifndef CONFIG_SYS_MMC_U_BOOT_OFFS
+extern uchar mmc_u_boot_offs[];
+#endif
+
/*
* The environment variables are written to just after the u-boot image
* on SDCard, so we must read the MBR to get the start address and code
@@ -149,8 +153,12 @@ again:
val = *(tmp_buf + blk_off + ESDHC_BOOT_IMAGE_ADDR + i);
offset = (offset << 8) + val;
}
+#ifndef CONFIG_SYS_MMC_U_BOOT_OFFS
+ offset += (ulong)&mmc_u_boot_offs - CONFIG_SPL_TEXT_BASE;
+#else
offset += CONFIG_SYS_MMC_U_BOOT_OFFS;
#endif
+#endif
/*
* Load U-Boot image from mmc into RAM
*/