On Fri, 29 Jul 2011 18:53:38 +0200 Simon Schwarz <simonschwarz...@googlemail.com> 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. > +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... > +/* 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? -Scott _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot