From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aneesh V Date: Thu, 28 Jul 2011 17:24:25 +0530 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: <4E314DF1.3090007@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 [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