diff options
34 files changed, 284 insertions, 180 deletions
diff --git a/.travis.yml b/.travis.yml index 6a575a5..51f14c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ language: c addons: apt: - sources: - - sourceline: 'ppa:gns3/qemu' packages: - cppcheck - sloccount @@ -21,10 +19,6 @@ addons: - libsdl1.2-dev - python - python-virtualenv - - qemu-system-arm - - qemu-system-mips - - qemu-system-ppc - - qemu-system-x86 - gcc-powerpc-linux-gnu - gcc-arm-linux-gnueabihf - gcc-aarch64-linux-gnu @@ -54,7 +48,7 @@ install: env: global: - - PATH=/tmp/dtc:/tmp/uboot-test-hooks/bin:$PATH + - PATH=/tmp/dtc:/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:$PATH - PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci - BUILD_DIR=build - HOSTCC="cc" @@ -74,6 +68,15 @@ before_script: echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman; fi - if [[ "${TOOLCHAIN}" == *xtensa* ]]; then ./tools/buildman/buildman --fetch-arch xtensa ; fi + - if [[ "${QEMU_TARGET}" != "" ]]; then + git clone git://git.qemu.org/qemu.git /tmp/qemu; + pushd /tmp/qemu; + git submodule update --init dtc && + git checkout v2.8.0-rc3 && + ./configure --prefix=/tmp/qemu-install --target-list=${QEMU_TARGET} && + make -j4 all install; + popd; + fi script: # Comments must be outside the command strings below, or the Travis parser @@ -254,43 +257,52 @@ matrix: - env: - TEST_PY_BD="vexpress_ca15_tc2" TEST_PY_ID="--id qemu" + QEMU_TARGET="arm-softmmu" BUILDMAN="^vexpress_ca15_tc2$" - env: - TEST_PY_BD="vexpress_ca9x4" TEST_PY_ID="--id qemu" + QEMU_TARGET="arm-softmmu" BUILDMAN="^vexpress_ca9x4$" - env: - TEST_PY_BD="integratorcp_cm926ejs" TEST_PY_TEST_SPEC="not sleep" TEST_PY_ID="--id qemu" + QEMU_TARGET="arm-softmmu" BUILDMAN="^integratorcp_cm926ejs$" - env: - TEST_PY_BD="qemu_mips" TEST_PY_TEST_SPEC="not sleep" + QEMU_TARGET="mips-softmmu" BUILDMAN="^qemu_mips$" TOOLCHAIN="mips" - env: - TEST_PY_BD="qemu_mipsel" TEST_PY_TEST_SPEC="not sleep" + QEMU_TARGET="mipsel-softmmu" BUILDMAN="^qemu_mipsel$" TOOLCHAIN="mips" - env: - TEST_PY_BD="qemu_mips64" TEST_PY_TEST_SPEC="not sleep" + QEMU_TARGET="mips64-softmmu" BUILDMAN="^qemu_mips64$" TOOLCHAIN="mips" - env: - TEST_PY_BD="qemu_mips64el" TEST_PY_TEST_SPEC="not sleep" + QEMU_TARGET="mips64el-softmmu" BUILDMAN="^qemu_mips64el$" TOOLCHAIN="mips" - env: - TEST_PY_BD="qemu-ppce500" TEST_PY_TEST_SPEC="not sleep" + QEMU_TARGET="ppc-softmmu" BUILDMAN="^qemu-ppce500$" - env: - TEST_PY_BD="qemu-x86" TEST_PY_TEST_SPEC="not sleep" + QEMU_TARGET="i386-softmmu" BUILDMAN="^qemu-x86$" TOOLCHAIN="x86_64" BUILD_ROM="yes" diff --git a/arch/arm/cpu/armv7/arch_timer.c b/arch/arm/cpu/armv7/arch_timer.c index 0588e2b..30915d2 100644 --- a/arch/arm/cpu/armv7/arch_timer.c +++ b/arch/arm/cpu/armv7/arch_timer.c @@ -8,6 +8,7 @@ #include <common.h> #include <asm/io.h> #include <div64.h> +#include <bootstage.h> DECLARE_GLOBAL_DATA_PTR; @@ -17,7 +18,6 @@ int timer_init(void) gd->arch.tbu = 0; gd->arch.timer_rate_hz = CONFIG_SYS_HZ_CLOCK / CONFIG_SYS_HZ; - return 0; } @@ -39,6 +39,11 @@ ulong get_timer(ulong base) return lldiv(get_ticks(), gd->arch.timer_rate_hz) - base; } +ulong timer_get_boot_us(void) +{ + return lldiv(get_ticks(), CONFIG_SYS_HZ_CLOCK / (CONFIG_SYS_HZ * 1000)); +} + void __udelay(unsigned long usec) { unsigned long long endtime; diff --git a/arch/arm/include/asm/emif.h b/arch/arm/include/asm/emif.h index b00dece..9a46340 100644 --- a/arch/arm/include/asm/emif.h +++ b/arch/arm/include/asm/emif.h @@ -1171,6 +1171,7 @@ struct emif_regs { u32 sdram_tim1; u32 sdram_tim2; u32 sdram_tim3; + u32 ocp_config; u32 read_idle_ctrl; u32 zq_config; u32 temp_alert_config; diff --git a/arch/arm/mach-omap2/am33xx/ddr.c b/arch/arm/mach-omap2/am33xx/ddr.c index 6acf30c..690487e 100644 --- a/arch/arm/mach-omap2/am33xx/ddr.c +++ b/arch/arm/mach-omap2/am33xx/ddr.c @@ -180,6 +180,10 @@ void config_sdram(const struct emif_regs *regs, int nr) writel(regs->ref_ctrl, &emif_reg[nr]->emif_sdram_ref_ctrl); writel(regs->ref_ctrl, &emif_reg[nr]->emif_sdram_ref_ctrl_shdw); writel(regs->sdram_config, &emif_reg[nr]->emif_sdram_config); + + /* Write REG_COS_COUNT_1, REG_COS_COUNT_2, and REG_PR_OLD_COUNT. */ + if (regs->ocp_config) + writel(regs->ocp_config, &emif_reg[nr]->emif_l3_config); } /** diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c index 0f8ead9..aa11493 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -142,7 +142,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image, return 0; } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image); +SPL_LOAD_IMAGE_METHOD("FEL", 0, BOOT_DEVICE_BOARD, spl_board_load_image); #endif void s_init(void) @@ -247,15 +247,6 @@ u32 spl_boot_device(void) return -1; /* Never reached */ } -/* - * Properly announce BOOT_DEVICE_BOARD as "FEL". - * Overrides weak function from common/spl/spl.c - */ -void spl_board_announce_boot_device(void) -{ - printf("FEL"); -} - /* No confirmation data available in SPL yet. Hardcode bootmode */ u32 spl_boot_mode(const u32 boot_device) { diff --git a/arch/arm/mach-uniphier/boot-mode/spl_board.c b/arch/arm/mach-uniphier/boot-mode/spl_board.c index 854ab05..a6b6686 100644 --- a/arch/arm/mach-uniphier/boot-mode/spl_board.c +++ b/arch/arm/mach-uniphier/boot-mode/spl_board.c @@ -12,11 +12,6 @@ #include "../soc-info.h" -void spl_board_announce_boot_device(void) -{ - printf("eMMC"); -} - struct uniphier_romfunc_table { void *mmc_send_cmd; void *mmc_card_blockaddr; @@ -127,4 +122,4 @@ static int spl_board_load_image(struct spl_image_info *spl_image, return 0; } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image); +SPL_LOAD_IMAGE_METHOD("eMMC", 0, BOOT_DEVICE_BOARD, spl_board_load_image); diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c index 1ad7fb6..7cc76d4 100644 --- a/arch/sandbox/cpu/spl.c +++ b/arch/sandbox/cpu/spl.c @@ -25,19 +25,6 @@ u32 spl_boot_device(void) return BOOT_DEVICE_BOARD; } -void spl_board_announce_boot_device(void) -{ - char fname[256]; - int ret; - - ret = os_find_u_boot(fname, sizeof(fname)); - if (ret) { - printf("(%s not found, error %d)\n", fname, ret); - return; - } - printf("%s\n", fname); -} - static int spl_board_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { @@ -45,13 +32,15 @@ static int spl_board_load_image(struct spl_image_info *spl_image, int ret; ret = os_find_u_boot(fname, sizeof(fname)); - if (ret) + if (ret) { + printf("(%s not found, error %d)\n", fname, ret); return ret; + } /* Hopefully this will not return */ return os_spl_to_uboot(fname); } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image); +SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image); void spl_board_init(void) { diff --git a/board/imgtec/boston/MAINTAINERS b/board/imgtec/boston/MAINTAINERS index 30dd481..ec850d2 100644 --- a/board/imgtec/boston/MAINTAINERS +++ b/board/imgtec/boston/MAINTAINERS @@ -3,4 +3,7 @@ M: Paul Burton <paul.burton@imgtec.com> S: Maintained F: board/imgtec/boston/ F: include/configs/boston.h -F: configs/boston_defconfig +F: configs/boston32r2_defconfig +F: configs/boston32r2el_defconfig +F: configs/boston64r2_defconfig +F: configs/boston64r2el_defconfig diff --git a/board/imgtec/malta/MAINTAINERS b/board/imgtec/malta/MAINTAINERS index a0b3284..052ec67 100644 --- a/board/imgtec/malta/MAINTAINERS +++ b/board/imgtec/malta/MAINTAINERS @@ -3,5 +3,7 @@ M: Paul Burton <paul.burton@imgtec.com> S: Maintained F: board/imgtec/malta/ F: include/configs/malta.h +F: configs/malta64_defconfig +F: configs/malta64el_defconfig F: configs/malta_defconfig F: configs/maltael_defconfig diff --git a/board/omicron/calimain/MAINTAINERS b/board/omicron/calimain/MAINTAINERS index f6e37a2..ad788a6 100644 --- a/board/omicron/calimain/MAINTAINERS +++ b/board/omicron/calimain/MAINTAINERS @@ -1,6 +1,6 @@ CALIMAIN BOARD -M: Manfred Rudigier <manfred.rudigier@omicron.at> -M: Christian Riesch <christian.riesch@omicron.at> +M: Manfred Rudigier <manfred.rudigier@omicronenergy.com> +M: Christoph RĂ¼disser <christoph.ruedisser@omicronenergy.com> S: Maintained F: board/omicron/calimain/ F: include/configs/calimain.h diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 111ed35..8eaf3e9 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -109,6 +109,16 @@ static const struct emif_regs ddr2_emif_reg_data = { .emif_ddr_phy_ctlr_1 = MT47H128M16RT25E_EMIF_READ_LATENCY, }; +static const struct emif_regs ddr2_evm_emif_reg_data = { + .sdram_config = MT47H128M16RT25E_EMIF_SDCFG, + .ref_ctrl = MT47H128M16RT25E_EMIF_SDREF, + .sdram_tim1 = MT47H128M16RT25E_EMIF_TIM1, + .sdram_tim2 = MT47H128M16RT25E_EMIF_TIM2, + .sdram_tim3 = MT47H128M16RT25E_EMIF_TIM3, + .ocp_config = EMIF_OCP_CONFIG_AM335X_EVM, + .emif_ddr_phy_ctlr_1 = MT47H128M16RT25E_EMIF_READ_LATENCY, +}; + static const struct ddr_data ddr3_data = { .datardsratio0 = MT41J128MJT125_RD_DQS, .datawdsratio0 = MT41J128MJT125_WR_DQS, @@ -198,6 +208,7 @@ static struct emif_regs ddr3_beagleblack_emif_reg_data = { .sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1, .sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2, .sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3, + .ocp_config = EMIF_OCP_CONFIG_BEAGLEBONE_BLACK, .zq_config = MT41K256M16HA125E_ZQ_CFG, .emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY, }; @@ -208,6 +219,7 @@ static struct emif_regs ddr3_evm_emif_reg_data = { .sdram_tim1 = MT41J512M8RH125_EMIF_TIM1, .sdram_tim2 = MT41J512M8RH125_EMIF_TIM2, .sdram_tim3 = MT41J512M8RH125_EMIF_TIM3, + .ocp_config = EMIF_OCP_CONFIG_AM335X_EVM, .zq_config = MT41J512M8RH125_ZQ_CFG, .emif_ddr_phy_ctlr_1 = MT41J512M8RH125_EMIF_READ_LATENCY | PHY_EN_DYN_PWRDN, @@ -486,6 +498,9 @@ void sdram_init(void) config_ddr(400, &ioregs_evmsk, &ddr3_icev2_data, &ddr3_icev2_cmd_ctrl_data, &ddr3_icev2_emif_reg_data, 0); + else if (board_is_gp_evm()) + config_ddr(266, &ioregs, &ddr2_data, + &ddr2_cmd_ctrl_data, &ddr2_evm_emif_reg_data, 0); else config_ddr(266, &ioregs, &ddr2_data, &ddr2_cmd_ctrl_data, &ddr2_emif_reg_data, 0); diff --git a/board/ti/am335x/board.h b/board/ti/am335x/board.h index 9776df7..48c139a 100644 --- a/board/ti/am335x/board.h +++ b/board/ti/am335x/board.h @@ -11,6 +11,19 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +/** + * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and + * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame + * Synchronization Lost errors. The values are the biggest that work + * reliably with offered video modes and the memory subsystem on the + * boards. These register have are briefly documented in "7.3.3.5.2 + * Command Starvation" section of AM335x TRM. The REG_COS_COUNT_1 and + * REG_COS_COUNT_2 do not have any effect on current versions of + * AM335x. + */ +#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK 0x00141414 +#define EMIF_OCP_CONFIG_AM335X_EVM 0x003d3d3d + static inline int board_is_bone(void) { return board_ti_is("A335BONE"); diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index 797d7a4..5f2d4df 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -55,6 +55,9 @@ DECLARE_GLOBAL_DATA_PTR; #define SYSINFO_BOARD_NAME_MAX_LEN 45 +#define TPS65903X_PRIMARY_SECONDARY_PAD2 0xFB +#define TPS65903X_PAD2_POWERHOLD_MASK 0x20 + const struct omap_sysinfo sysinfo = { "Board: UNKNOWN(BeagleBoard X15?) REV UNKNOWN\n" }; @@ -457,6 +460,7 @@ int board_init(void) int board_late_init(void) { setup_board_eeprom_env(); + u8 val; /* * DEV_CTRL.DEV_ON = 1 please - else palmas switches off in 8 seconds @@ -471,6 +475,18 @@ int board_late_init(void) if (get_device_type() == HS_DEVICE) setenv("boot_fit", "1"); + /* + * Set the GPIO7 Pad to POWERHOLD. This has higher priority + * over DEV_CTRL.DEV_ON bit. This can be reset in case of + * PMIC Power off. So to be on the safer side set it back + * to POWERHOLD mode irrespective of the current state. + */ + palmas_i2c_read_u8(TPS65903X_CHIP_P1, TPS65903X_PRIMARY_SECONDARY_PAD2, + &val); + val = val | TPS65903X_PAD2_POWERHOLD_MASK; + palmas_i2c_write_u8(TPS65903X_CHIP_P1, TPS65903X_PRIMARY_SECONDARY_PAD2, + val); + return 0; } @@ -92,6 +92,77 @@ static void pci_show_regs(pci_dev_t dev, struct pci_reg_info *regs) } #endif +#ifdef CONFIG_DM_PCI +int pci_bar_show(struct udevice *dev) +{ + u8 header_type; + int bar_cnt, bar_id, mem_type; + bool is_64, is_io; + u32 base_low, base_high; + u32 size_low, size_high; + u64 base, size; + u32 reg_addr; + int prefetchable; + + dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); + + if (header_type == PCI_HEADER_TYPE_CARDBUS) { + printf("CardBus doesn't support BARs\n"); + return -ENOSYS; + } + + bar_cnt = (header_type == PCI_HEADER_TYPE_NORMAL) ? 6 : 2; + + printf("ID Base Size Width Type\n"); + printf("----------------------------------------------------------\n"); + + bar_id = 0; + reg_addr = PCI_BASE_ADDRESS_0; + while (bar_cnt) { + dm_pci_read_config32(dev, reg_addr, &base_low); + dm_pci_write_config32(dev, reg_addr, 0xffffffff); + dm_pci_read_config32(dev, reg_addr, &size_low); + dm_pci_write_config32(dev, reg_addr, base_low); + reg_addr += 4; + + base = base_low & ~0xf; + size = size_low & ~0xf; + base_high = 0x0; + size_high = 0xffffffff; + is_64 = 0; + prefetchable = base_low & PCI_BASE_ADDRESS_MEM_PREFETCH; + is_io = base_low & PCI_BASE_ADDRESS_SPACE_IO; + mem_type = base_low & PCI_BASE_ADDRESS_MEM_TYPE_MASK; + + if (mem_type == PCI_BASE_ADDRESS_MEM_TYPE_64) { + dm_pci_read_config32(dev, reg_addr, &base_high); + dm_pci_write_config32(dev, reg_addr, 0xffffffff); + dm_pci_read_config32(dev, reg_addr, &size_high); + dm_pci_write_config32(dev, reg_addr, base_high); + bar_cnt--; + reg_addr += 4; + is_64 = 1; + } + + base = base | ((u64)base_high << 32); + size = size | ((u64)size_high << 32); + + if ((!is_64 && size_low) || (is_64 && size)) { + size = ~size + 1; + printf(" %d %#016llx %#016llx %d %s %s\n", + bar_id, base, size, is_64 ? 64 : 32, + is_io ? "I/O" : "MEM", + prefetchable ? "Prefetchable" : ""); + } + + bar_id++; + bar_cnt--; + } + + return 0; +} +#endif + static struct pci_reg_info regs_start[] = { { "vendor ID", PCI_SIZE_16, PCI_VENDOR_ID }, { "device ID", PCI_SIZE_16, PCI_DEVICE_ID }, @@ -573,6 +644,9 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc > 4) value = simple_strtoul(argv[4], NULL, 16); case 'h': /* header */ +#ifdef CONFIG_DM_PCI + case 'b': /* bars */ +#endif if (argc < 3) goto usage; if ((bdf = get_pci_dev(argv[2])) == -1) @@ -641,6 +715,11 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ret = pci_cfg_write(dev, addr, size, value); #endif break; +#ifdef CONFIG_DM_PCI + + case 'b': /* bars */ + return pci_bar_show(dev); +#endif default: ret = CMD_RET_USAGE; break; @@ -663,6 +742,10 @@ static char pci_help_text[] = #endif "pci header b.d.f\n" " - show header of PCI device 'bus.device.function'\n" +#ifdef CONFIG_DM_PCI + "pci bar b.d.f\n" + " - show BARs base and size for device b.d.f'\n" +#endif "pci display[.b, .w, .l] b.d.f [address] [# of objects]\n" " - display PCI configuration space (CFG)\n" "pci next[.b, .w, .l] b.d.f address\n" diff --git a/common/spl/spl.c b/common/spl/spl.c index 9bcbd09..f7df834 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -221,10 +221,10 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, return 0; } #if defined(CONFIG_SPL_RAM_DEVICE) -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image); +SPL_LOAD_IMAGE_METHOD("RAM", 0, BOOT_DEVICE_RAM, spl_ram_load_image); #endif #if defined(CONFIG_SPL_DFU_SUPPORT) -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image); +SPL_LOAD_IMAGE_METHOD("USB DFU", 0, BOOT_DEVICE_DFU, spl_ram_load_image); #endif #endif @@ -269,87 +269,6 @@ __weak void board_boot_order(u32 *spl_boot_list) spl_boot_list[0] = spl_boot_device(); } -#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE -__weak void spl_board_announce_boot_device(void) { } -#endif - -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT -struct boot_device_name { - u32 boot_dev; - const char *name; -}; - -struct boot_device_name boot_name_table[] = { -#ifdef CONFIG_SPL_RAM_DEVICE - { BOOT_DEVICE_RAM, "RAM" }, -#endif -#ifdef CONFIG_SPL_MMC_SUPPORT - { BOOT_DEVICE_MMC1, "MMC1" }, - { BOOT_DEVICE_MMC2, "MMC2" }, - { BOOT_DEVICE_MMC2_2, "MMC2_2" }, -#endif -#ifdef CONFIG_SPL_NAND_SUPPORT - { BOOT_DEVICE_NAND, "NAND" }, -#endif -#ifdef CONFIG_SPL_ONENAND_SUPPORT - { BOOT_DEVICE_ONENAND, "OneNAND" }, -#endif -#ifdef CONFIG_SPL_NOR_SUPPORT - { BOOT_DEVICE_NOR, "NOR" }, -#endif -#ifdef CONFIG_SPL_YMODEM_SUPPORT - { BOOT_DEVICE_UART, "UART" }, -#endif -#if defined(CONFIG_SPL_SPI_SUPPORT) || defined(CONFIG_SPL_SPI_FLASH_SUPPORT) - { BOOT_DEVICE_SPI, "SPI" }, -#endif -#ifdef CONFIG_SPL_ETH_SUPPORT -#ifdef CONFIG_SPL_ETH_DEVICE - { BOOT_DEVICE_CPGMAC, "eth device" }, -#else - { BOOT_DEVICE_CPGMAC, "net" }, -#endif -#endif -#ifdef CONFIG_SPL_USBETH_SUPPORT - { BOOT_DEVICE_USBETH, "USB eth" }, -#endif -#ifdef CONFIG_SPL_USB_SUPPORT - { BOOT_DEVICE_USB, "USB" }, -#endif -#ifdef CONFIG_SPL_DFU_SUPPORT - { BOOT_DEVICE_DFU, "USB DFU" }, -#endif -#ifdef CONFIG_SPL_SATA_SUPPORT - { BOOT_DEVICE_SATA, "SATA" }, -#endif - /* Keep this entry last */ - { BOOT_DEVICE_NONE, "unknown boot device" }, -}; - -static void announce_boot_device(u32 boot_device) -{ - int i; - - puts("Trying to boot from "); - -#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE - if (boot_device == BOOT_DEVICE_BOARD) { - spl_board_announce_boot_device(); - puts("\n"); - return; - } -#endif - for (i = 0; i < ARRAY_SIZE(boot_name_table) - 1; i++) { - if (boot_name_table[i].boot_dev == boot_device) - break; - } - - printf("%s\n", boot_name_table[i].name); -} -#else -static inline void announce_boot_device(u32 boot_device) { } -#endif - static struct spl_image_loader *spl_ll_find_loader(uint boot_device) { struct spl_image_loader *drv = @@ -367,19 +286,44 @@ static struct spl_image_loader *spl_ll_find_loader(uint boot_device) return NULL; } -static int spl_load_image(struct spl_image_info *spl_image, u32 boot_device) +static int spl_load_image(struct spl_image_info *spl_image, + struct spl_image_loader *loader) { struct spl_boot_device bootdev; - struct spl_image_loader *loader = spl_ll_find_loader(boot_device); - bootdev.boot_device = boot_device; + bootdev.boot_device = loader->boot_device; bootdev.boot_device_name = NULL; - if (loader) - return loader->load_image(spl_image, &bootdev); + return loader->load_image(spl_image, &bootdev); +} + +/** + * boot_from_devices() - Try loading an booting U-Boot from a list of devices + * + * @spl_image: Place to put the image details if successful + * @spl_boot_list: List of boot devices to try + * @count: Number of elements in spl_boot_list + * @return 0 if OK, -ve on error + */ +static int boot_from_devices(struct spl_image_info *spl_image, + u32 spl_boot_list[], int count) +{ + int i; + + for (i = 0; i < count && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) { + struct spl_image_loader *loader; + + loader = spl_ll_find_loader(spl_boot_list[i]); #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT) - puts("SPL: Unsupported Boot Device!\n"); + if (loader) + printf("Trying to boot from %s", loader->name); + else + puts("SPL: Unsupported Boot Device!\n"); #endif + if (loader && !spl_load_image(spl_image, loader)) + return 0; + } + return -ENODEV; } @@ -393,7 +337,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2) BOOT_DEVICE_NONE, }; struct spl_image_info spl_image; - int i; debug(">>spl:board_init_r()\n"); @@ -420,15 +363,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2) memset(&spl_image, '\0', sizeof(spl_image)); board_boot_order(spl_boot_list); - for (i = 0; i < ARRAY_SIZE(spl_boot_list) && - spl_boot_list[i] != BOOT_DEVICE_NONE; i++) { - announce_boot_device(spl_boot_list[i]); - if (!spl_load_image(&spl_image, spl_boot_list[i])) - break; - } - if (i == ARRAY_SIZE(spl_boot_list) || - spl_boot_list[i] == BOOT_DEVICE_NONE) { + if (boot_from_devices(&spl_image, spl_boot_list, + ARRAY_SIZE(spl_boot_list))) { puts("SPL: failed to boot from all boot devices\n"); hang(); } diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 32d7c2a..85e3de8 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -355,6 +355,6 @@ int spl_mmc_load_image(struct spl_image_info *spl_image, return err; } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC1, spl_mmc_load_image); -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2, spl_mmc_load_image); -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image); +SPL_LOAD_IMAGE_METHOD("MMC1", 0, BOOT_DEVICE_MMC1, spl_mmc_load_image); +SPL_LOAD_IMAGE_METHOD("MMC2", 0, BOOT_DEVICE_MMC2, spl_mmc_load_image); +SPL_LOAD_IMAGE_METHOD("MMC2_2", 0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image); diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index d1abda6..cd39f9b 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -151,4 +151,4 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, } #endif /* Use priorty 1 so that Ubi can override this */ -SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_NAND, spl_nand_load_image); +SPL_LOAD_IMAGE_METHOD("NAND", 1, BOOT_DEVICE_NAND, spl_nand_load_image); diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c index f4b4bc4..0fba017 100644 --- a/common/spl/spl_net.c +++ b/common/spl/spl_net.c @@ -51,7 +51,8 @@ int spl_net_load_image_cpgmac(struct spl_image_info *spl_image, return spl_net_load_image(spl_image, bootdev); } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_CPGMAC, spl_net_load_image_cpgmac); +SPL_LOAD_IMAGE_METHOD("eth device", 0, BOOT_DEVICE_CPGMAC, + spl_net_load_image_cpgmac); #endif #ifdef CONFIG_SPL_USBETH_SUPPORT @@ -62,5 +63,5 @@ int spl_net_load_image_usb(struct spl_image_info *spl_image, return spl_net_load_image(spl_image, bootdev); } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USBETH, spl_net_load_image_usb); +SPL_LOAD_IMAGE_METHOD("USB eth", 0, BOOT_DEVICE_USBETH, spl_net_load_image_usb); #endif diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 6bfa399..d07ca84 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -71,4 +71,4 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, return 0; } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NOR, spl_nor_load_image); +SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image); diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c index f076e2c..fc98e9c 100644 --- a/common/spl/spl_onenand.c +++ b/common/spl/spl_onenand.c @@ -36,4 +36,5 @@ static int spl_onenand_load_image(struct spl_image_info *spl_image, return 0; } /* Use priorty 1 so that Ubi can override this */ -SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_ONENAND, spl_onenand_load_image); +SPL_LOAD_IMAGE_METHOD("OneNAND", 1, BOOT_DEVICE_ONENAND, + spl_onenand_load_image); diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index a3c07cd..5476206 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -57,4 +57,4 @@ static int spl_sata_load_image(struct spl_image_info *spl_image, return 0; } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SATA, spl_sata_load_image); +SPL_LOAD_IMAGE_METHOD("SATA", 0, BOOT_DEVICE_SATA, spl_sata_load_image); diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 78b8cd1..cd1d6b2 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -125,4 +125,4 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, return err; } /* Use priorty 1 so that boards can override this */ -SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_SPI, spl_spi_load_image); +SPL_LOAD_IMAGE_METHOD("SPI", 1, BOOT_DEVICE_SPI, spl_spi_load_image); diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c index c03910b..24633f4 100644 --- a/common/spl/spl_ubi.c +++ b/common/spl/spl_ubi.c @@ -78,5 +78,5 @@ out: return ret; } /* Use priorty 0 so that Ubi will override NAND and ONENAND methods */ -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NAND, spl_ubi_load_image); -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_ONENAND, spl_ubi_load_image); +SPL_LOAD_IMAGE_METHOD("NAND", 0, BOOT_DEVICE_NAND, spl_ubi_load_image); +SPL_LOAD_IMAGE_METHOD("OneNAND", 0, BOOT_DEVICE_ONENAND, spl_ubi_load_image); diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c index e37966e..567a450 100644 --- a/common/spl/spl_usb.c +++ b/common/spl/spl_usb.c @@ -65,4 +65,4 @@ static int spl_usb_load_image(struct spl_image_info *spl_image, return 0; } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USB, spl_usb_load_image); +SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_usb_load_image); diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 957894d..ff8085b 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -132,4 +132,4 @@ end_stream: printf("Loaded %d bytes\n", size); return 0; } -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_UART, spl_ymodem_load_image); +SPL_LOAD_IMAGE_METHOD("UART", 0, BOOT_DEVICE_UART, spl_ymodem_load_image); diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index 2b1d695..c20c42e 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -3,6 +3,9 @@ CONFIG_OMAP54XX=y CONFIG_TI_SECURE_DEVICE=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_TARGET_AM57XX_EVM=y +CONFIG_TI_SECURE_EMIF_REGION_START=0xbe000000 +CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE=0x02000000 +CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE=0x01c00000 CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_SPL_STACK_R_ADDR=0x82000000 diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig index e350d9f..b890a06 100644 --- a/configs/dra7xx_hs_evm_defconfig +++ b/configs/dra7xx_hs_evm_defconfig @@ -4,6 +4,9 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TI_SECURE_DEVICE=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_TARGET_DRA7XX_EVM=y +CONFIG_TI_SECURE_EMIF_REGION_START=0xbe000000 +CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE=0x02000000 +CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE=0x01c00000 CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_SPL_STACK_R_ADDR=0x82000000 diff --git a/configs/omap5_uevm_defconfig b/configs/omap5_uevm_defconfig index 3005ffd..18843d2 100644 --- a/configs/omap5_uevm_defconfig +++ b/configs/omap5_uevm_defconfig @@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_OMAP54XX=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_TARGET_OMAP5_UEVM=y +CONFIG_ARMV7_LPAE=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_SPL=y diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index 52681c9..d030ffa 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -13,6 +13,7 @@ CONFIG_SPL=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot > " +CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y # CONFIG_CMD_FLASH is not set diff --git a/drivers/mtd/spi/sunxi_spi_spl.c b/drivers/mtd/spi/sunxi_spi_spl.c index 7502314..e70064c 100644 --- a/drivers/mtd/spi/sunxi_spi_spl.c +++ b/drivers/mtd/spi/sunxi_spi_spl.c @@ -284,4 +284,4 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, return 0; } /* Use priorty 0 to override the default if it happens to be linked in */ -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SPI, spl_spi_load_image); +SPL_LOAD_IMAGE_METHOD("sunxi SPI" 0, BOOT_DEVICE_SPI, spl_spi_load_image); diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h index 7c2f414..8119fb2 100644 --- a/include/configs/omapl138_lcdk.h +++ b/include/configs/omapl138_lcdk.h @@ -173,10 +173,11 @@ #undef CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */ #define CONFIG_SYS_NAND_HW_ECC_OOBFIRST +#define CONFIG_NAND_6BYTES_OOB_FREE_10BYTES_ECC #define CONFIG_SYS_NAND_5_ADDR_CYCLE #define CONFIG_SYS_NAND_PAGE_SIZE (2 << 10) #define CONFIG_SYS_NAND_BLOCK_SIZE (128 << 10) -#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x200 /*0x60000*/ +#define CONFIG_SYS_NAND_U_BOOT_SIZE SZ_512K #define CONFIG_SYS_NAND_U_BOOT_DST 0xc1080000 #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST #define CONFIG_SYS_NAND_U_BOOT_RELOC_SP (CONFIG_SYS_NAND_U_BOOT_DST - \ @@ -184,11 +185,10 @@ CONFIG_SYS_MALLOC_LEN - \ GENERATED_GBL_DATA_SIZE) #define CONFIG_SYS_NAND_ECCPOS { \ - 24, 25, 26, 27, 28, \ - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, \ - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, \ - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, \ - 59, 60, 61, 62, 63 } + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \ + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, \ + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \ + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 } #define CONFIG_SYS_NAND_PAGE_COUNT 64 #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0 #define CONFIG_SYS_NAND_ECCSIZE 512 @@ -247,7 +247,7 @@ */ #define CONFIG_MISC_INIT_R #define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_BOOTFILE "uImage" /* Boot file name */ +#define CONFIG_BOOTFILE "zImage" /* Boot file name */ #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ @@ -276,19 +276,20 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "fdtaddr=0xc0600000\0" \ "fdtfile=da850-lcdk.dtb\0" \ - "fdtboot=bootm 0xc0700000 - ${fdtaddr};\0" \ + "fdtboot=bootz 0xc0700000 - ${fdtaddr};\0" \ "mmcboot=" \ "if fatload mmc 0 0xc0600000 boot.scr; then " \ "source 0xc0600000; " \ "else " \ - "fatload mmc 0 0xc0700000 uImage; " \ + "fatload mmc 0 0xc0700000 " \ + __stringify(CONFIG_BOOTFILE) "; " \ "fatload mmc 0 ${fdtaddr} ${fdtfile}; " \ "run fdtboot; " \ "fi;\0" \ "spiboot=" \ "sf probe 0; " \ "sf read 0xc0700000 0x80000 0x220000; " \ - "bootm 0xc0700000;\0" + "bootz 0xc0700000;\0" /* * U-Boot commands diff --git a/include/spl.h b/include/spl.h index c727eb7..6e746b2 100644 --- a/include/spl.h +++ b/include/spl.h @@ -152,10 +152,14 @@ struct spl_boot_device { /** * Holds information about a way of loading an SPL image * + * @name: User-friendly name for this method (e.g. "MMC") * @boot_device: Boot device that this loader supports * @load_image: Function to call to load image */ struct spl_image_loader { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT + const char *name; +#endif uint boot_device; /** * load_image() - Load an SPL image @@ -172,16 +176,25 @@ struct spl_image_loader { ll_entry_declare(struct spl_image_loader, __name, spl_image_loader) /* - * __priority is the priority of this method, 0 meaning it will be the top + * _priority is the priority of this method, 0 meaning it will be the top * choice for this device, 9 meaning it is the bottom choice. - * __boot_device is the BOOT_DEVICE_... value - * __method is the load_image function to call + * _boot_device is the BOOT_DEVICE_... value + * _method is the load_image function to call */ -#define SPL_LOAD_IMAGE_METHOD(__priority, __boot_device, __method) \ - SPL_LOAD_IMAGE(__method ## __priority ## __boot_device) = { \ - .boot_device = __boot_device, \ - .load_image = __method, \ +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT +#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \ + SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \ + .name = _name, \ + .boot_device = _boot_device, \ + .load_image = _method, \ } +#else +#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \ + SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \ + .boot_device = _boot_device, \ + .load_image = _method, \ + } +#endif /* SPL FAT image functions */ int spl_load_image_fat(struct spl_image_info *spl_image, diff --git a/tools/zynqimage.c b/tools/zynqimage.c index 43876e7..b47132b 100644 --- a/tools/zynqimage.c +++ b/tools/zynqimage.c @@ -225,16 +225,26 @@ static int zynqimage_check_image_types(uint8_t type) static void zynqimage_parse_initparams(struct zynq_header *zynqhdr, const char *filename) { - /* Expect a table of register-value pairs, e.g. "0x12345678 0x4321" */ - FILE *fp = fopen(filename, "r"); + FILE *fp; struct zynq_reginit reginit; unsigned int reg_count = 0; - int r; + int r, err; + struct stat path_stat; + /* Expect a table of register-value pairs, e.g. "0x12345678 0x4321" */ + fp = fopen(filename, "r"); if (!fp) { fprintf(stderr, "Cannot open initparams file: %s\n", filename); exit(1); } + + err = fstat(fileno(fp), &path_stat); + if (err) + return; + + if (!S_ISREG(path_stat.st_mode)) + return; + do { r = fscanf(fp, "%x %x", ®init.address, ®init.data); if (r == 2) { diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index 202faea..60d8ed2 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -240,19 +240,23 @@ static void zynqmpimage_parse_initparams(struct zynqmp_header *zynqhdr, FILE *fp; struct zynqmp_reginit reginit; unsigned int reg_count = 0; - int r; + int r, err; struct stat path_stat; - stat(filename, &path_stat); - if (!S_ISREG(path_stat.st_mode)) - return; - /* Expect a table of register-value pairs, e.g. "0x12345678 0x4321" */ fp = fopen(filename, "r"); if (!fp) { fprintf(stderr, "Cannot open initparams file: %s\n", filename); exit(1); } + + err = fstat(fileno(fp), &path_stat); + if (err) + return; + + if (!S_ISREG(path_stat.st_mode)) + return; + do { r = fscanf(fp, "%x %x", ®init.address, ®init.data); if (r == 2) { |