[U-Boot] [PATCH 1/4] Fix the NAND size overflow issue.
Jin Zhengxiong-R64188
Jason.Jin at freescale.com
Tue Sep 23 04:20:58 CEST 2008
> -----Original Message-----
> From: Jens Gehrlein [mailto:Jens.Gehrlein at tqs.de]
> Sent: Friday, September 19, 2008 6:05 PM
> To: Jin Zhengxiong-R64188; Wood Scott-B07421
> Cc: u-boot at lists.denx.de
> Subject: RE: [U-Boot] [PATCH 1/4] Fix the NAND size overflow issue.
>
> Hi Jason,
>
> > -----Original Message-----
> > From: u-boot-bounces at lists.denx.de
> > [mailto:u-boot-bounces at lists.denx.de]On Behalf Of Jason Jin
> > Sent: Friday, September 19, 2008 11:33 AM
> > To: scottwood at freescale.com
> > Cc: u-boot at lists.denx.de; Jason Jin
> > Subject: [U-Boot] [PATCH 1/4] Fix the NAND size overflow issue.
> >
> >
> > When the NAND size is or large than 4G, the size will overflow, The
> > adjustment in this patch try to fix this.
> >
> > Signed-off-by: Jason Jin <Jason.jin at freescale.com>
> > ---
> > drivers/mtd/nand/nand.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/nand.c
> b/drivers/mtd/nand/nand.c index
> > ebd2acd..71a0e4b 100644
> > --- a/drivers/mtd/nand/nand.c
> > +++ b/drivers/mtd/nand/nand.c
> > @@ -63,11 +63,11 @@ void nand_init(void)
> > unsigned int size = 0;
> > for (i = 0; i < CFG_MAX_NAND_DEVICE; i++) {
> > nand_init_chip(&nand_info[i], &nand_chip[i],
> base_address[i]);
> > - size += nand_info[i].size;
> > + size += nand_info[i].size / 1024;
> > if (nand_curr_device == -1)
> > nand_curr_device = i;
> > }
> > - printf("%u MiB\n", size / (1024 * 1024));
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> According to this line I suppose, the value of
> nand_info[i].size is in Bytes. So, if the NAND chip is >= 4
> GiB this variable has already been overflowed, when
> nand_init_chip returns.
> Indeed, I didn't check the source code of the NAND driver. Am
> I wrong or did you modify the driver?
>
Hi, Jens,
You are right, the nand_info[i].size is in Bytes. and this patch just
can fix those chips with memory cell less than 4GBytes.
The nand_info[i].size is widly used in u-boot, If change it to MByte,
lots of tests need to do.
Thanks
Jaosn
More information about the U-Boot
mailing list