public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 19/20] SPL: NAND: Enhance drivers/mtd/nand/nand_spl_simple.c
Date: Fri, 24 Aug 2012 19:09:20 -0500	[thread overview]
Message-ID: <503817B0.6080109@freescale.com> (raw)
In-Reply-To: <1345852714-13138-20-git-send-email-trini@ti.com>

On 08/24/2012 06:58 PM, Tom Rini wrote:
> Takes the load function from arch/arm/cpu/armv7/omap-common/spl_nand.c
> instead.  This will allow for easier integration of SPL-boots-Linux code on
> other arches.
> 
> Signed-off-by: Tom Rini <trini@ti.com>
> ---
> Changes in v4:
> - Leave nand_spl_load.c alone, move the new load into nand_spl_simple.c
[snip]
> +void spl_nand_load_image(void)
> +{
> +	struct image_header *header;
> +	int *src __attribute__((unused));
> +	int *dst __attribute__((unused));
> +
> +	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 {
> +			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_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();
> +}

Will this refuse to link if spl_parse_image_header is not present, or
will gc-sections remove it before the error is given?  Does this
function leave any anonymous data that isn't cleaned up by gc-sections?
Again, this file must not grow for users that don't need the new features.

What is the benefit of putting this in nand_spl_simple.c versus another
file?  What if someone wants to use this with a different NAND boot
implementation?

-Scott

  reply	other threads:[~2012-08-25  0:09 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24 23:58 [U-Boot] [PATCH v4 0/20] ARM: SPL: Make more generic, merge DaVinci and OMAP Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 01/20] Makefile: Move SPL files to clobber, remove from clean Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 02/20] spl_mmc: Make FAT checks / calls guarded with CONFIG_SPL_FAT_SUPPORT Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 03/20] omap-common: SPL: Add CONFIG_SPL_DISPLAY_PRINT / spl_display_print() Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 04/20] omap-common: Fix typo in save_boot_params() in lowlevel_init.S Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 05/20] ARM: SPL: Rename omap_boot_device to spl_boot_device Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 06/20] ARM: SPL: Rename omap_boot_mode to spl_boot_mode() Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 07/20] ARM: SPL: Remove NAND_MODE_HW_ECC from spl_nand.c Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 08/20] ARM: SPL: Only call mem_malloc_init if configured Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 09/20] ARM: SPL: Add <asm/spl.h> and <asm/arch/spl.h> Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 10/20] ARM: SPL: Make spl_mmc.c more generic Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 11/20] ARM: SPL: Clean up spl.c / spl_nand.c slightly Tom Rini
2012-08-27 19:34   ` Sughosh Ganu
2012-08-27 20:17     ` Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 12/20] ARM: SPL: Start hooking in the current SPI SPL support Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 13/20] ARM: SPL: Move gpmc_init() to spl_board_init() Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 14/20] SPL: Move the omap SPL framework to common/spl Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 15/20] SPL: Create arch/arm/lib/spl.c for board_init_f and jump_to_image_linux Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 16/20] SPL: do not use fix value for u-boot size Tom Rini
2012-08-27 19:18   ` Sughosh Ganu
2012-08-27 20:14     ` Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 17/20] ARM: SPL: Convert davinci to CONFIG_SPL_FRAMEWORK Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 18/20] da850: Add README.da850 Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 19/20] SPL: NAND: Enhance drivers/mtd/nand/nand_spl_simple.c Tom Rini
2012-08-25  0:09   ` Scott Wood [this message]
2012-08-27 14:37     ` Tom Rini
2012-08-27 16:16       ` Scott Wood
2012-08-27 17:07         ` Tom Rini
2012-08-27 17:14           ` Scott Wood
2012-08-27 17:50             ` Tom Rini
2012-08-27 18:02               ` Scott Wood
2012-08-27 19:08                 ` Tom Rini
2012-08-27 22:04                   ` Tom Rini
2012-08-24 23:58 ` [U-Boot] [PATCH v4 20/20] SPL: SPI: Enhance spi_spl_load to match the other load functions Tom Rini
2012-08-27 19:02 ` [U-Boot] [PATCH v4 0/20] ARM: SPL: Make more generic, merge DaVinci and OMAP Sughosh Ganu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=503817B0.6080109@freescale.com \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox