On 09/30/2011 04:10 AM, Jin Zhengxiong-R64188 wrote:
> I once met the similar issue with 2011.03 base and fixed it with following 
> patch, But 
> I didn't do a detail checking for that, FYI...
> 
> @@ -499,6 +499,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, 
> size_t *length,
>               return -EINVAL;
>       }
>  
> +#ifndef CONFIG_CMD_NAND_YAFFS
>       if (!need_skip) {
>               rval = nand_write (nand, offset, length, buffer);
>               if (rval == 0)
> @@ -509,13 +510,12 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t 
> offset, size_t *length,
>                       offset, rval);
>               return rval;
>       }
> -
> +#endif

This should be a runtime check for whether yaffs was actually requested.
 The current code does something similar for WITH_DROP_FFS.

Or perhaps we should just drop this optimization altogether, barring
someone demonstrating that it makes a huge performance difference.

>       while (left_to_write > 0) {
>               size_t block_offset = offset & (nand->erasesize - 1);
>               size_t write_size;
>  
>               WATCHDOG_RESET ();
> -
>               if (nand_block_isbad (nand, offset & ~(nand->erasesize - 1))) {
>                       printf ("Skip bad block 0x%08llx\n",
>                               offset & ~(nand->erasesize - 1));
> @@ -546,7 +546,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, 
> size_t *length,
>                               ops.oobbuf = ops.datbuf + pagesize;
>  
>                               rval = nand->write_oob(nand, offset, &ops);
> -                             if (!rval)
> +                             if ( rval != 0)
>                                       break;
>  
>                               offset += pagesize;

Drop these.

-Scott

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to