[U-Boot] [PATCH v2 4/8] nand: Merge changes from Linux nand driver

Scott Wood scottwood at freescale.com
Tue Nov 1 22:59:49 CET 2011


On Wed, Oct 12, 2011 at 09:32:02AM +0200, Christian Hitz wrote:
> @@ -1862,6 +1927,13 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
>  	if (!writelen)
>  		return 0;
>  
> +	/* reject writes, which are not page aligned */
> +	if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
> +		printk(KERN_NOTICE "%s: Attempt to write not "
> +				"page aligned data\n", __func__);
> +		return -EINVAL;
> +	}
> +

We deliberately removed this check (see commit
f9a5254111a6be2a39464f65a96f4fc2305e3c76).  The length part breaks things
like "nand write <address> <offset> $filesize", and later in the
function there is already support for partial page writes with the rest
filled in by 0xff.

> @@ -2272,8 +2334,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
>  		 */
>  		if (bbt_masked_page != 0xffffffff &&
>  		    (page & BBT_PAGE_MASK) == bbt_masked_page)
> -			rewrite_bbt[chipnr] =
> -				((loff_t)page << chip->page_shift);
> +			    rewrite_bbt[chipnr] =
> +					((loff_t)page << chip->page_shift);

This looks like we're importing a whitespace glitch from Linux, with
no other change.

> +	chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
> +
> +	/* Read entire ID string */
> +
> +	for (i = 0; i < 8; i++)
> +		id_data[i] = chip->read_byte(mtd);

fsl_elbc_nand.c will now need NAND_CMD_READID to be updated to read 8
bytes (or more for ONFI, though that wouldn't be a regression) rather
than the current 5.

-Scott



More information about the U-Boot mailing list