diff options
author | Nan Li <nan.li@amlogic.com> | 2015-10-13 16:52:50 +0800 |
---|---|---|
committer | Xiaobo Gu <xiaobo.gu@amlogic.com> | 2015-10-15 22:44:24 -0800 |
commit | cca8687efbda94e120e021d11b566e33b496fedb (patch) | |
tree | 1b52bdd713074828918c2b97f7812c5cfa945290 /common/env_storage.c | |
parent | dbf5f94407676f3cf15914d18919c1446f7b6ac1 (diff) | |
download | u-boot-odroid-c1-cca8687efbda94e120e021d11b566e33b496fedb.tar.gz |
PD#113598: storage: clear storage compatible for ENV
clear storage compatible for ENV
uboot will be start without storage limited.
Change-Id: I6a50d97e1c439b470decd1187c1ef91e9dc314b0
Signed-off-by: Nan Li <nan.li@amlogic.com>
Diffstat (limited to 'common/env_storage.c')
-rw-r--r-- | common/env_storage.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/common/env_storage.c b/common/env_storage.c new file mode 100644 index 0000000000..a6f5af875f --- /dev/null +++ b/common/env_storage.c @@ -0,0 +1,94 @@ +/* + * (C) Copyright 2000-2010 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * (C) Copyright 2008 + * Stuart Wood, Lab X Technologies <stuart.wood@labxtechnologies.com> + * + * (C) Copyright 2004 + * Jian Zhang, Texas Instruments, jzhang@ti.com. + * + * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com> + * Andreas Heppel <aheppel@sysgo.de> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <command.h> +#include <environment.h> +#include <linux/stddef.h> +#include <malloc.h> +#include <search.h> +#include <errno.h> + + +#ifdef CONFIG_STORE_COMPATIBLE +#include <emmc_partitions.h> +#include <partition_table.h> + +#ifdef ENV_IS_EMBEDDED +env_t *env_ptr = &environment; +#else /* ! ENV_IS_EMBEDDED */ +env_t *env_ptr; +#endif /* ENV_IS_EMBEDDED */ +DECLARE_GLOBAL_DATA_PTR; + +char *env_name_spec = "aml-storage"; + +/* env_init */ +extern int amlnand_env_int(void); +extern int mmc_env_init(void); +int env_init(void) +{ + /* use default */ + gd->env_addr = (ulong)&default_environment[0]; + gd->env_valid = 1; + + return 0; +} + +/* saveenv */ +#ifdef CONFIG_CMD_SAVEENV +extern int amlnand_saveenv(void); +extern int mmc_saveenv(void); +int saveenv(void) +{ + int ret; + + if (EMMC_BOOT_FLAG == device_boot_flag) { + ret = mmc_saveenv(); +#ifdef CONFIG_AML_NAND + } else if (NAND_BOOT_FLAG == device_boot_flag) { + ret = amlnand_saveenv(); +#endif + } else { + printf("%s() %d: device_boot_flag %d not exsit!\n", + __func__, __LINE__, device_boot_flag); + ret = -1; + } + return ret; +} +#endif /* CONFIG_CMD_SAVEENV */ + + +/* env_relocate_spec */ +extern void amlnand_env_relocate_spec(void); +extern void mmc_env_relocate_spec(void); +void env_relocate_spec(void) +{ + if (EMMC_BOOT_FLAG == device_boot_flag) { + mmc_env_relocate_spec(); +#ifdef CONFIG_AML_NAND + } else if (NAND_BOOT_FLAG == device_boot_flag) { + amlnand_env_relocate_spec(); +#endif + } else { + printf("%s() %d: device_boot_flag %d not exsit!\n", + __func__, __LINE__, device_boot_flag); + } + return; +} + + +#endif /* CONFIG_STORE_COMPATIBLE */
\ No newline at end of file |