summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAmul Kumar Saha <amul.saha@samsung.com>2009-11-04 10:38:46 +0530
committerScott Wood <scottwood@freescale.com>2009-11-13 16:56:18 -0600
commitc758e947aa7d39a2be607ecdedd818ad300807b2 (patch)
tree66f66f55dd0e62619db7d4adea1b0d1140fb98af /common
parentcacbe919584193f64e74088e03f068e52775bb86 (diff)
downloadu-boot-imx-c758e947aa7d39a2be607ecdedd818ad300807b2.zip
u-boot-imx-c758e947aa7d39a2be607ecdedd818ad300807b2.tar.gz
u-boot-imx-c758e947aa7d39a2be607ecdedd818ad300807b2.tar.bz2
ENV Variable support for Flex-OneNAND
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>
Diffstat (limited to 'common')
-rw-r--r--common/env_onenand.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/env_onenand.c b/common/env_onenand.c
index dcf09de..23d2caa 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -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)) {