From: Simon Goldschmidt Date: Mon, 29 Oct 2018 21:47:12 +0100 Subject: [U-Boot] [PATCH] arm: socfpga: fix bootcounter by reserving SRAM Message-ID: <20181029204712.15525-1-simon.k.r.goldschmidt@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Commit 768f23dc8ae3 ("ARM: socfpga: Put stack at the end of SRAM") broke those socfpga boards that keep the bootcounter at the end of the internal SRAM as the bootcounter needs 8 bytes by default and thus the very first SPL call to board_init_f_alloc_reserve overwrites the bootcounter. This patch allows to move the initial stack pointer down a bit to allow boards to reserve some of the internal SRAM for other features (like the bootcounter). Signed-off-by: Simon Goldschmidt --- include/configs/socfpga_common.h | 6 +++++- include/configs/socfpga_is1.h | 9 +++++---- include/configs/socfpga_sr1500.h | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 2330143cf1..1e26630330 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -31,8 +31,12 @@ #define CONFIG_SYS_INIT_RAM_ADDR 0xFFE00000 #define CONFIG_SYS_INIT_RAM_SIZE 0x40000 /* 256KB */ #endif +#ifndef SOCFPGA_INIT_RAM_END_RESERVE +#define SOCFPGA_INIT_RAM_END_RESERVE 0 +#endif #define CONFIG_SYS_INIT_SP_ADDR \ - (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE) + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE - \ + SOCFPGA_INIT_RAM_END_RESERVE) #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 diff --git a/include/configs/socfpga_is1.h b/include/configs/socfpga_is1.h index c233c208a5..3c80c0f45c 100644 --- a/include/configs/socfpga_is1.h +++ b/include/configs/socfpga_is1.h @@ -23,12 +23,13 @@ /* PHY */ #endif -/* The rest of the configuration is shared */ -#include - /* - * Bootcounter + * Bootcounter (8 bytes at the end of internal SRAM) */ #define CONFIG_SYS_BOOTCOUNT_BE +#define SOCFPGA_INIT_RAM_END_RESERVE 8 + +/* The rest of the configuration is shared */ +#include #endif /* __CONFIG_SOCFPGA_IS1_H__ */ diff --git a/include/configs/socfpga_sr1500.h b/include/configs/socfpga_sr1500.h index 984f1183fd..b7b43fc6af 100644 --- a/include/configs/socfpga_sr1500.h +++ b/include/configs/socfpga_sr1500.h @@ -25,9 +25,10 @@ #define CONFIG_SPI_N25Q256A_RESET /* - * Bootcounter + * Bootcounter (8 bytes at the end of internal SRAM) */ #define CONFIG_SYS_BOOTCOUNT_BE +#define SOCFPGA_INIT_RAM_END_RESERVE 8 /* Environment setting for SPI flash */ #define CONFIG_SYS_REDUNDAND_ENVIRONMENT -- 2.17.1