diff mbox

[U-Boot] env_nand: align NAND buffers

Message ID 1343669918-2114-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit 3801a15f67d66cf585db789d430c8f5808b0772b
Headers show

Commit Message

Stephen Warren July 30, 2012, 5:38 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

This allows cache flush/invalidate operations to succeed on the buffers.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 common/env_nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Comments

Simon Glass July 30, 2012, 8:36 p.m. UTC | #1
On Mon, Jul 30, 2012 at 6:38 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> 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>

> ---
>  common/env_nand.c |   10 +++++-----
>  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));

I think this should b
>         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);
> --
> 1.7.0.4
>
Wolfgang Denk July 30, 2012, 9:10 p.m. UTC | #2
Dear Simon Glass,

In message <CAPnjgZ2gJLhmZyXB1DW=83GBdf1QNv_=Q+QfprAwCzx4Yq7_sA@mail.gmail.com> you wrote:
>
> > -       env_t   env_new;
> > +       ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
> 
> I think this should b

Should be ... ???

Best regards,

Wolfgang Denk
Simon Glass July 30, 2012, 9:43 p.m. UTC | #3
Hi Wolfgang,

On Mon, Jul 30, 2012 at 10:10 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Simon Glass,
>
> In message <CAPnjgZ2gJLhmZyXB1DW=83GBdf1QNv_=Q+QfprAwCzx4Yq7_sA@mail.gmail.com> you wrote:
>>
>> > -       env_t   env_new;
>> > +       ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
>>
>> I think this should b
>
> Should be ... ???

Sorry, I started a comment, but thought better of it. It looks fine to me.

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
> Be wiser than other people if you can, but do not tell them so.
>                                        -- Philip Earl of Chesterfield

Regards,
Simon
Scott Wood July 30, 2012, 11:01 p.m. UTC | #4
On 07/30/2012 12:38 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> This allows cache flush/invalidate operations to succeed on the buffers.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  common/env_nand.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)

Acked-by: Scott Wood <scottwood@freescale.com>

I'm assuming you want it to go with the Tegra patches and not via my tree.

-Scott
Scott Wood July 31, 2012, 4:39 p.m. UTC | #5
On 07/31/2012 10:59 AM, Tom Warren wrote:
> Scott,
> 
>> -----Original Message-----
>> From: Scott Wood [mailto:scottwood@freescale.com]
>> Sent: Monday, July 30, 2012 4:01 PM
>> To: Stephen Warren
>> Cc: Tom Warren; Simon Glass; U-Boot Mailing List; Stephen Warren
>> Subject: Re: [PATCH] env_nand: align NAND buffers
>>
>> On 07/30/2012 12:38 PM, Stephen Warren wrote:
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> This allows cache flush/invalidate operations to succeed on the buffers.
>>>
>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>> ---
>>>  common/env_nand.c |   10 +++++-----
>>>  1 files changed, 5 insertions(+), 5 deletions(-)
>>
>> Acked-by: Scott Wood <scottwood@freescale.com>
>>
>> I'm assuming you want it to go with the Tegra patches and not via my tree.
> I'm fine with taking the env_nand and cmd_nand changes thru the Tegra tree. Let me know if that's OK with you.

It's OK with me.

-Scott
Wolfgang Denk Sept. 2, 2012, 3:40 p.m. UTC | #6
Dear Stephen Warren,

In message <1343669918-2114-1-git-send-email-swarren@wwwdotorg.org> you wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> This allows cache flush/invalidate operations to succeed on the buffers.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  common/env_nand.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

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);