Skip to contentSkip to conversation

arm: mvebu: env_sf_get_env_addr() missing check for CONFIG_ENV_IS_IN_SPI_FLASH

PATCH In review Tony Dinh 2 participants 2 messages Jun 6, 2024 – Jul 8, 2024

Subsystems (3)
lore
Share & tools
lore

Tony Dinh

author
#0 lore raw

PATCH 1/1 arm: mvebu: env_sf_get_env_addr() missing check for CONFIG_ENV_IS_IN_SPI_FLASH

The CONFIG_ENV_OFFSET is undefined if boot device is UART (CONFIG_MVEBU_SPL_BOOT_DEVICE_UART), or envs are not stored on flash (CONFIG_ENV_IS_NOWHERE). Check for CONFIG_ENV_IS_IN_SPI_FLASH as the first condition to determine whether env_sf_get_env_addr() should be provided.

---

 arch/arm/mach-mvebu/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-mvebu/cpu.c +1 -1
index 7c62a5dbb6..6dd729ae6e 100644
@@ -36,7 +36,7 @@ static const struct mbus_win windows[] = {
 };
 
 /* 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 && \
+#if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && 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)
 {
Signature · 1 line
2.39.2
#1 lore raw
Quoted 6 lines · Tony Dinh

The CONFIG_ENV_OFFSET is undefined if boot device is UART (CONFIG_MVEBU_SPL_BOOT_DEVICE_UART), or envs are not stored on flash (CONFIG_ENV_IS_NOWHERE). Check for CONFIG_ENV_IS_IN_SPI_FLASH as the first condition to determine whether env_sf_get_env_addr() should be provided.

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 10 lines

---

  arch/arm/mach-mvebu/cpu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-mvebu/cpu.c +0 -0
index 7c62a5dbb6..6dd729ae6e 100644

arch/arm/mach-mvebu/cpu.c static const struct mbus_win windows[] = { · line 42

Quoted 8 lines
arch/arm/mach-mvebu/cpu.c +1 -1
@@ -36,7 +36,7 @@ static const struct mbus_win windows[] = {
  };
 
  /* 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 && \
+#if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && 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)
  {

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]