Skip to contentSkip to conversation

board: pic32mzdask: add flash support for environments.

PATCH Superseded Purna Chandra Mandal 1 participant 1 message Dec 17, 2015

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 9/18 board: pic32mzdask: add flash support for environments.

Add flash chip information and environment location (for environment in flash).

---

 include/configs/pic32mzdask.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
include/configs/pic32mzdask.h +16 -2
index 9f867ed..89925f6 100644
@@ -75,7 +75,19 @@
 /*-------------------------------------------------
  * FLASH configuration
  */
-#define CONFIG_SYS_NO_FLASH
+#define CONFIG_SYS_MAX_FLASH_BANKS    2  /* max number of memory banks */
+#define CONFIG_SYS_MAX_FLASH_SECT    64 /* max number of sectors */
+#define CONFIG_SYS_FLASH_SIZE        (1 << 20) /* 1M, size of one bank */
+#define PHYS_FLASH_1            0x1D000000 /* Flash Bank #1 */
+#define PHYS_FLASH_2            0x1D100000 /* Flash Bank #2 */
+#define CONFIG_SYS_FLASH_BANKS_LIST    {PHYS_FLASH_1, PHYS_FLASH_2}
+#define CONFIG_SYS_FLASH_BASE        PHYS_FLASH_1
+#define PHYS_FLASH_SECT_SIZE        \
+    (CONFIG_SYS_FLASH_SIZE / CONFIG_SYS_MAX_FLASH_SECT)
+
+/* FLASH erase/programming timeout (in ticks) */
+#define CONFIG_SYS_FLASH_ERASE_TOUT    (2 * CONFIG_SYS_HZ)
+#define CONFIG_SYS_FLASH_WRITE_TOUT    (25 * CONFIG_SYS_HZ)
 
 /*------------------------------------------------------------
  * Console Configuration
@@ -96,8 +108,10 @@
 /* -------------------------------------------------
  * Environment
  */
-#define CONFIG_ENV_IS_NOWHERE    1
+#define CONFIG_ENV_IS_IN_FLASH    1
+#define CONFIG_ENV_SECT_SIZE    0x4000 /* 16K(one sector) for env */
 #define CONFIG_ENV_SIZE        0x4000
+#define CONFIG_ENV_ADDR        0x9d0fc000 /* Last sector from Bank 0 */
 
 /* ---------------------------------------------------------------------
  * Board boot configuration
Signature · 1 line
1.8.3.1