On Wed, 6 Aug 2008, Scott Wood wrote:

> On Wed, Aug 06, 2008 at 09:42:07PM +0200, Guennadi Liakhovetski wrote:
> >     block = offs / CFG_NAND_BLOCK_SIZE;
> > +   blocks = (uboot_size + offs - ((block - 1) * CFG_NAND_BLOCK_SIZE) - 1) /
> > +           CFG_NAND_BLOCK_SIZE;
> >     blockcopy_count = 0;
> >  
> > -   while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
> > +   while (blockcopy_count < blocks) {
> >             if (!nand_is_bad_block(mtd, block)) {
> >                     /*
> >                      * Skip bad blocks
> >                      */
> >                     for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
> >                             nand_read_page(mtd, block, page, dst);
> > -                           dst += CFG_NAND_PAGE_SIZE;
> > +                           /* Overwrite skipped pages */
> > +                           if (read >= offs)
> > +                                   dst += CFG_NAND_PAGE_SIZE;
> > +                           read += CFG_NAND_PAGE_SIZE;
> 
> This looks wrong if offs isn't within the first block.

Arrrgh, during the merge the following two lines went missing from the 
patch:

+       /* Recalculate offs as an offset inside a block */
+       offs -= CFG_NAND_BLOCK_SIZE * block;

which were there, for example, in v5.

> I've pushed a fixed and simplified version to nand-flash/testing -- can
> you test it?

Yes, it works. Your version is also better, since it skips unneeded pages 
instead of reading them in and overwriting, as mine did.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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: [EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to