public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nand_spl_simple: store ecc data on the stack
Date: Tue, 13 Dec 2011 11:33:36 +0100	[thread overview]
Message-ID: <4EE72A00.70708@denx.de> (raw)
In-Reply-To: <4EE54619.1070000@emcraft.com>

On 12/12/2011 01:08, Ilya Yanok wrote:
> Hi Stefano,
> 
> thanks for posting this. There is a couple of comments below.
> 
> On 11.12.2011 21:22, Stefano Babic wrote:
>> diff --git a/drivers/mtd/nand/nand_spl_simple.c b/drivers/mtd/nand/nand_spl_simple.c
>> index ed821f2..a3d1af0 100644
>> --- a/drivers/mtd/nand/nand_spl_simple.c
>> +++ b/drivers/mtd/nand/nand_spl_simple.c
>> @@ -145,9 +145,9 @@ static int nand_is_bad_block(int block)
>>  static int nand_read_page(int block, int page, uchar *dst)
>>  {
>>  	struct nand_chip *this = mtd.priv;
>> -	u_char *ecc_calc;
>> -	u_char *ecc_code;
>> -	u_char *oob_data;
>> +	u_char ecc_calc[CONFIG_SYS_NAND_ECCSTEPS * CONFIG_SYS_NAND_ECCBYTES];
>> +	u_char ecc_code[CONFIG_SYS_NAND_ECCTOTAL];
> 
> Doesn't ECCTOTAL always equal to ECCSTEPS * ECCBYTES?

I see. Then we can also remove CONFIG_SYS_NAND_ECCTOTAL from the
configuration files, because it is not useful. I will do in V2.

By grepping the code, the same issue is present in nand_spl/nand_boot.c,
too. This is part of the old spl code, I do not know if we have also to
fix this one. IMHO we can only fix nand_spl_simple.c, because the other
one will become obsolete and there is not probelms with current boards.

> 
>> +	u_char oob_data[CONFIG_SYS_NAND_OOBSIZE];
> 
> I think we can save a few bytes by placing ecc_code and oob_data into a
> union. We only need oob_data to get ecc_code...

Checking the real values I see that ECCTOTAL is small - 8 bytes on the
TI we are currently testing, and it has not a big value on other
architectures. So I think we can avoid the union, also because this can
generate overlapping when the oob data is copied: I mean in case
nand_ecc_pos[i] is smaller as CONFIG_SYS_NAND_ECCTOTAL at:

 for (i = 0; i < CONFIG_SYS_NAND_ECCTOTAL; i++)
                ecc_code[i] = oob_data[nand_ecc_pos[i]];



Regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de
=====================================================================

  reply	other threads:[~2011-12-13 10:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-11 17:22 [U-Boot] [PATCH] nand_spl_simple: store ecc data on the stack Stefano Babic
2011-12-12  0:08 ` Ilya Yanok
2011-12-13 10:33   ` Stefano Babic [this message]
2011-12-13 11:30 ` [U-Boot] [PATCH V2] " Stefano Babic
2011-12-13 15:58   ` Tom Rini
2011-12-13 17:31     ` Stefano Babic
2011-12-13 17:50 ` [U-Boot] [PATCH V3] " Stefano Babic
2011-12-13 18:04   ` Tom Rini
2011-12-13 18:18     ` Wolfgang Denk
2011-12-13 18:33       ` Tom Rini
2011-12-13 18:45         ` Scott Wood
2011-12-13 18:54           ` Tom Rini
2011-12-13 19:26           ` Stefano Babic
2011-12-13 18:48       ` stefano babic
2011-12-13 18:52     ` Scott Wood
2011-12-13 18:54       ` Tom Rini
2011-12-13 18:47   ` Scott Wood
2011-12-13 19:33 ` [U-Boot] [PATCH V4] " Stefano Babic
2011-12-13 21:30   ` Tom Rini
2011-12-14  8:22   ` Simon Schwarz
2011-12-14  8:49     ` Stefano Babic
     [not found]       ` <4EE9B7F8.5060305@gmail.com>
2011-12-15  9:53         ` Stefano Babic
2012-01-10 23:01   ` Scott Wood
2012-01-10 23:24     ` Tom Rini
2012-02-03 20:17       ` Albert ARIBAUD
2012-02-03 21:47         ` Tom Rini
2011-12-15  9:55 ` [U-Boot] [PATCH V5] " Stefano Babic
2011-12-15 22:18   ` Scott Wood
2012-01-05 23:12   ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE72A00.70708@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox