Skip to contentSkip to conversation

env: Added support to save env to spi through Kconfig

PATCH Superseded Vipul Kumar 2 participants 2 messages Jun 27, 2018 – Jun 28, 2018 Arm/Zynq architecture

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 env: Added support to save env to spi through Kconfig

This patch added support to enable CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET and CONFIG_ENV_SECT_SIZE through Kconfig for Zynq and Zynqmp.

---
 env/Kconfig                     | 27 +++++++++++++++++++++++++++
 include/configs/xilinx_zynqmp.h |  3 ---
 include/configs/zynq-common.h   | 13 -------------
 3 files changed, 27 insertions(+), 16 deletions(-)
env/Kconfig +27 -0
index 8618376..640a43f 100644
@@ -480,6 +480,33 @@ config ENV_SIZE
 
 endif
 
+if ARCH_ZYNQMP || ARCH_ZYNQ
+
+config ENV_OFFSET
+       hex "Environment Offset"
+       depends on !ENV_IS_NOWHERE
+       default 0x1E00000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+       default 0xE0000 if ARCH_ZYNQ
+       help
+         Offset from the start of the device (or partition)
+
+config ENV_SIZE
+       hex "Environment Size"
+       default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+       default 0x8000 if !ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+       default 0x20000 if ARCH_ZYNQ
+       help
+         Size of the environment storage area.
+
+config ENV_SECT_SIZE
+       hex "Environment Sector-Size"
+       default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+       default 0x20000 if !ENV_IS_NOWHERE && ARCH_ZYNQ
+       help
+         Size of the sector containing the environment.
+
+endif
+
 config USE_DEFAULT_ENV_FILE
        bool "Create default environment from file"
        help
include/configs/xilinx_zynqmp.h +0 -3
index e9086f9..7add9ea 100644
@@ -102,9 +102,6 @@
 # define PARTS_DEFAULT
 #endif
 
-/* Do not preserve environment */
-#define CONFIG_ENV_SIZE                        0x8000
-
 /* Monitor Command Prompt */
 /* Console I/O Buffer Size */
 #define CONFIG_SYS_CBSIZE              2048
include/configs/zynq-common.h +0 -13
index 55b983f..16426a7 100644
@@ -125,22 +125,9 @@
 # define CONFIG_SYS_EEPROM_SIZE                        1024 /* Bytes */
 #endif
 
-/* Total Size of Environment Sector */
-#ifndef CONFIG_ENV_SIZE
-# define CONFIG_ENV_SIZE                       (128 << 10)
-#endif
-
 /* Allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 
-/* Environment */
-#ifndef CONFIG_ENV_IS_NOWHERE
-# define CONFIG_ENV_SECT_SIZE          CONFIG_ENV_SIZE
-# ifndef CONFIG_ENV_OFFSET
-#  define CONFIG_ENV_OFFSET            0xE0000
-# endif
-#endif
-
 /* enable preboot to be loaded before CONFIG_BOOTDELAY */
 #define CONFIG_PREBOOT
 

--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#1 lore raw

PATCH 1/1 env: Added support to save env to spi through Kconfig

Quoted 22 lines · Vipul Kumar

This patch added support to enable CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET and CONFIG_ENV_SECT_SIZE through Kconfig for Zynq and Zynqmp.

---
 env/Kconfig                     | 27 +++++++++++++++++++++++++++
 include/configs/xilinx_zynqmp.h |  3 ---
 include/configs/zynq-common.h   | 13 -------------
 3 files changed, 27 insertions(+), 16 deletions(-)
env/Kconfig +4 -0
index 8618376..640a43f 100644
@@ -480,6 +480,33 @@ config ENV_SIZE
 
 endif
 
+if ARCH_ZYNQMP || ARCH_ZYNQ
+
+config ENV_OFFSET
+	hex "Environment Offset"

env/Kconfig config ENV_SIZE · line 496

Quoted 10 lines
env/Kconfig +10 -0
+	depends on !ENV_IS_NOWHERE
+	default 0x1E00000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+	default 0xE0000 if ARCH_ZYNQ
+	help
+	  Offset from the start of the device (or partition)
+
+config ENV_SIZE
+	hex "Environment Size"
+	default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+	default 0x8000 if !ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP

Isn't it enough just?

	default 0x8000 if ARCH_ZYNQMP

env/Kconfig config ENV_SIZE · line 504

Quoted 8 lines
env/Kconfig +8 -0
+	default 0x20000 if ARCH_ZYNQ
+	help
+	  Size of the environment storage area.
+
+config ENV_SECT_SIZE
+	hex "Environment Sector-Size"
+	default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+	default 0x20000 if !ENV_IS_NOWHERE && ARCH_ZYNQ

There should be default value
.config:633:warning: symbol value '' invalid for ENV_SECT_SIZE

Please check if this macro is used for that ENV_IS options.

Maybe simple

	default 0x40000 if ARCH_ZYNQMP
	default 0x20000 if ARCH_ZYNQ

should be enough.

Quoted 40 lines
env/Kconfig +5 -0
+	help
+	  Size of the sector containing the environment.
+
+endif
+
 config USE_DEFAULT_ENV_FILE
 	bool "Create default environment from file"
 	help
include/configs/xilinx_zynqmp.h +0 -3
index e9086f9..7add9ea 100644
@@ -102,9 +102,6 @@
 # define PARTS_DEFAULT
 #endif
 
-/* Do not preserve environment */
-#define CONFIG_ENV_SIZE			0x8000
-
 /* Monitor Command Prompt */
 /* Console I/O Buffer Size */
 #define CONFIG_SYS_CBSIZE		2048
include/configs/zynq-common.h +0 -6
index 55b983f..16426a7 100644
@@ -125,22 +125,9 @@
 # define CONFIG_SYS_EEPROM_SIZE			1024 /* Bytes */
 #endif
 
-/* Total Size of Environment Sector */
-#ifndef CONFIG_ENV_SIZE
-# define CONFIG_ENV_SIZE			(128 << 10)
-#endif
-
 /* Allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 
-/* Environment */

include/configs/zynq-common.h line 133

Quoted 10 lines
include/configs/zynq-common.h +0 -7
-#ifndef CONFIG_ENV_IS_NOWHERE
-# define CONFIG_ENV_SECT_SIZE		CONFIG_ENV_SIZE
-# ifndef CONFIG_ENV_OFFSET
-#  define CONFIG_ENV_OFFSET		0xE0000
-# endif
-#endif
-
 /* enable preboot to be loaded before CONFIG_BOOTDELAY */
 #define CONFIG_PREBOOT
 

Thanks,
Michal