From d6c5bdb8794f5ee1b4f332f717ceed32a4510366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 1 Aug 2022 17:42:19 +0200 Subject: Makefile: Fix dependency for u-boot-with-dtb.bin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makefile uses binman to produce u-boot-with-dtb.bin target. As its input it takes DTB file and u-boot binary without DTB, which is stored in file u-boot-nodtb.bin. So fix target dependency. Signed-off-by: Pali Rohár Reviewed-by: Tom Rini Reviewed-by: Simon Glass Signed-off-by: Marek Behún --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 65aca6e3e7..0d3d80e45c 100644 --- a/Makefile +++ b/Makefile @@ -1604,7 +1604,7 @@ u-boot-with-nand-spl.sfp: u-boot-spl-padx4.sfp u-boot.img FORCE endif ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) -u-boot-with-dtb.bin: u-boot.bin u-boot.dtb \ +u-boot-with-dtb.bin: u-boot-nodtb.bin u-boot.dtb \ $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR), u-boot-br.bin) FORCE $(call if_changed,binman) -- cgit v1.2.3 From d8fa0a76681af3ecea3941f5c743332dd76c7543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 1 Aug 2022 17:42:20 +0200 Subject: Makefile: Build final mpc85xx non-SPL image in standard file u-boot.bin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently Makefile produces final mpc85xx image when SPL is not used in custom file u-boot-with-dtb.bin. It is quite confusing name as build process produce also intermediate file standard file u-boot-dtb.bin (which is just intermediate and not bootable). Other platforms use u-boot.bin (UBOOT_BIN) as standard name for final bootable raw image. So change Makefile rules and binman to produce final bootable file for mpc85xx also into file u-boot.bin. There is just need for mpc85xx to not define default rule for u-boot.bin then instruct binman (via DTS file) to store final image into u-boot.bin (instead of u-boot-with-dtb.bin) and finally rename target u-boot-with-dtb.bin to u-boot.bin. With this change are also removed custom Makefile hacks for mpc85xx that it produced non-standard output file. And also updated documentation. Signed-off-by: Pali Rohár Reviewed-by: Tom Rini Signed-off-by: Marek Behún --- Makefile | 19 +++++-------------- arch/powerpc/dts/kmcent2-u-boot.dtsi | 2 +- arch/powerpc/dts/u-boot.dtsi | 2 +- board/freescale/p1_p2_rdb_pc/README | 2 +- board/freescale/p2041rdb/README | 3 --- board/freescale/t102xrdb/README | 2 +- board/freescale/t104xrdb/README | 2 +- board/freescale/t208xqds/README | 2 +- board/freescale/t208xrdb/README | 2 +- 9 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 0d3d80e45c..b1dc7850e3 100644 --- a/Makefile +++ b/Makefile @@ -997,10 +997,6 @@ ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy) INPUTS-y += init_sp_bss_offset_check endif -ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) -INPUTS-y += u-boot-with-dtb.bin -endif - ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy) # Binman image dependencies ifeq ($(CONFIG_ARM64),y) @@ -1217,9 +1213,12 @@ else ifeq ($(CONFIG_OF_SEPARATE).$(CONFIG_OF_OMIT_DTB),y.) u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE $(call if_changed,cat) +ifneq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) u-boot.bin: u-boot-dtb.bin FORCE $(call if_changed,copy) -else +endif + +else ifneq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) u-boot.bin: u-boot-nodtb.bin FORCE $(call if_changed,copy) endif @@ -1432,11 +1431,7 @@ MKIMAGEFLAGS_u-boot-spl.kwb = -n $(KWD_CONFIG_FILE) \ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -A $(ARCH) -T pblimage -ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) -UBOOT_BIN := u-boot-with-dtb.bin -else UBOOT_BIN := u-boot.bin -endif MKIMAGEFLAGS_u-boot-lzma.img = -A $(ARCH) -T standalone -C lzma -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ @@ -1604,7 +1599,7 @@ u-boot-with-nand-spl.sfp: u-boot-spl-padx4.sfp u-boot.img FORCE endif ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) -u-boot-with-dtb.bin: u-boot-nodtb.bin u-boot.dtb \ +u-boot.bin: u-boot-nodtb.bin u-boot.dtb \ $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR), u-boot-br.bin) FORCE $(call if_changed,binman) @@ -1670,12 +1665,8 @@ spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE ifeq ($(ARCH),arm) UBOOT_BINLOAD := u-boot.img else -ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) -UBOOT_BINLOAD := u-boot-with-dtb.bin -else UBOOT_BINLOAD := u-boot.bin endif -endif OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ --gap-fill=0xff diff --git a/arch/powerpc/dts/kmcent2-u-boot.dtsi b/arch/powerpc/dts/kmcent2-u-boot.dtsi index ab76a9f122..eeaa688b65 100644 --- a/arch/powerpc/dts/kmcent2-u-boot.dtsi +++ b/arch/powerpc/dts/kmcent2-u-boot.dtsi @@ -76,7 +76,7 @@ }; binman { - filename = "u-boot-with-dtb.bin"; + filename = "u-boot.bin"; skip-at-start = ; sort-by-offset; pad-byte = <0xff>; diff --git a/arch/powerpc/dts/u-boot.dtsi b/arch/powerpc/dts/u-boot.dtsi index 67de476a45..0251afddca 100644 --- a/arch/powerpc/dts/u-boot.dtsi +++ b/arch/powerpc/dts/u-boot.dtsi @@ -7,7 +7,7 @@ / { binman { - filename = "u-boot-with-dtb.bin"; + filename = "u-boot.bin"; skip-at-start = ; sort-by-offset; pad-byte = <0xff>; diff --git a/board/freescale/p1_p2_rdb_pc/README b/board/freescale/p1_p2_rdb_pc/README index 86ff04e69d..f542decec7 100644 --- a/board/freescale/p1_p2_rdb_pc/README +++ b/board/freescale/p1_p2_rdb_pc/README @@ -60,5 +60,5 @@ enabled in relative defconfig file, CONFIG_RESET_VECTOR_ADDRESS - 0xffc If device tree support is enabled in defconfig, -1. use 'u-boot-with-dtb.bin' for NOR boot. +1. use 'u-boot.bin' for NOR boot. 2. use 'u-boot-with-spl.bin' for other boot. diff --git a/board/freescale/p2041rdb/README b/board/freescale/p2041rdb/README index 79f77e4961..96612daeeb 100644 --- a/board/freescale/p2041rdb/README +++ b/board/freescale/p2041rdb/README @@ -100,9 +100,6 @@ enabled in relative defconfig file, 3. CONFIG_MPC85XX_HAVE_RESET_VECTOR if reset vector is located at CONFIG_RESET_VECTOR_ADDRESS - 0xffc -If device tree support is enabled in defconfig, use 'u-boot-with-dtb.bin' -instead of u-boot.bin for all boot. - CPLD command ============ The CPLD is used to control the power sequence and some serdes lane diff --git a/board/freescale/t102xrdb/README b/board/freescale/t102xrdb/README index 84deb9562a..de170f52b4 100644 --- a/board/freescale/t102xrdb/README +++ b/board/freescale/t102xrdb/README @@ -267,7 +267,7 @@ enabled in relative defconfig file, config_reset_vector_address - 0xffc if device tree support is enabled in defconfig, -1. use 'u-boot-with-dtb.bin' for nor boot. +1. use 'u-boot.bin' for nor boot. 2. use 'u-boot-with-spl-pbl.bin' for other boot. 2-stage NAND/SPI/SD boot loader diff --git a/board/freescale/t104xrdb/README b/board/freescale/t104xrdb/README index 09cb98e33d..e90dca4166 100644 --- a/board/freescale/t104xrdb/README +++ b/board/freescale/t104xrdb/README @@ -382,5 +382,5 @@ enabled in relative defconfig file, CONFIG_RESET_VECTOR_ADDRESS - 0xffc If device tree support is enabled in defconfig, -1. use 'u-boot-with-dtb.bin' for NOR boot. +1. use 'u-boot.bin' for NOR boot. 2. use 'u-boot-with-spl-pbl.bin' for other boot. diff --git a/board/freescale/t208xqds/README b/board/freescale/t208xqds/README index 75d317342f..63953d6b9b 100755 --- a/board/freescale/t208xqds/README +++ b/board/freescale/t208xqds/README @@ -288,5 +288,5 @@ enabled in relative defconfig file, CONFIG_RESET_VECTOR_ADDRESS - 0xffc If device tree support is enabled in defconfig, -1. use 'u-boot-with-dtb.bin' for NOR boot. +1. use 'u-boot.bin' for NOR boot. 2. use 'u-boot-with-spl-pbl.bin' for other boot. diff --git a/board/freescale/t208xrdb/README b/board/freescale/t208xrdb/README index c4bfd3b466..60551f6723 100644 --- a/board/freescale/t208xrdb/README +++ b/board/freescale/t208xrdb/README @@ -284,5 +284,5 @@ enabled in relative defconfig file, CONFIG_RESET_VECTOR_ADDRESS - 0xffc If device tree support is enabled in defconfig, -1. use 'u-boot-with-dtb.bin' for NOR boot. +1. use 'u-boot.bin' for NOR boot. 2. use 'u-boot-with-spl-pbl.bin' for other boot. -- cgit v1.2.3 From 5af42eafd7e132ba36740e6438ee5e6fac2062ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 3 Aug 2022 13:24:42 +0200 Subject: Makefile: Reduce usage of custom mpc85xx u-boot.bin target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building of final u-boot.bin binary for mpc85xx via binman is needed only when inserting DTB binary in the middle of the u-boot ELF binary (before .bootpg and .resetvec ELF sections). These requirements are met when CONFIG_MPC85XX_HAVE_RESET_VECTOR is enabled (= generating .bootpg/.resetvec sections) and CONFIG_OF_SEPARATE is enabled (= inserting DTB binary). So in all other cases use standard build procedure instead of custom mpc85xx u-boot.bin Makefile target via binman. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- Makefile | 11 ++++------- arch/powerpc/Kconfig | 2 +- arch/powerpc/dts/u-boot.dtsi | 8 ++++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index b1dc7850e3..11662c535b 100644 --- a/Makefile +++ b/Makefile @@ -1213,12 +1213,12 @@ else ifeq ($(CONFIG_OF_SEPARATE).$(CONFIG_OF_OMIT_DTB),y.) u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE $(call if_changed,cat) -ifneq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) +ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) u-boot.bin: u-boot-dtb.bin FORCE $(call if_changed,copy) endif -else ifneq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) +else ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) u-boot.bin: u-boot-nodtb.bin FORCE $(call if_changed,copy) endif @@ -1598,17 +1598,14 @@ u-boot-with-nand-spl.sfp: u-boot-spl-padx4.sfp u-boot.img FORCE endif -ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) -u-boot.bin: u-boot-nodtb.bin u-boot.dtb \ - $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR), u-boot-br.bin) FORCE +ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy) +u-boot.bin: u-boot-nodtb.bin u-boot.dtb u-boot-br.bin FORCE $(call if_changed,binman) -ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR),y) OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec u-boot-br.bin: u-boot FORCE $(call if_changed,objcopy) endif -endif quiet_cmd_ldr = LD $@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 2cb5dae736..3b518c2695 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -21,7 +21,7 @@ config MPC85xx select SYS_FSL_DDR select SYS_FSL_DDR_BE select SYS_FSL_IFC_BE - select BINMAN if OF_SEPARATE + select BINMAN if MPC85XX_HAVE_RESET_VECTOR && OF_SEPARATE imply CMD_HASH imply CMD_IRQ imply USB_EHCI_HCD if USB diff --git a/arch/powerpc/dts/u-boot.dtsi b/arch/powerpc/dts/u-boot.dtsi index 0251afddca..6588bb7fa5 100644 --- a/arch/powerpc/dts/u-boot.dtsi +++ b/arch/powerpc/dts/u-boot.dtsi @@ -5,6 +5,8 @@ #include +#if defined(CONFIG_MPC85XX_HAVE_RESET_VECTOR) && defined(CONFIG_OF_SEPARATE) + / { binman { filename = "u-boot.bin"; @@ -19,17 +21,15 @@ }; u-boot-dtb-with-ucode { -#ifdef CONFIG_MPC85xx align = <4>; -#endif }; -#ifdef CONFIG_MPC85XX_HAVE_RESET_VECTOR #ifndef CONFIG_RESET_VECTOR_ADDRESS #define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc #endif powerpc-mpc85xx-bootpg-resetvec { offset = <(CONFIG_RESET_VECTOR_ADDRESS - 0xffc)>; }; -#endif }; }; + +#endif -- cgit v1.2.3 From e507be9ac62a44e6a796bb6272c6b43fb4b7fb50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 3 Aug 2022 23:56:55 +0200 Subject: Makefile: Unify condition for mpc85xx reset vector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use 'CONFIG_MPC85XX_HAVE_RESET_VECTOR && CONFIG_OF_SEPARATE' pattern instead of 'CONFIG_MPC85XX_HAVE_RESET_VECTOR && !CONFIG_OF_EMBED' also in OBJCOPYFLAGS_u-boot-nodtb.bin as this pattern is used in rest of Makefile. Signed-off-by: Pali Rohár Reviewed-by: Simon Glass Signed-off-by: Marek Behún --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 11662c535b..1f59db9c18 100644 --- a/Makefile +++ b/Makefile @@ -1266,7 +1266,7 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \ - $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if $(CONFIG_OF_EMBED),,-R .bootpg -R .resetvec)) + $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if $(CONFIG_OF_SEPARATE),-R .bootpg -R .resetvec)) binary_size_check: u-boot-nodtb.bin FORCE @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ -- cgit v1.2.3 From 1e1d12adbc7bad37ea42351835ba864d5089f76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 15 Sep 2022 16:08:27 +0200 Subject: powerpc: mpc85xx: Fix check for CONFIG_SDCARD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit d433c74eecdc ("Convert CONFIG_SDCARD et al to Kconfig") converted SYS_EXTRA_OPTIONS=SDCARD or SPIFLASH to config options CONFIG_SDCARD and CONFIG_SPIFLASH, but left one occurance unchanged. Fix this. Fixes: d433c74eecdc ("Convert CONFIG_SDCARD et al to Kconfig") Signed-off-by: Marek Behún Reviewed-by: Pali Rohár --- arch/powerpc/cpu/mpc85xx/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig index 085ddd8439..27f069a1fb 100644 --- a/arch/powerpc/cpu/mpc85xx/Kconfig +++ b/arch/powerpc/cpu/mpc85xx/Kconfig @@ -15,7 +15,7 @@ config CMD_ERRATA config FSL_PREPBL_ESDHC_BOOT_SECTOR bool "Generate QorIQ pre-PBL eSDHC boot sector" depends on MPC85xx - depends on SYS_EXTRA_OPTIONS = SDCARD + depends on SDCARD help With this option final image would have prepended QorIQ pre-PBL eSDHC boot sector suitable for SD card images. This boot sector instruct -- cgit v1.2.3 From 04e9cd7a98e7620a694e729c45e2d4aeb9317f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 5 Aug 2022 22:09:39 +0200 Subject: mmc: fsl_esdhc_spl: Add support for loading proper U-Boot from unaligned location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to concatenate SPL and proper U-Boot without extra alignment. Signed-off-by: Pali Rohár Reviewed-by: Jaehoon Chung Signed-off-by: Marek Behún --- drivers/mmc/fsl_esdhc_spl.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c index 760f13d240..dd6d5fa81e 100644 --- a/drivers/mmc/fsl_esdhc_spl.c +++ b/drivers/mmc/fsl_esdhc_spl.c @@ -58,10 +58,10 @@ void __noreturn mmc_boot(void) { __attribute__((noreturn)) void (*uboot)(void); uint blk_start, blk_cnt, err; -#ifndef CONFIG_FSL_CORENET uchar *tmp_buf; u32 blklen; u32 blk_off; +#ifndef CONFIG_FSL_CORENET uchar val; #ifndef CONFIG_SPL_FSL_PBL u32 val32; @@ -83,9 +83,6 @@ void __noreturn mmc_boot(void) hang(); } -#ifdef CONFIG_FSL_CORENET - offset = CONFIG_SYS_MMC_U_BOOT_OFFS; -#else blklen = mmc->read_bl_len; if (blklen < 512) blklen = 512; @@ -95,6 +92,9 @@ void __noreturn mmc_boot(void) hang(); } +#ifdef CONFIG_FSL_CORENET + offset = CONFIG_SYS_MMC_U_BOOT_OFFS; +#else sector = 0; again: memset(tmp_buf, 0, blklen); @@ -155,17 +155,34 @@ again: * Load U-Boot image from mmc into RAM */ code_len = CONFIG_SYS_MMC_U_BOOT_SIZE; - blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len; - blk_cnt = ALIGN(code_len, mmc->read_bl_len) / mmc->read_bl_len; + blk_start = offset / mmc->read_bl_len; + blk_off = offset % mmc->read_bl_len; + blk_cnt = ALIGN(code_len, mmc->read_bl_len) / mmc->read_bl_len + 1; + if (blk_off) { + err = mmc->block_dev.block_read(&mmc->block_dev, + blk_start, 1, tmp_buf); + if (err != 1) { + puts("spl: mmc read failed!!\n"); + hang(); + } + blk_start++; + } err = mmc->block_dev.block_read(&mmc->block_dev, blk_start, blk_cnt, - (uchar *)CONFIG_SYS_MMC_U_BOOT_DST); + (uchar *)CONFIG_SYS_MMC_U_BOOT_DST + + (blk_off ? (mmc->read_bl_len - blk_off) : 0)); if (err != blk_cnt) { puts("spl: mmc read failed!!\n"); -#ifndef CONFIG_FSL_CORENET free(tmp_buf); -#endif hang(); } + /* + * SDHC DMA may erase bytes at dst + bl_len - blk_off - 8 + * due to unaligned access. So copy leading bytes from tmp_buf + * after SDHC DMA transfer. + */ + if (blk_off) + memcpy((uchar *)CONFIG_SYS_MMC_U_BOOT_DST, + tmp_buf + blk_off, mmc->read_bl_len - blk_off); /* * Clean d-cache and invalidate i-cache, to -- cgit v1.2.3 From 7696b80ec5e90ec3c2fa759cfe129918ce0e0a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 5 Aug 2022 22:09:40 +0200 Subject: powerpc: mpc85xx: Fix loading U-Boot proper from SD card in SPL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change 8-byte alignment of SPL binary to just 4-byte alignment as objcopy trims trailing zero bytes when converting ELF file to RAW binary. This is same fix for SPL linker script as was done fix for U-Boot linker script in commit e8c0e0064c8a ("powerpc: mpc85xx: Fix CONFIG_OF_SEPARATE support"). It is required for the patch "mmc: fsl_esdhc_spl: Add support for builds without CONFIG_SYS_MMC_U_BOOT_OFFS" which triggered this issue in SPL. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds index e881537452..89df4b5f6f 100644 --- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds @@ -58,7 +58,7 @@ SECTIONS __ex_table : { *(__ex_table) } __stop___ex_table = .; - . = ALIGN(8); + . = ALIGN(4); __init_begin = .; __init_end = .; _end = .; -- cgit v1.2.3 From 5a428e751044525f95d15f180188cc7433648b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 5 Aug 2022 22:09:41 +0200 Subject: mmc: fsl_esdhc_spl: Add support for builds without CONFIG_SYS_MMC_U_BOOT_OFFS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jaehoon Chung Signed-off-by: Marek Behún --- arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 10 ++++++++++ drivers/mmc/fsl_esdhc_spl.c | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds index 89df4b5f6f..a36aa1793d 100644 --- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds @@ -62,6 +62,13 @@ SECTIONS __init_begin = .; __init_end = .; _end = .; + +#ifndef KEEP_RESET_VECTOR +#if defined(CONFIG_SD_BOOT) && !defined(CONFIG_SYS_MMC_U_BOOT_OFFS) + mmc_u_boot_offs = .; +#endif +#endif + #ifdef CONFIG_SPL_SKIP_RELOCATE . = ALIGN(4); __bss_start = .; @@ -94,6 +101,9 @@ SECTIONS .resetvec IMAGE_TEXT_BASE + RESET_VECTOR_OFFSET : { KEEP(*(.resetvec)) } = 0xffff +#if defined(CONFIG_SD_BOOT) && !defined(CONFIG_SYS_MMC_U_BOOT_OFFS) + mmc_u_boot_offs = .; +#endif #endif #ifndef CONFIG_SPL_SKIP_RELOCATE diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c index dd6d5fa81e..aa00d7e201 100644 --- a/drivers/mmc/fsl_esdhc_spl.c +++ b/drivers/mmc/fsl_esdhc_spl.c @@ -9,6 +9,10 @@ #include #include +#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,7 +153,11 @@ 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 -- cgit v1.2.3