On Tue, Aug 05, 2008 at 03:36:43PM +0200, Guennadi Liakhovetski wrote:
>       /*
> -      * offs has to be aligned to a block address!
> +      * offs has to be aligned to a page address!
>        */
>       block = offs / CFG_NAND_BLOCK_SIZE;
> +     /* Recalculate offs as an offset inside a block */
> +     offs -= CFG_NAND_BLOCK_SIZE * block;
>       blockcopy_count = 0;
>  
> -     while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
> -             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;
> +     while (blockcopy_count < ((uboot_size + CFG_NAND_BLOCK_SIZE - 1) /
> +                               CFG_NAND_BLOCK_SIZE)) {

If you're going to allow offs to be block-unaligned, I think this
calculation needs to change.  For example: blocksize 16K, offset 14K, and
length 256K would try to read 16 blocks, when it needs to read 17.

-Scott

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