]> git.sur5r.net Git - u-boot/commitdiff
ENV Variable support for Flex-OneNAND
authorAmul Kumar Saha <amul.saha@samsung.com>
Wed, 4 Nov 2009 05:08:46 +0000 (10:38 +0530)
committerScott Wood <scottwood@freescale.com>
Fri, 13 Nov 2009 22:56:18 +0000 (16:56 -0600)
Define and use CONFIG_ENV_ADDR_FLEX and CONFIG_ENV_SIZE_FLEX
for storing environment variables.

Signed-off-by: Rohit Hagargundgi <h.rohit@samsung.com>
Signed-off-by: Amul Kumar Saha <amul.saha@samsung.com>
common/env_onenand.c
include/configs/apollon.h

index dcf09dee1bcf9d3162ef20974677e5ed98a72752..23d2caa621dfee67d88b03b159b9a29056c753ce 100644 (file)
@@ -60,11 +60,14 @@ uchar env_get_char_spec(int index)
 void env_relocate_spec(void)
 {
        struct mtd_info *mtd = &onenand_mtd;
+       struct onenand_chip *this = &onenand_chip;
        loff_t env_addr;
        int use_default = 0;
        size_t retlen;
 
        env_addr = CONFIG_ENV_ADDR;
+       if (FLEXONENAND(this))
+               env_addr = CONFIG_ENV_ADDR_FLEX;
 
        /* Check OneNAND exist */
        if (mtd->writesize)
@@ -91,6 +94,7 @@ void env_relocate_spec(void)
 int saveenv(void)
 {
        struct mtd_info *mtd = &onenand_mtd;
+       struct onenand_chip *this = &onenand_chip;
        loff_t env_addr = CONFIG_ENV_ADDR;
        struct erase_info instr = {
                .callback       = NULL,
@@ -98,6 +102,12 @@ int saveenv(void)
        size_t retlen;
 
        instr.len = CONFIG_ENV_SIZE;
+       if (FLEXONENAND(this)) {
+               env_addr = CONFIG_ENV_ADDR_FLEX;
+               instr.len = CONFIG_ENV_SIZE_FLEX;
+               instr.len <<= onenand_mtd.eraseregions[0].numblocks == 1 ?
+                               1 : 0;
+       }
        instr.addr = env_addr;
        instr.mtd = mtd;
        if (mtd->erase(mtd, &instr)) {
index 575f60e1661d1dddd6a4760435bbd73406beb939..ddac5fbab12222fec957efcf35168a48b6121555 100644 (file)
@@ -76,6 +76,7 @@
  * Size of malloc() pool
  */
 #define        CONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */
+#define CONFIG_ENV_SIZE_FLEX SZ_256K
 #define        CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
 /* bytes reserved for initial data */
 #define        CONFIG_SYS_GBL_DATA_SIZE        128
 #define CONFIG_SYS_MONITOR_LEN         SZ_256K /* U-Boot image size */
 #define        CONFIG_ENV_IS_IN_ONENAND        1
 #define CONFIG_ENV_ADDR                0x00020000
+#define CONFIG_ENV_ADDR_FLEX   0x00040000
 
 #define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */