Merge tag 'u-boot-imx-20220919' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
authorTom Rini <trini@konsulko.com>
Mon, 19 Sep 2022 12:38:32 +0000 (08:38 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 19 Sep 2022 12:38:32 +0000 (08:38 -0400)
u-boot-imx-20220919
-------------------

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/13500

- Fix imx8mn-beacon-kit-u-boot
- Merged Purism
- imxrt1170 (already merged in u-boot-imx)
- Fixes in crypto FSL
- Toradex : fixes Verdin
- Serial Driver: fixes when not used as console
- DH Boards : fixes + USB
- Fix CONFIG_SYS_MALLOC_F_LEN (Kconfig)
- Add imx6ulz_smm_m2

13 files changed:
Makefile
arch/powerpc/Kconfig
arch/powerpc/cpu/mpc85xx/Kconfig
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
arch/powerpc/dts/kmcent2-u-boot.dtsi
arch/powerpc/dts/u-boot.dtsi
board/freescale/p1_p2_rdb_pc/README
board/freescale/p2041rdb/README
board/freescale/t102xrdb/README
board/freescale/t104xrdb/README
board/freescale/t208xqds/README
board/freescale/t208xrdb/README
drivers/mmc/fsl_esdhc_spl.c

index 65aca6e..1f59db9 100644 (file)
--- 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_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
 u-boot.bin: u-boot-dtb.bin FORCE
        $(call if_changed,copy)
-else
+endif
+
+else ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
 u-boot.bin: u-boot-nodtb.bin FORCE
        $(call if_changed,copy)
 endif
@@ -1267,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}') ; \
@@ -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) \
@@ -1603,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-with-dtb.bin: u-boot.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)) \
@@ -1670,12 +1662,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
index 2cb5dae..3b518c2 100644 (file)
@@ -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
index 085ddd8..27f069a 100644 (file)
@@ -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
index e881537..f28826c 100644 (file)
@@ -58,10 +58,17 @@ SECTIONS
        __ex_table : { *(__ex_table) }
        __stop___ex_table = .;
 
-       . = ALIGN(8);
+       . = ALIGN(4);
        __init_begin = .;
        __init_end = .;
        _end = .;
+
+#if CONFIG_IS_ENABLED(SYS_MPC85XX_NO_RESETVEC)
+#if defined(CONFIG_SDCARD) && !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_SDCARD) && !defined(CONFIG_SYS_MMC_U_BOOT_OFFS)
+       mmc_u_boot_offs = .;
+#endif
 #endif
 
 #ifndef CONFIG_SPL_SKIP_RELOCATE
index ab76a9f..eeaa688 100644 (file)
@@ -76,7 +76,7 @@
        };
 
        binman {
-               filename = "u-boot-with-dtb.bin";
+               filename = "u-boot.bin";
                skip-at-start = <CONFIG_SYS_TEXT_BASE>;
                sort-by-offset;
                pad-byte = <0xff>;
index 67de476..6588bb7 100644 (file)
@@ -5,9 +5,11 @@
 
 #include <config.h>
 
+#if defined(CONFIG_MPC85XX_HAVE_RESET_VECTOR) && defined(CONFIG_OF_SEPARATE)
+
 / {
        binman {
-               filename = "u-boot-with-dtb.bin";
+               filename = "u-boot.bin";
                skip-at-start = <CONFIG_SYS_TEXT_BASE>;
                sort-by-offset;
                pad-byte = <0xff>;
                };
 
                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
index 86ff04e..f542dec 100644 (file)
@@ -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.
index 79f77e4..96612da 100644 (file)
@@ -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
index 84deb95..de170f5 100644 (file)
@@ -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
index 09cb98e..e90dca4 100644 (file)
@@ -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.
index 75d3173..63953d6 100755 (executable)
@@ -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.
index c4bfd3b..60551f6 100644 (file)
@@ -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.
index 760f13d..aa00d7e 100644 (file)
@@ -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
@@ -58,10 +62,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 +87,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 +96,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);
@@ -149,23 +153,44 @@ 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
        */
        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