[U-Boot] [PATCH V6 3/5] nand spl: add NAND Library to new SPL
Aneesh V
aneesh at ti.com
Thu Jul 28 13:54:25 CEST 2011
On Thursday 28 July 2011 02:08 PM, Simon Schwarz wrote:
> Insert some NAND driver sources into NAND SPL library.
>
> Signed-off-by: Simon Schwarz<simonschwarzcor at gmail.com>
[snip ..]
> +
> +int nand_curr_device = -1;
Is nand_curr_device used anywhere?
> +static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
> +static nand_info_t info;
> +nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE];
Is nand_info used anywhere?
> +static struct nand_chip nand_chip;
Is nand_chip used anywhere? I see that this definition is shadowed in
function nand_init().
> +
> +#if (CONFIG_SYS_NAND_PAGE_SIZE<= 512)
[snip ..]
> +/*
> + * omap_spl_read_buf16 - [DEFAULT] read chip data into buffer
> + * @mtd: MTD device structure
> + * @buf: buffer to store date
typo: date instead of data.
> + * @len: number of bytes to read
> + *
> + * Default read function for 16bit buswith
> + *
> + * This function is based on nand_read_buf16 from nand_base.c. This version
> + * reads 32bit not 16bit although the bus only has 16bit.
> + */
> +static void omap_spl_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
> +{
> + int i;
> + struct nand_chip *chip = mtd->priv;
> + u32 *p = (u32 *) buf;
Why this variable p?
> + len>>= 2;
> +
> + for (i = 0; i< len; i++)
> + p[i] = readl(chip->IO_ADDR_R);
> +}
Should this function be called omap_spl_read_buf32() ?
Or still better, should this be added as nand_read_buf32() in
nand_base.c itself?
> +
> +/*
> + * omap_spl_read_buf - [DEFAULT] read chip data into buffer
> + * @mtd: MTD device structure
> + * @buf: buffer to store date
> + * @len: number of bytes to read
> + *
> + * Default read function for 8bit buswith
> + *
> + * This is the same function as this from nand_base.c nand_read_buf
> + */
> +static void omap_spl_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
> +{
> + int i;
> + struct nand_chip *chip = mtd->priv;
> +
> + for (i = 0; i< len; i++)
> + buf[i] = readb(chip->IO_ADDR_R);
> +}
> +#endif
What is the difference between this function and nand_read_buf() in
nand_base.c ?
best regards,
Aneesh
More information about the U-Boot
mailing list