summaryrefslogtreecommitdiff
path: root/common/env_nand.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-07-30 07:38:38 +0000
committerWolfgang Denk <wd@denx.de>2012-09-02 17:40:19 +0200
commit3801a15f67d66cf585db789d430c8f5808b0772b (patch)
tree7a99f6653a6e0e0edf146e5b8fa24fc0ef115a66 /common/env_nand.c
parentcee84e82576e00fb18b0134712ee8686bab36eaa (diff)
downloadu-boot-imx-3801a15f67d66cf585db789d430c8f5808b0772b.zip
u-boot-imx-3801a15f67d66cf585db789d430c8f5808b0772b.tar.gz
u-boot-imx-3801a15f67d66cf585db789d430c8f5808b0772b.tar.bz2
env_nand: align NAND buffers
This allows cache flush/invalidate operations to succeed on the buffers. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'common/env_nand.c')
-rw-r--r--common/env_nand.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/env_nand.c b/common/env_nand.c
index e8daec9..e635472 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -226,7 +226,7 @@ int saveenv(void)
int saveenv(void)
{
int ret = 0;
- env_t env_new;
+ ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
ssize_t len;
char *res;
nand_erase_options_t nand_erase_options;
@@ -238,20 +238,20 @@ int saveenv(void)
if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
return 1;
- res = (char *)&env_new.data;
+ res = (char *)&env_new->data;
len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
}
- env_new.crc = crc32(0, env_new.data, ENV_SIZE);
+ env_new->crc = crc32(0, env_new->data, ENV_SIZE);
puts("Erasing Nand...\n");
if (nand_erase_opts(&nand_info[0], &nand_erase_options))
return 1;
puts("Writing to Nand... ");
- if (writeenv(CONFIG_ENV_OFFSET, (u_char *)&env_new)) {
+ if (writeenv(CONFIG_ENV_OFFSET, (u_char *)env_new)) {
puts("FAILED!\n");
return 1;
}
@@ -398,7 +398,7 @@ void env_relocate_spec(void)
{
#if !defined(ENV_IS_EMBEDDED)
int ret;
- char buf[CONFIG_ENV_SIZE];
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
#if defined(CONFIG_ENV_OFFSET_OOB)
ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset);