aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2023-02-03 21:41:45 +0100
committerStefan Roese <sr@denx.de>2023-03-01 06:39:18 +0100
commit056808a4bbcc611d8cdedd937d9e1177b441716a (patch)
tree423a61bc977eafc3b3fc39dc0a71cf1534c2991c
parent7c406797cb7c09430fda9f3706b4f4bf658f54fe (diff)
downloadu-boot-056808a4bbcc611d8cdedd937d9e1177b441716a.zip
u-boot-056808a4bbcc611d8cdedd937d9e1177b441716a.tar.gz
u-boot-056808a4bbcc611d8cdedd937d9e1177b441716a.tar.bz2
arm: mvebu: Define env_sf_get_env_addr() also for Proper U-Boot
Proper U-Boot moves SPI0 CS0 Flash mapping from 0xD4000000 to 0xF4000000 and change its size from 64 MB to 8 MB. Definitions are already in MBUS_SPI_BASE/MBUS_SPI_SIZE macros. So define these macros also for SPL build, use them in env_sf_get_env_addr() function and move this function from spl.c to cpu.c to be available in Proper U-Boot too. Signed-off-by: Pali Rohár <pali@kernel.org>
-rw-r--r--arch/arm/mach-mvebu/cpu.c9
-rw-r--r--arch/arm/mach-mvebu/include/mach/cpu.h5
-rw-r--r--arch/arm/mach-mvebu/spl.c13
3 files changed, 14 insertions, 13 deletions
diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index 6fbbfcf..bbe167e 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -35,6 +35,15 @@ static const struct mbus_win windows[] = {
#endif
};
+/* SPI0 CS0 Flash of size MBUS_SPI_SIZE is mapped to address MBUS_SPI_BASE */
+#if CONFIG_ENV_SPI_BUS == 0 && CONFIG_ENV_SPI_CS == 0 && \
+ CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE <= MBUS_SPI_SIZE
+void *env_sf_get_env_addr(void)
+{
+ return (void *)MBUS_SPI_BASE + CONFIG_ENV_OFFSET;
+}
+#endif
+
void lowlevel_init(void)
{
/*
diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h
index c17c244..906a873 100644
--- a/arch/arm/mach-mvebu/include/mach/cpu.h
+++ b/arch/arm/mach-mvebu/include/mach/cpu.h
@@ -71,8 +71,13 @@ enum cpu_attrib {
#define MBUS_PCI_MEM_SIZE ((MBUS_PCI_MAX_PORTS * 128) << 20)
#define MBUS_PCI_IO_BASE 0xF1100000
#define MBUS_PCI_IO_SIZE ((MBUS_PCI_MAX_PORTS * 64) << 10)
+#ifdef CONFIG_SPL_BUILD
+#define MBUS_SPI_BASE 0xD4000000
+#define MBUS_SPI_SIZE (64 << 20)
+#else
#define MBUS_SPI_BASE 0xF4000000
#define MBUS_SPI_SIZE (8 << 20)
+#endif
#define MBUS_DFX_BASE 0xF6000000
#define MBUS_DFX_SIZE (1 << 20)
#define MBUS_BOOTROM_BASE 0xF8000000
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 02528e0..6b8c72a 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -308,19 +308,6 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
hang();
}
-/*
- * SPI0 CS0 Flash is mapped to address range 0xD4000000 - 0xD7FFFFFF by BootROM.
- * Proper U-Boot removes this direct mapping. So it is available only in SPL.
- */
-#if defined(CONFIG_SPL_ENV_IS_IN_SPI_FLASH) && \
- CONFIG_ENV_SPI_BUS == 0 && CONFIG_ENV_SPI_CS == 0 && \
- CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE <= 64*1024*1024
-void *env_sf_get_env_addr(void)
-{
- return (void *)0xD4000000 + CONFIG_ENV_OFFSET;
-}
-#endif
-
void board_init_f(ulong dummy)
{
int ret;