[U-Boot] [PATCH V6 3/5] nand spl: add NAND Library to new SPL
Scott Wood
scottwood at freescale.com
Thu Jul 28 21:16:12 CEST 2011
On Thu, 28 Jul 2011 10:38:09 +0200
Simon Schwarz <simonschwarzcor at googlemail.com> wrote:
> +CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
Not sure what this has to do with NAND.
> +int nand_curr_device = -1;
> +static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
> +static nand_info_t info;
> +nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE];
> +static struct nand_chip nand_chip;
It doesn't look like nand_info or nand_curr_device are used.
> +/* nand_boot()-function from the old nand_spl ripped apart into
> + * - nand_init()
> + * - nand_spl_load_image()
> + * - nand_deselect()
> + */
References to what the code used to look like should go in the commit
message -- they're not relevant to someone reading this code years from
now.
Splitting this up is going to add bytes -- is it really needed?
> +void nand_init(void)
> +{
> + struct nand_chip nand_chip;
This is shadowing the file-scope nand_chip.
> + /*
> + * Init board specific nand support
> + */
> + nand_chip.select_chip = NULL;
> + info.priv = &nand_chip;
> + nand_chip.IO_ADDR_R = nand_chip.IO_ADDR_W =
> + (void __iomem *)CONFIG_SYS_NAND_BASE;
> + nand_chip.dev_ready = NULL; /* preset to NULL */
> + nand_chip.options = 0;
Once you switch to the BSS nand_cihp, you can get rid of the
zero init.
> +/* Copy image from NAND to RAM
> + * offs: Offset in NAND flash
> + * size: size of image
> + * dst: destination pointer to RAM
> + */
> +void nand_spl_load_image(loff_t offs, unsigned int size, uchar *dst)
> +{
> + nand_load(&info, offs, size, dst);
> +}
Just strip the mtd_info parameter from nand_load -- no need for a wrapper.
-Scott
More information about the U-Boot
mailing list