[U-Boot] [RFC PATCH 5/8] NAND: omap_gpmc.c: add nand_spl support

Scott Wood scottwood at freescale.com
Tue Jan 4 23:24:37 CET 2011


On Mon, Dec 27, 2010 at 05:47:05PM -0700, John Rigby wrote:
> CC: Scott Wood <scootwood at freescale.com>

It's "scottwood", not "scootwood".

> +static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
> +{
> +	int i;
> +	struct nand_chip *chip = mtd->priv;
> +
> +#ifndef CONFIG_SYS_NAND_BUSWIDTH_16
> +	for (i = 0; i < len; i++)
> +		buf[i] = readb(chip->IO_ADDR_R);
> +#else
> +	u16 *p = (u16 *) buf;
> +
> +	len >>= 1;
> +	for (i = 0; i < len; i++)
> +		p[i] = readw(chip->IO_ADDR_R);
> +#endif
> +}
> +#endif

This looks like a duplication of the default read_buf implementations in
nand_base.c -- they should go in nand_boot.c with an #ifdef to keep it from
increasing the size of any implementation that overrides it.

> +#ifndef CONFIG_NAND_SPL
>  	/* Default ECC mode */
>  	nand->ecc.mode = NAND_ECC_SOFT;
> +#else
> +        nand->ecc.mode = NAND_ECC_HW;
> +        nand->ecc.layout = &hw_nand_oob;
> +        nand->ecc.size = 512;
> +        nand->ecc.bytes = 3;
> +        nand->ecc.hwctl = omap_enable_hwecc;
> +        nand->ecc.correct = omap_correct_data;
> +        nand->ecc.calculate = omap_calculate_ecc;
> +	nand->read_buf = nand_read_buf;
> +        omap_hwecc_init(nand);
> +#endif

Indent with tabs.

-Scott



More information about the U-Boot mailing list