summaryrefslogtreecommitdiff
path: root/common/env_onenand.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-01-12 23:42:32 +0100
committerWolfgang Denk <wd@denx.de>2010-01-12 23:42:32 +0100
commitf8b365ceb64e0b86bea243d783ff94687302cba9 (patch)
tree6587b8abeb00a265465d7db9a3f7617c78f742e7 /common/env_onenand.c
parentc76b64666e2b0d9d4eb8befc686c769db640533c (diff)
parentb821cead7d2147724d5f1d8ccbca40710faad38a (diff)
downloadu-boot-imx-f8b365ceb64e0b86bea243d783ff94687302cba9.zip
u-boot-imx-f8b365ceb64e0b86bea243d783ff94687302cba9.tar.gz
u-boot-imx-f8b365ceb64e0b86bea243d783ff94687302cba9.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
Diffstat (limited to 'common/env_onenand.c')
-rw-r--r--common/env_onenand.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/env_onenand.c b/common/env_onenand.c
index 23d2caa..cf997bf 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -60,15 +60,18 @@ uchar env_get_char_spec(int index)
void env_relocate_spec(void)
{
struct mtd_info *mtd = &onenand_mtd;
+#ifdef CONFIG_ENV_ADDR_FLEX
struct onenand_chip *this = &onenand_chip;
+#endif
loff_t env_addr;
int use_default = 0;
size_t retlen;
env_addr = CONFIG_ENV_ADDR;
+#ifdef CONFIG_ENV_ADDR_FLEX
if (FLEXONENAND(this))
env_addr = CONFIG_ENV_ADDR_FLEX;
-
+#endif
/* Check OneNAND exist */
if (mtd->writesize)
/* Ignore read fail */
@@ -94,7 +97,9 @@ void env_relocate_spec(void)
int saveenv(void)
{
struct mtd_info *mtd = &onenand_mtd;
+#ifdef CONFIG_ENV_ADDR_FLEX
struct onenand_chip *this = &onenand_chip;
+#endif
loff_t env_addr = CONFIG_ENV_ADDR;
struct erase_info instr = {
.callback = NULL,
@@ -102,12 +107,14 @@ int saveenv(void)
size_t retlen;
instr.len = CONFIG_ENV_SIZE;
+#ifdef CONFIG_ENV_ADDR_FLEX
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;
}
+#endif
instr.addr = env_addr;
instr.mtd = mtd;
if (mtd->erase(mtd, &instr)) {