Message ID | 1345481154-7050-18-git-send-email-trini@ti.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
On 08/20/2012 11:45 AM, Tom Rini wrote: > diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile > index 29dc20e..5475c8c 100644 > --- a/drivers/mtd/nand/Makefile > +++ b/drivers/mtd/nand/Makefile > @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o > > ifdef CONFIG_CMD_NAND > ifdef CONFIG_SPL_BUILD > -ifdef CONFIG_SPL_NAND_SIMPLE > -COBJS-y += nand_spl_simple.o > -endif > -ifdef CONFIG_SPL_NAND_LOAD > -COBJS-y += nand_spl_load.o > -endif > +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o OK, I was wrong, I will complain. :-) The commit message didn't mention you were changing CONFIG_SPL_NAND_SIMPLE. That needs to be able to support small SPLs. Is your new "enhanced" nand_spl_load small enough (with proper configuration) to work with all the SPLs that currently use nand_spl/nand_boot.c (e.g. PPC 44x)? -Scott
On 08/24/2012 04:09 PM, Scott Wood wrote: > On 08/20/2012 11:45 AM, Tom Rini wrote: >> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile >> index 29dc20e..5475c8c 100644 >> --- a/drivers/mtd/nand/Makefile >> +++ b/drivers/mtd/nand/Makefile >> @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o >> >> ifdef CONFIG_CMD_NAND >> ifdef CONFIG_SPL_BUILD >> -ifdef CONFIG_SPL_NAND_SIMPLE >> -COBJS-y += nand_spl_simple.o >> -endif >> -ifdef CONFIG_SPL_NAND_LOAD >> -COBJS-y += nand_spl_load.o >> -endif >> +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o > > OK, I was wrong, I will complain. :-) > > The commit message didn't mention you were changing > CONFIG_SPL_NAND_SIMPLE. That needs to be able to support small SPLs. > Is your new "enhanced" nand_spl_load small enough (with proper > configuration) to work with all the SPLs that currently use > nand_spl/nand_boot.c (e.g. PPC 44x)? Oh, and please CC me on NAND patches so that I can see them sooner. -Scott
On Fri, Aug 24, 2012 at 04:10:44PM -0500, Scott Wood wrote: > On 08/24/2012 04:09 PM, Scott Wood wrote: > > On 08/20/2012 11:45 AM, Tom Rini wrote: > >> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile > >> index 29dc20e..5475c8c 100644 > >> --- a/drivers/mtd/nand/Makefile > >> +++ b/drivers/mtd/nand/Makefile > >> @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o > >> > >> ifdef CONFIG_CMD_NAND > >> ifdef CONFIG_SPL_BUILD > >> -ifdef CONFIG_SPL_NAND_SIMPLE > >> -COBJS-y += nand_spl_simple.o > >> -endif > >> -ifdef CONFIG_SPL_NAND_LOAD > >> -COBJS-y += nand_spl_load.o > >> -endif > >> +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o > > > > OK, I was wrong, I will complain. :-) > > > > The commit message didn't mention you were changing > > CONFIG_SPL_NAND_SIMPLE. That needs to be able to support small SPLs. > > Is your new "enhanced" nand_spl_load small enough (with proper > > configuration) to work with all the SPLs that currently use > > nand_spl/nand_boot.c (e.g. PPC 44x)? > > Oh, and please CC me on NAND patches so that I can see them sooner. Should have put nand in there for patman, sorry.
On Fri, Aug 24, 2012 at 04:09:13PM -0500, Scott Wood wrote: > On 08/20/2012 11:45 AM, Tom Rini wrote: > > diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile > > index 29dc20e..5475c8c 100644 > > --- a/drivers/mtd/nand/Makefile > > +++ b/drivers/mtd/nand/Makefile > > @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o > > > > ifdef CONFIG_CMD_NAND > > ifdef CONFIG_SPL_BUILD > > -ifdef CONFIG_SPL_NAND_SIMPLE > > -COBJS-y += nand_spl_simple.o > > -endif > > -ifdef CONFIG_SPL_NAND_LOAD > > -COBJS-y += nand_spl_load.o > > -endif > > +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o > > OK, I was wrong, I will complain. :-) > > The commit message didn't mention you were changing > CONFIG_SPL_NAND_SIMPLE. That needs to be able to support small SPLs. > Is your new "enhanced" nand_spl_load small enough (with proper > configuration) to work with all the SPLs that currently use > nand_spl/nand_boot.c (e.g. PPC 44x)? OK, I suspect it would be close-to-fail. There's a "few" bytes overhead to parse the header and so forth, but it also allows for direct Linux booting. Is that something you want for these machines or no? It wouldn't be hard to put the enhanced version nand_spl_simple.c and leave nand_spl_load.c alone.
On 08/24/2012 04:20 PM, Tom Rini wrote: > On Fri, Aug 24, 2012 at 04:09:13PM -0500, Scott Wood wrote: >> On 08/20/2012 11:45 AM, Tom Rini wrote: >>> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile >>> index 29dc20e..5475c8c 100644 >>> --- a/drivers/mtd/nand/Makefile >>> +++ b/drivers/mtd/nand/Makefile >>> @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o >>> >>> ifdef CONFIG_CMD_NAND >>> ifdef CONFIG_SPL_BUILD >>> -ifdef CONFIG_SPL_NAND_SIMPLE >>> -COBJS-y += nand_spl_simple.o >>> -endif >>> -ifdef CONFIG_SPL_NAND_LOAD >>> -COBJS-y += nand_spl_load.o >>> -endif >>> +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o >> >> OK, I was wrong, I will complain. :-) >> >> The commit message didn't mention you were changing >> CONFIG_SPL_NAND_SIMPLE. That needs to be able to support small SPLs. >> Is your new "enhanced" nand_spl_load small enough (with proper >> configuration) to work with all the SPLs that currently use >> nand_spl/nand_boot.c (e.g. PPC 44x)? > > OK, I suspect it would be close-to-fail. There's a "few" bytes overhead > to parse the header and so forth, but it also allows for direct Linux > booting. Is that something you want for these machines or no? I don't think there's room for any new features at all. The SPL must fit in 4K. Canyonlands is at 4020 bytes currently. Why can't the new functionality be conditionally built? > It wouldn't be hard to put the enhanced version nand_spl_simple.c and leave > nand_spl_load.c alone. nand_spl_simple.c is what I'm talking about needing to not expand. Why does the new stuff need to be bound to a specific NAND boot implementation? -Scott
On Fri, Aug 24, 2012 at 04:30:45PM -0500, Scott Wood wrote: > On 08/24/2012 04:20 PM, Tom Rini wrote: > > On Fri, Aug 24, 2012 at 04:09:13PM -0500, Scott Wood wrote: > >> On 08/20/2012 11:45 AM, Tom Rini wrote: > >>> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile > >>> index 29dc20e..5475c8c 100644 > >>> --- a/drivers/mtd/nand/Makefile > >>> +++ b/drivers/mtd/nand/Makefile > >>> @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o > >>> > >>> ifdef CONFIG_CMD_NAND > >>> ifdef CONFIG_SPL_BUILD > >>> -ifdef CONFIG_SPL_NAND_SIMPLE > >>> -COBJS-y += nand_spl_simple.o > >>> -endif > >>> -ifdef CONFIG_SPL_NAND_LOAD > >>> -COBJS-y += nand_spl_load.o > >>> -endif > >>> +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o > >> > >> OK, I was wrong, I will complain. :-) > >> > >> The commit message didn't mention you were changing > >> CONFIG_SPL_NAND_SIMPLE. That needs to be able to support small SPLs. > >> Is your new "enhanced" nand_spl_load small enough (with proper > >> configuration) to work with all the SPLs that currently use > >> nand_spl/nand_boot.c (e.g. PPC 44x)? > > > > OK, I suspect it would be close-to-fail. There's a "few" bytes overhead > > to parse the header and so forth, but it also allows for direct Linux > > booting. Is that something you want for these machines or no? > > I don't think there's room for any new features at all. The SPL must > fit in 4K. Canyonlands is at 4020 bytes currently. > > Why can't the new functionality be conditionally built? I'm not sure there would be a point. The nand_boot() method is read u-boot.bin from nand, read env from nand and read redundant env from nand, boot u-boot. The spl_nand_load_image method doesn't boot u-boot, reads the image header, parses, reads the image. In short, I don't think a modified version would gain us anything more than a lot of complex #ifdefs :( > > It wouldn't be hard to put the enhanced version nand_spl_simple.c and leave > > nand_spl_load.c alone. > > nand_spl_simple.c is what I'm talking about needing to not expand. Why > does the new stuff need to be bound to a specific NAND boot implementation? Sorry, I got it backwards. I mean (and did locally) leave the very tiny and simple approach alone, add to the version where we have a little, but not a lot, of space.
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index 1848055..721ae4d 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c @@ -60,7 +60,7 @@ void spl_board_init(void) u32 spl_boot_device(void) { -#ifdef CONFIG_SPL_NAND_LOAD +#ifdef CONFIG_SPL_NAND_SIMPLE return BOOT_DEVICE_NAND; #elif defined(CONFIG_SPL_SPI_LOAD) return BOOT_DEVICE_SPI; diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile index 837e22e..0e0b641 100644 --- a/arch/arm/cpu/armv7/omap-common/Makefile +++ b/arch/arm/cpu/armv7/omap-common/Makefile @@ -45,12 +45,6 @@ COBJS += boot-common.o SOBJS += lowlevel_init.o endif -ifdef CONFIG_SPL_BUILD -ifdef CONFIG_SPL_NAND_SUPPORT -COBJS += spl_nand.o -endif -endif - ifndef CONFIG_SPL_BUILD ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) COBJS += mem-common.o diff --git a/arch/arm/cpu/armv7/omap-common/spl_nand.c b/arch/arm/cpu/armv7/omap-common/spl_nand.c deleted file mode 100644 index 9e9206c..0000000 --- a/arch/arm/cpu/armv7/omap-common/spl_nand.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2011 - * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de> - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ -#include <common.h> -#include <spl.h> -#include <asm/u-boot.h> -#include <asm/utils.h> -#include <asm/io.h> -#include <nand.h> -#include <version.h> - -void spl_nand_load_image(void) -{ - struct image_header *header; - int *src __attribute__((unused)); - int *dst __attribute__((unused)); - - debug("spl: nand - using hw ecc\n"); - nand_init(); - - /*use CONFIG_SYS_TEXT_BASE as temporary storage area */ - header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); -#ifdef CONFIG_SPL_OS_BOOT - if (!spl_start_uboot()) { - /* - * load parameter image - * load to temp position since nand_spl_load_image reads - * a whole block which is typically larger than - * CONFIG_CMD_SPL_WRITE_SIZE therefore may overwrite - * following sections like BSS - */ - nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS, - CONFIG_CMD_SPL_WRITE_SIZE, - (void *)CONFIG_SYS_TEXT_BASE); - /* copy to destintion */ - for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR, - src = (int *)CONFIG_SYS_TEXT_BASE; - src < (int *)(CONFIG_SYS_TEXT_BASE + - CONFIG_CMD_SPL_WRITE_SIZE); - src++, dst++) { - writel(readl(src), dst); - } - - /* load linux */ - nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, - CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); - spl_parse_image_header(header); - if (header->ih_os == IH_OS_LINUX) { - /* happy - was a linux */ - nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, - spl_image.size, (void *)spl_image.load_addr); - nand_deselect(); - return; - } else { - printf("The Expected Linux image was not" - "found. Please check your NAND" - "configuration.\n"); - printf("Trying to start u-boot now...\n"); - } - } -#endif -#ifdef CONFIG_NAND_ENV_DST - nand_spl_load_image(CONFIG_ENV_OFFSET, - CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); - spl_parse_image_header(header); - nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size, - (void *)spl_image.load_addr); -#ifdef CONFIG_ENV_OFFSET_REDUND - nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, - CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); - spl_parse_image_header(header); - nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size, - (void *)spl_image.load_addr); -#endif -#endif - /* Load u-boot */ - nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, - CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); - spl_parse_image_header(header); - nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, - spl_image.size, (void *)spl_image.load_addr); - nand_deselect(); -} diff --git a/doc/README.SPL b/doc/README.SPL index e4a5ac3..3faf91c 100644 --- a/doc/README.SPL +++ b/doc/README.SPL @@ -64,7 +64,6 @@ CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o) CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o) CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o) CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) -CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o) CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o) diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 29dc20e..5475c8c 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o ifdef CONFIG_CMD_NAND ifdef CONFIG_SPL_BUILD -ifdef CONFIG_SPL_NAND_SIMPLE -COBJS-y += nand_spl_simple.o -endif -ifdef CONFIG_SPL_NAND_LOAD -COBJS-y += nand_spl_load.o -endif +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o else COBJS-y += nand.o COBJS-y += nand_bbt.o diff --git a/drivers/mtd/nand/nand_spl_load.c b/drivers/mtd/nand/nand_spl_load.c index 215459a..c1c45b6 100644 --- a/drivers/mtd/nand/nand_spl_load.c +++ b/drivers/mtd/nand/nand_spl_load.c @@ -20,36 +20,77 @@ #include <common.h> #include <nand.h> +#include <spl.h> +#include <asm/io.h> -/* - * The main entry for NAND booting. It's necessary that SDRAM is already - * configured and available since this code loads the main U-Boot image - * from NAND into SDRAM and starts it from there. - */ -void nand_boot(void) +void spl_nand_load_image(void) { - __attribute__((noreturn)) void (*uboot)(void); + struct image_header *header; + int *src __attribute__((unused)); + int *dst __attribute__((unused)); - /* - * Load U-Boot image from NAND into RAM - */ - nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, - CONFIG_SYS_NAND_U_BOOT_SIZE, - (void *)CONFIG_SYS_NAND_U_BOOT_DST); + nand_init(); -#ifdef CONFIG_NAND_ENV_DST - nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, - (void *)CONFIG_NAND_ENV_DST); + /* use CONFIG_SYS_TEXT_BASE as temporary storage area */ + header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); +#ifdef CONFIG_SPL_OS_BOOT + if (!spl_start_uboot()) { + /* + * load parameter image + * load to temp position since nand_spl_load_image reads + * a whole block which is typically larger than + * CONFIG_CMD_SPL_WRITE_SIZE therefore may overwrite + * following sections like BSS + */ + nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS, + CONFIG_CMD_SPL_WRITE_SIZE, + (void *)CONFIG_SYS_TEXT_BASE); + /* copy to destintion */ + for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR, + src = (int *)CONFIG_SYS_TEXT_BASE; + src < (int *)(CONFIG_SYS_TEXT_BASE + + CONFIG_CMD_SPL_WRITE_SIZE); + src++, dst++) { + writel(readl(src), dst); + } + /* load linux */ + nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); + spl_parse_image_header(header); + if (header->ih_os == IH_OS_LINUX) { + /* happy - was a linux */ + nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, + spl_image.size, (void *)spl_image.load_addr); + nand_deselect(); + return; + } else { + puts("The Expected Linux image was not " + "found. Please check your NAND " + "configuration.\n"); + puts("Trying to start u-boot now...\n"); + } + } +#endif +#ifdef CONFIG_NAND_ENV_DST + nand_spl_load_image(CONFIG_ENV_OFFSET, + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); + spl_parse_image_header(header); + nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size, + (void *)spl_image.load_addr); #ifdef CONFIG_ENV_OFFSET_REDUND - nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, - (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); + spl_parse_image_header(header); + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size, + (void *)spl_image.load_addr); #endif #endif - - /* - * Jump to U-Boot image - */ - uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; - (*uboot)(); + /* Load u-boot */ + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); + spl_parse_image_header(header); + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, + spl_image.size, (void *)spl_image.load_addr); + nand_deselect(); } diff --git a/include/configs/cam_enc_4xx.h b/include/configs/cam_enc_4xx.h index fe28278..34aac8c 100644 --- a/include/configs/cam_enc_4xx.h +++ b/include/configs/cam_enc_4xx.h @@ -222,7 +222,6 @@ #define CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_NAND_SUPPORT #define CONFIG_SPL_NAND_SIMPLE -#define CONFIG_SPL_NAND_LOAD #define CONFIG_SYS_NAND_HW_ECC_OOBFIRST #define CONFIG_SPL_SERIAL_SUPPORT #define CONFIG_SPL_POST_MEM_SUPPORT diff --git a/include/configs/hawkboard.h b/include/configs/hawkboard.h index 838e572..5f2aa62 100644 --- a/include/configs/hawkboard.h +++ b/include/configs/hawkboard.h @@ -63,7 +63,6 @@ #define CONFIG_SPL_BOARD_INIT #define CONFIG_SPL_NAND_SUPPORT #define CONFIG_SPL_NAND_SIMPLE -#define CONFIG_SPL_NAND_LOAD #define CONFIG_SPL_LIBGENERIC_SUPPORT /* for udelay and __div64_32 for NAND */ #define CONFIG_SPL_SERIAL_SUPPORT #define CONFIG_SPL_LDSCRIPT "board/$(BOARDDIR)/u-boot-spl-hawk.lds"
Takes the load function from arch/arm/lib/spl_nand.c instead. This will allow for easier integration of SPL-boots-Linux code on other arches. Kill off CONFIG_SPL_NAND_LOAD as a separate option. Signed-off-by: Tom Rini <trini@ti.com> --- arch/arm/cpu/arm926ejs/davinci/spl.c | 2 +- arch/arm/cpu/armv7/omap-common/Makefile | 6 -- arch/arm/cpu/armv7/omap-common/spl_nand.c | 102 ----------------------------- doc/README.SPL | 1 - drivers/mtd/nand/Makefile | 7 +- drivers/mtd/nand/nand_spl_load.c | 89 ++++++++++++++++++------- include/configs/cam_enc_4xx.h | 1 - include/configs/hawkboard.h | 1 - 8 files changed, 67 insertions(+), 142 deletions(-) delete mode 100644 arch/arm/cpu/armv7/omap-common/spl_nand.c