Check config environment defines if
CONFIG_ENV_IS_IN_SPI_FLASH is defined

Signed-off-by: Oskari Lemmela <osk...@lemmela.net>
---
 include/environment.h | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/include/environment.h b/include/environment.h
index 7da1291d5b..d486c8899b 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -21,6 +21,19 @@
  *
  *************************************************************************/
 
+#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_IS_IN_SPI_FLASH)
+# if defined(CONFIG_ENV_SECT_SIZE) || defined(CONFIG_ENV_SIZE)
+#  ifndef      CONFIG_ENV_SECT_SIZE
+#   define     CONFIG_ENV_SECT_SIZE    CONFIG_ENV_SIZE
+#  endif
+#  ifndef      CONFIG_ENV_SIZE
+#   define     CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
+#  endif
+# else
+#  error "Both CONFIG_ENV_SECT_SIZE and CONFIG_ENV_SIZE undefined"
+# endif
+#endif
+
 #if defined(CONFIG_ENV_IS_IN_FLASH)
 # ifndef       CONFIG_ENV_ADDR
 #  define      CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)
@@ -32,16 +45,6 @@
 #  define      CONFIG_ENV_ADDR_REDUND  \
                (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET_REDUND)
 # endif
-# if defined(CONFIG_ENV_SECT_SIZE) || defined(CONFIG_ENV_SIZE)
-#  ifndef      CONFIG_ENV_SECT_SIZE
-#   define     CONFIG_ENV_SECT_SIZE    CONFIG_ENV_SIZE
-#  endif
-#  ifndef      CONFIG_ENV_SIZE
-#   define     CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
-#  endif
-# else
-#  error "Both CONFIG_ENV_SECT_SIZE and CONFIG_ENV_SIZE undefined"
-# endif
 # if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND)
 #  define CONFIG_ENV_SIZE_REDUND       CONFIG_ENV_SIZE
 # endif
-- 
2.17.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to