From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Thu, 28 Jul 2011 14:16:12 -0500 Subject: [U-Boot] [PATCH V6 3/5] nand spl: add NAND Library to new SPL In-Reply-To: <1311842291-24837-4-git-send-email-simonschwarzcor@gmail.com> References: <1311771039-31691-1-git-send-email-simonschwarzcor@gmail.com> <1311842291-24837-1-git-send-email-simonschwarzcor@gmail.com> <1311842291-24837-4-git-send-email-simonschwarzcor@gmail.com> Message-ID: <20110728141612.1dade0ab@schlenkerla.am.freescale.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, 28 Jul 2011 10:38:09 +0200 Simon Schwarz 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