u-boot/arch/arm/mach-socfpga/include/mach
Marek Vasut beee6a3083 ARM: socfpga: Add boot0 hook to prevent SPL corruption
Valid Altera SoCFPGA preloader image must contain special data at
offsets 0x40, 0x44, 0x48 and valid instructions at address 0x4c or
0x50. These addresses are by default used by U-Boot's vector table
and a piece of reset handler, thus a valid preloader corrupts those
addresses slightly. While this works most of the time, this can and
does prevent the board from rebooting sometimes and triggering this
issue may even depend on compiler.

The problem is that when SoCFPGA performs warm reset, it checks the
addresses 0x40..0x4b in SRAM for a valid preloader signature and
header checksum. If those are found, it jumps to address 0x4c or
0x50 (this is unclear). These addresses are populated by the first
few instructions of arch/arm/cpu/armv7/start.S:

ffff0040 <data_abort>:
ffff0040:       ebfffffe        bl      ffff0040 <data_abort>

ffff0044 <reset>:
ffff0044:       ea000012        b       ffff0094 <save_boot_params>

ffff0048 <save_boot_params_ret>:
ffff0048:       e10f0000        mrs     r0, CPSR
ffff004c:       e200101f        and     r1, r0, #31
ffff0050:       e331001a        teq     r1, #26

Without this patch, the CPU will enter the code at 0xffff004c or
0xffff0050 , at which point the value of r0 and r1 registers is
undefined. Moreover, jumping directly to the preloader entry point
at address 0xffff0000 will also fail, because address 0xffff004.
is invalid and contains the preloader magic.

Add BOOT0 hook which reserves the area at offset 0x40..0x5f and
populates offset 0x50 with jump to the entry point. This way, the
preloader signature is stored in reserved space and can not corrupt
the SPL code.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Stefan Roese <sr@denx.de>
Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
2016-12-06 01:45:56 +01:00
..
base_addr_a10.h ARM: socfpga: arria10: add base address map for Arria10 2015-11-30 13:30:19 +01:00
base_addr_ac5.h ARM: socfpga: rename the cyclone5 and arria5 base address file 2015-11-30 13:30:19 +01:00
boot0.h ARM: socfpga: Add boot0 hook to prevent SPL corruption 2016-12-06 01:45:56 +01:00
clock_manager.h arm: socfpga: clock: Clean up pll_config.h 2015-08-08 14:14:06 +02:00
fpga_manager.h ARM: socfpga: move SoC headers to mach-socfpga/include/mach 2015-05-07 05:21:15 +02:00
freeze_controller.h ARM: socfpga: move SoC headers to mach-socfpga/include/mach 2015-05-07 05:21:15 +02:00
gpio.h ARM: socfpga: move SoC headers to mach-socfpga/include/mach 2015-05-07 05:21:15 +02:00
nic301.h ARM: socfpga: move SoC headers to mach-socfpga/include/mach 2015-05-07 05:21:15 +02:00
reset_manager.h arm: socfpga: Define NAND reset bit 2015-12-22 21:30:02 +01:00
scan_manager.h arm: socfpga: scan: Add code to get FPGA ID 2015-08-08 14:14:30 +02:00
scu.h ARM: socfpga: move SoC headers to mach-socfpga/include/mach 2015-05-07 05:21:15 +02:00
sdram.h ddr: altera: Configuring SDRAM extra cycles timing parameters 2016-10-27 08:03:07 +02:00
system_manager.h arm: socfpga: fix up a questionable macro for SDMMC 2015-12-20 03:44:56 +01:00
timer.h ARM: socfpga: move SoC headers to mach-socfpga/include/mach 2015-05-07 05:21:15 +02:00