[U-Boot-Users] [PATCH 2/7 v6] nand_spl: Support page-aligned read in nand_load, use chipselect

Scott Wood scottwood at freescale.com
Thu Aug 7 00:54:25 CEST 2008


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.

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

-Scott




More information about the U-Boot mailing list