From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 16/17] SPL: Enhance drivers/mtd/nand/nand_spl_load.c
Date: Wed, 15 Aug 2012 14:30:53 -0700 [thread overview]
Message-ID: <1345066254-6911-17-git-send-email-trini@ti.com> (raw)
In-Reply-To: <1345066254-6911-1-git-send-email-trini@ti.com>
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/lib/Makefile | 1 -
arch/arm/lib/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(+), 137 deletions(-)
delete mode 100644 arch/arm/lib/spl_nand.c
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
index 833f721..f1a97cb 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/lib/Makefile b/arch/arm/lib/Makefile
index abf550a..d8e565f 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -29,7 +29,6 @@ LIBGCC = $(obj)libgcc.o
ifdef CONFIG_SPL_BUILD
ifdef CONFIG_SPL_FRAMEWORK
COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
-COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
COBJS-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
endif
diff --git a/arch/arm/lib/spl_nand.c b/arch/arm/lib/spl_nand.c
deleted file mode 100644
index 1e6b5f0..0000000
--- a/arch/arm/lib/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 <asm/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..a829ab2 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 <asm/io.h>
+#include <asm/spl.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"
--
1.7.9.5
next prev parent reply other threads:[~2012-08-15 21:30 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-15 21:30 [U-Boot] [PATCH 00/17]: ARM: SPL: Make more generic, merge DaVinci and OMAP Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 01/17] spl_mmc: Make FAT checks / calls guarded with CONFIG_SPL_FAT_SUPPORT Tom Rini
2012-08-16 7:52 ` Stefano Babic
2012-08-15 21:30 ` [U-Boot] [PATCH 02/17] omap-common: SPL: Add CONFIG_SPL_DISPLAY_PRINT / spl_display_print() Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 03/17] ARM: SPL: Move the omap SPL framework to arch/arm/lib Tom Rini
2012-08-16 7:45 ` Stefano Babic
2012-08-16 14:38 ` Tom Rini
2012-08-17 8:25 ` Stefano Babic
2012-08-15 21:30 ` [U-Boot] [PATCH 04/17] Makefile: Move SPL files to clobber, remove from clean Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 05/17] ARM: SPL: Rename omap_boot_device to spl_boot_device Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 06/17] ARM: SPL: Rename omap_boot_mode to spl_boot_mode() Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 07/17] omap-common: Fix typo in lowlevel_init.S::save_boot_params Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 08/17] ARM: SPL: Remove NAND_MODE_HW_ECC from spl_nand.c Tom Rini
2012-08-16 7:59 ` Stefano Babic
2012-08-15 21:30 ` [U-Boot] [PATCH 09/17] ARM: SPL: Only call mem_malloc_init if configured Tom Rini
2012-08-16 8:01 ` Stefano Babic
2012-08-16 14:40 ` Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 10/17] ARM: SPL: Add <asm/spl.h> and <asm/arch/spl.h> Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 11/17] ARM: SPL: Make spl_mmc.c more generic Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 12/17] ARM: SPL: Clean up spl.c / spl_nand.c slightly Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 13/17] ARM: SPL: Start hooking in the current SPI SPL support Tom Rini
2012-08-15 21:30 ` [U-Boot] [PATCH 14/17] ARM: SPL: Move gpmc_init() to spl_board_init() Tom Rini
2012-08-16 8:05 ` Stefano Babic
2012-08-15 21:30 ` [U-Boot] [PATCH 15/17] ARM: SPL: Convert davinci to CONFIG_SPL_FRAMEWORK Tom Rini
2012-08-20 10:08 ` Christian Riesch
2012-08-15 21:30 ` Tom Rini [this message]
2012-08-24 20:35 ` [U-Boot] [PATCH 16/17] SPL: Enhance drivers/mtd/nand/nand_spl_load.c Scott Wood
2012-08-15 21:30 ` [U-Boot] [PATCH 17/17] ARM: SPL: Enhance spi_spl_load to match the other load functions Tom Rini
2012-08-16 6:30 ` [U-Boot] [PATCH 00/17]: ARM: SPL: Make more generic, merge DaVinci and OMAP Stefan Roese
2012-08-16 14:30 ` Tom Rini
2012-08-16 14:50 ` Stefan Roese
2012-08-16 7:32 ` Stefano Babic
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=1345066254-6911-17-git-send-email-trini@ti.com \
--to=trini@ti.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