This commit is contained in:
Tom Rini 2022-09-18 11:41:08 -04:00
commit 0b3fe2b977
13 changed files with 65 additions and 45 deletions

View File

@ -997,10 +997,6 @@ ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy)
INPUTS-y += init_sp_bss_offset_check INPUTS-y += init_sp_bss_offset_check
endif endif
ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
INPUTS-y += u-boot-with-dtb.bin
endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy) ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy)
# Binman image dependencies # Binman image dependencies
ifeq ($(CONFIG_ARM64),y) 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 u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
$(call if_changed,cat) $(call if_changed,cat)
ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
u-boot.bin: u-boot-dtb.bin FORCE u-boot.bin: u-boot-dtb.bin FORCE
$(call if_changed,copy) $(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 u-boot.bin: u-boot-nodtb.bin FORCE
$(call if_changed,copy) $(call if_changed,copy)
endif endif
@ -1267,7 +1266,7 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE
OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \ $(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 binary_size_check: u-boot-nodtb.bin FORCE
@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ @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:"%"=%) \ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -A $(ARCH) -T pblimage -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 UBOOT_BIN := u-boot.bin
endif
MKIMAGEFLAGS_u-boot-lzma.img = -A $(ARCH) -T standalone -C lzma -O u-boot \ MKIMAGEFLAGS_u-boot-lzma.img = -A $(ARCH) -T standalone -C lzma -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -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 endif
ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
u-boot-with-dtb.bin: u-boot.bin u-boot.dtb \ u-boot.bin: u-boot-nodtb.bin u-boot.dtb u-boot-br.bin FORCE
$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR), u-boot-br.bin) FORCE
$(call if_changed,binman) $(call if_changed,binman)
ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR),y)
OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec
u-boot-br.bin: u-boot FORCE u-boot-br.bin: u-boot FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
endif endif
endif
quiet_cmd_ldr = LD $@ quiet_cmd_ldr = LD $@
cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
@ -1670,12 +1662,8 @@ spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE
ifeq ($(ARCH),arm) ifeq ($(ARCH),arm)
UBOOT_BINLOAD := u-boot.img UBOOT_BINLOAD := u-boot.img
else else
ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
UBOOT_BINLOAD := u-boot-with-dtb.bin
else
UBOOT_BINLOAD := u-boot.bin UBOOT_BINLOAD := u-boot.bin
endif endif
endif
OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
--gap-fill=0xff --gap-fill=0xff

View File

@ -21,7 +21,7 @@ config MPC85xx
select SYS_FSL_DDR select SYS_FSL_DDR
select SYS_FSL_DDR_BE select SYS_FSL_DDR_BE
select SYS_FSL_IFC_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_HASH
imply CMD_IRQ imply CMD_IRQ
imply USB_EHCI_HCD if USB imply USB_EHCI_HCD if USB

View File

@ -15,7 +15,7 @@ config CMD_ERRATA
config FSL_PREPBL_ESDHC_BOOT_SECTOR config FSL_PREPBL_ESDHC_BOOT_SECTOR
bool "Generate QorIQ pre-PBL eSDHC boot sector" bool "Generate QorIQ pre-PBL eSDHC boot sector"
depends on MPC85xx depends on MPC85xx
depends on SYS_EXTRA_OPTIONS = SDCARD depends on SDCARD
help help
With this option final image would have prepended QorIQ pre-PBL eSDHC With this option final image would have prepended QorIQ pre-PBL eSDHC
boot sector suitable for SD card images. This boot sector instruct boot sector suitable for SD card images. This boot sector instruct

View File

@ -58,10 +58,17 @@ SECTIONS
__ex_table : { *(__ex_table) } __ex_table : { *(__ex_table) }
__stop___ex_table = .; __stop___ex_table = .;
. = ALIGN(8); . = ALIGN(4);
__init_begin = .; __init_begin = .;
__init_end = .; __init_end = .;
_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 #ifdef CONFIG_SPL_SKIP_RELOCATE
. = ALIGN(4); . = ALIGN(4);
__bss_start = .; __bss_start = .;
@ -94,6 +101,9 @@ SECTIONS
.resetvec IMAGE_TEXT_BASE + RESET_VECTOR_OFFSET : { .resetvec IMAGE_TEXT_BASE + RESET_VECTOR_OFFSET : {
KEEP(*(.resetvec)) KEEP(*(.resetvec))
} = 0xffff } = 0xffff
#if defined(CONFIG_SD_BOOT) && !defined(CONFIG_SYS_MMC_U_BOOT_OFFS)
mmc_u_boot_offs = .;
#endif
#endif #endif
#ifndef CONFIG_SPL_SKIP_RELOCATE #ifndef CONFIG_SPL_SKIP_RELOCATE

View File

@ -76,7 +76,7 @@
}; };
binman { binman {
filename = "u-boot-with-dtb.bin"; filename = "u-boot.bin";
skip-at-start = <CONFIG_SYS_TEXT_BASE>; skip-at-start = <CONFIG_SYS_TEXT_BASE>;
sort-by-offset; sort-by-offset;
pad-byte = <0xff>; pad-byte = <0xff>;

View File

@ -5,9 +5,11 @@
#include <config.h> #include <config.h>
#if defined(CONFIG_MPC85XX_HAVE_RESET_VECTOR) && defined(CONFIG_OF_SEPARATE)
/ { / {
binman { binman {
filename = "u-boot-with-dtb.bin"; filename = "u-boot.bin";
skip-at-start = <CONFIG_SYS_TEXT_BASE>; skip-at-start = <CONFIG_SYS_TEXT_BASE>;
sort-by-offset; sort-by-offset;
pad-byte = <0xff>; pad-byte = <0xff>;
@ -19,17 +21,15 @@
}; };
u-boot-dtb-with-ucode { u-boot-dtb-with-ucode {
#ifdef CONFIG_MPC85xx
align = <4>; align = <4>;
#endif
}; };
#ifdef CONFIG_MPC85XX_HAVE_RESET_VECTOR
#ifndef CONFIG_RESET_VECTOR_ADDRESS #ifndef CONFIG_RESET_VECTOR_ADDRESS
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc #define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
#endif #endif
powerpc-mpc85xx-bootpg-resetvec { powerpc-mpc85xx-bootpg-resetvec {
offset = <(CONFIG_RESET_VECTOR_ADDRESS - 0xffc)>; offset = <(CONFIG_RESET_VECTOR_ADDRESS - 0xffc)>;
}; };
#endif
}; };
}; };
#endif

View File

@ -60,5 +60,5 @@ enabled in relative defconfig file,
CONFIG_RESET_VECTOR_ADDRESS - 0xffc CONFIG_RESET_VECTOR_ADDRESS - 0xffc
If device tree support is enabled in defconfig, 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. 2. use 'u-boot-with-spl.bin' for other boot.

View File

@ -100,9 +100,6 @@ enabled in relative defconfig file,
3. CONFIG_MPC85XX_HAVE_RESET_VECTOR if reset vector is located at 3. CONFIG_MPC85XX_HAVE_RESET_VECTOR if reset vector is located at
CONFIG_RESET_VECTOR_ADDRESS - 0xffc 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 CPLD command
============ ============
The CPLD is used to control the power sequence and some serdes lane The CPLD is used to control the power sequence and some serdes lane

View File

@ -267,7 +267,7 @@ enabled in relative defconfig file,
config_reset_vector_address - 0xffc config_reset_vector_address - 0xffc
if device tree support is enabled in defconfig, 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. use 'u-boot-with-spl-pbl.bin' for other boot.
2-stage NAND/SPI/SD boot loader 2-stage NAND/SPI/SD boot loader

View File

@ -382,5 +382,5 @@ enabled in relative defconfig file,
CONFIG_RESET_VECTOR_ADDRESS - 0xffc CONFIG_RESET_VECTOR_ADDRESS - 0xffc
If device tree support is enabled in defconfig, 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. use 'u-boot-with-spl-pbl.bin' for other boot.

View File

@ -288,5 +288,5 @@ enabled in relative defconfig file,
CONFIG_RESET_VECTOR_ADDRESS - 0xffc CONFIG_RESET_VECTOR_ADDRESS - 0xffc
If device tree support is enabled in defconfig, 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. use 'u-boot-with-spl-pbl.bin' for other boot.

View File

@ -284,5 +284,5 @@ enabled in relative defconfig file,
CONFIG_RESET_VECTOR_ADDRESS - 0xffc CONFIG_RESET_VECTOR_ADDRESS - 0xffc
If device tree support is enabled in defconfig, 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. use 'u-boot-with-spl-pbl.bin' for other boot.

View File

@ -9,6 +9,10 @@
#include <mmc.h> #include <mmc.h>
#include <malloc.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 * 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 * 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); __attribute__((noreturn)) void (*uboot)(void);
uint blk_start, blk_cnt, err; uint blk_start, blk_cnt, err;
#ifndef CONFIG_FSL_CORENET
uchar *tmp_buf; uchar *tmp_buf;
u32 blklen; u32 blklen;
u32 blk_off; u32 blk_off;
#ifndef CONFIG_FSL_CORENET
uchar val; uchar val;
#ifndef CONFIG_SPL_FSL_PBL #ifndef CONFIG_SPL_FSL_PBL
u32 val32; u32 val32;
@ -83,9 +87,6 @@ void __noreturn mmc_boot(void)
hang(); hang();
} }
#ifdef CONFIG_FSL_CORENET
offset = CONFIG_SYS_MMC_U_BOOT_OFFS;
#else
blklen = mmc->read_bl_len; blklen = mmc->read_bl_len;
if (blklen < 512) if (blklen < 512)
blklen = 512; blklen = 512;
@ -95,6 +96,9 @@ void __noreturn mmc_boot(void)
hang(); hang();
} }
#ifdef CONFIG_FSL_CORENET
offset = CONFIG_SYS_MMC_U_BOOT_OFFS;
#else
sector = 0; sector = 0;
again: again:
memset(tmp_buf, 0, blklen); memset(tmp_buf, 0, blklen);
@ -149,23 +153,44 @@ again:
val = *(tmp_buf + blk_off + ESDHC_BOOT_IMAGE_ADDR + i); val = *(tmp_buf + blk_off + ESDHC_BOOT_IMAGE_ADDR + i);
offset = (offset << 8) + val; 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; offset += CONFIG_SYS_MMC_U_BOOT_OFFS;
#endif
#endif #endif
/* /*
* Load U-Boot image from mmc into RAM * Load U-Boot image from mmc into RAM
*/ */
code_len = CONFIG_SYS_MMC_U_BOOT_SIZE; code_len = CONFIG_SYS_MMC_U_BOOT_SIZE;
blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len; blk_start = offset / mmc->read_bl_len;
blk_cnt = ALIGN(code_len, mmc->read_bl_len) / 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, 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) { if (err != blk_cnt) {
puts("spl: mmc read failed!!\n"); puts("spl: mmc read failed!!\n");
#ifndef CONFIG_FSL_CORENET
free(tmp_buf); free(tmp_buf);
#endif
hang(); 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 * Clean d-cache and invalidate i-cache, to