From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Schwarz Date: Tue, 02 Aug 2011 10:15:20 +0200 Subject: [U-Boot] [PATCH V7 4/7] spl: add NAND Library to new SPL In-Reply-To: <20110801125814.57032c5b@schlenkerla.am.freescale.net> References: <1311842291-24837-1-git-send-email-simonschwarzcor@gmail.com> <1311958421-9607-1-git-send-email-simonschwarzcor@gmail.com> <1311958421-9607-5-git-send-email-simonschwarzcor@gmail.com> <20110801125814.57032c5b@schlenkerla.am.freescale.net> Message-ID: <4E37B218.8000405@gmail.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 08/01/2011 07:58 PM, Scott Wood wrote: > On Fri, 29 Jul 2011 18:53:38 +0200 > Simon Schwarz wrote: > >> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile >> index 8b598f6..fcd8b74 100644 >> --- a/drivers/mtd/nand/Makefile >> +++ b/drivers/mtd/nand/Makefile >> @@ -26,12 +26,18 @@ include $(TOPDIR)/config.mk >> LIB := $(obj)libnand.o >> >> ifdef CONFIG_CMD_NAND >> +ifdef CONFIG_SPL_BUILD >> +ifdef CONFIG_OMAP34XX >> +COBJS-y += nand_spl_simple.o >> +endif >> +else > > Please define a symbol for nand_spl_simple, and have the platform config > file select it. done. > >> +int nand_spl_load_image(loff_t offs, unsigned int size, void *dst) >> +{ >> + unsigned int block, lastblock; >> + unsigned int page; >> + >> + /* >> + * offs has to be aligned to a page address! >> + */ >> + block = offs / CONFIG_SYS_NAND_BLOCK_SIZE; >> + lastblock = (offs + size - 1) / CONFIG_SYS_NAND_BLOCK_SIZE; >> + page = (offs % CONFIG_SYS_NAND_BLOCK_SIZE) / CONFIG_SYS_NAND_PAGE_SIZE; > > Hmm, maybe it's better to leave offs as 32-bit, if we're going to be > dividing. The existing SPL has it as "unsigned int", and it's unlikely > that the SPL will be loading from offsets above 4GiB. Sorry about the back > and forth... hm ok. > >> +/* SPL interface to read a page */ >> +void nand_spl_read_page(loff_t offs, void *dst) >> +{ >> + int block, page; >> + /* calc the block */ >> + block = offs / CONFIG_SYS_NAND_BLOCK_SIZE; >> + /* calc the page */ >> + page = (offs % CONFIG_SYS_NAND_BLOCK_SIZE) / CONFIG_SYS_NAND_PAGE_SIZE; >> + /* read */ >> + nand_read_page(block, page, dst); >> +} > > How does this differ from nand_spl_load_image() with size == > CONFIG_SYS_NAND_PAGE_SIZE, other than the lack of bad block skipping? Damn bad block skipping. right. Will change. > -Scott > Regards & thanks for review!