[U-Boot] [PATCH 1/3] mtd/NAND: Add FSMC driver support

Scott Wood scottwood at freescale.com
Thu Mar 1 22:27:11 CET 2012


On 02/27/2012 03:38 AM, Amit Virdi wrote:
> +		/*
> +		 * This is a temporary erase check. A newly erased page read
> +		 * would result in an ecc error because the oob data is also
> +		 * erased to FF and the calculated ecc for an FF data is not
> +		 * FF..FF.
> +		 * This is a workaround to skip performing correction in case
> +		 * data is FF..FF
> +		 */
> +		for (k = 0; k < eccsize; k++) {
> +			if (*(p + k) != 0xff)
> +				break;
> +		}

Shouldn't this apply over the whole page (including the ECC bytes
themselves), not just the ECC chunk?  The data could legitimately be all
0xff except for one bit, and that bit could have flipped...

Will a freshly erased page show up as having correctable errors, or
uncorrectable?  If the latter, just hold off on declaring the page as an
ECC fail until you've read the whole thing, and then if you're about to
mark it failed, check wheter it's freshly erased.

> +	nand->options = 0;
> +#if defined(CONFIG_SYS_FSMC_NAND_16BIT)
> +	nand->options |= NAND_BUSWIDTH_16;
> +#endif

No on-flash BBT?

> +	/* Detect NAND chips */
> +	if (nand_scan_ident(mtd, 1, NULL))
> +		return -ENXIO;

You should #define CONFIG_SYS_NAND_SELF_INIT if you want to call this
yourself (see the documentation for what else you need to do).

> +/*
> + * There are 13 bytes of ecc for every 512 byte block and it has to be read
> + * consecutively and immediately after the 512 byte data block for hardware to
> + * generate the error bit offsets
> + * Managing the ecc bytes in the following way is easier. This way is similar to
> + * oobfree structure maintained already in u-boot nand driver
> + */
> +#define MAX_ECCPLACE_ENTRIES	32

No FSMC namespace... is/will this file included by anything but the FSMC
 driver?

-Scott



More information about the U-Boot mailing list