[U-Boot] [PATCH v2 2/4] Environment support for Flex-OneNAND
Rohit Hagargundgi
h.rohit at samsung.com
Thu Dec 11 15:27:34 CET 2008
Define and use CONFIG_ENV_ADDR_FLEX and CONFIG_ENV_SIZE_FLEX
for storing environment variables.
Signed-off-by: Rohit Hagargundgi <h.rohit at samsung.com>
---
common/env_onenand.c | 10 ++++++++++
include/configs/apollon.h | 2 ++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/common/env_onenand.c b/common/env_onenand.c
index dbccc79..cd44781 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -58,11 +58,14 @@ uchar env_get_char_spec(int index)
void env_relocate_spec(void)
{
+ struct onenand_chip *this = &onenand_chip;
unsigned long 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 (onenand_mtd.writesize)
@@ -89,6 +92,7 @@ void env_relocate_spec(void)
int saveenv(void)
{
+ struct onenand_chip *this = &onenand_chip;
unsigned long env_addr = CONFIG_ENV_ADDR;
struct erase_info instr = {
.callback = NULL,
@@ -96,6 +100,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 = &onenand_mtd;
if (onenand_erase(&onenand_mtd, &instr)) {
diff --git a/include/configs/apollon.h b/include/configs/apollon.h
index dff47fc..0fcb22b 100644
--- a/include/configs/apollon.h
+++ b/include/configs/apollon.h
@@ -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
@@ -256,6 +257,7 @@
#define CONFIG_SYS_ONENAND_BASE 0x00000000
#define CONFIG_ENV_IS_IN_ONENAND 1
#define CONFIG_ENV_ADDR 0x00020000
+#define CONFIG_ENV_ADDR_FLEX 0x00040000
#ifdef CONFIG_SYS_USE_UBI
#define CONFIG_JFFS2_CMDLINE
--
1.5.4.3
More information about the U-Boot
mailing list