From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 18/19] SPL: Enhance drivers/mtd/nand/nand_spl_load.c
Date: Wed, 22 Aug 2012 16:19:44 -0700 [thread overview]
Message-ID: <1345677585-15696-19-git-send-email-trini@ti.com> (raw)
In-Reply-To: <1345677585-15696-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/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
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
index 46c0bfd..0b000ca 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
@@ -73,7 +73,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"
--
1.7.9.5
next prev parent reply other threads:[~2012-08-22 23:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-22 23:19 [U-Boot] [PATCH v3 0/19] ARM: SPL: Make more generic, merge DaVinci and OMAP Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 01/19] Makefile: Move SPL files to clobber, remove from clean Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 02/19] spl_mmc: Make FAT checks / calls guarded with CONFIG_SPL_FAT_SUPPORT Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 03/19] omap-common: SPL: Add CONFIG_SPL_DISPLAY_PRINT / spl_display_print() Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 04/19] omap-common: Fix typo in save_boot_params() in lowlevel_init.S Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 05/19] ARM: SPL: Rename omap_boot_device to spl_boot_device Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 06/19] ARM: SPL: Rename omap_boot_mode to spl_boot_mode() Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 07/19] ARM: SPL: Remove NAND_MODE_HW_ECC from spl_nand.c Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 08/19] ARM: SPL: Only call mem_malloc_init if configured Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 09/19] ARM: SPL: Add <asm/spl.h> and <asm/arch/spl.h> Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 10/19] ARM: SPL: Make spl_mmc.c more generic Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 11/19] ARM: SPL: Clean up spl.c / spl_nand.c slightly Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 12/19] ARM: SPL: Start hooking in the current SPI SPL support Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 13/19] ARM: SPL: Move gpmc_init() to spl_board_init() Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 14/19] SPL: Move the omap SPL framework to common/spl Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 15/19] spl: Make CONFIG_SPL_FRAMEWORK board_init_f __weak Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 16/19] ARM: SPL: Convert davinci to CONFIG_SPL_FRAMEWORK Tom Rini
2012-08-23 13:14 ` Christian Riesch
2012-08-23 14:07 ` Tom Rini
2012-08-22 23:19 ` [U-Boot] [PATCH v3 17/19] da850: Add README.da850 Tom Rini
2012-08-23 12:52 ` Christian Riesch
2012-08-23 16:17 ` Tom Rini
2012-08-22 23:19 ` Tom Rini [this message]
2012-08-22 23:19 ` [U-Boot] [PATCH v3 19/19] SPL: Enhance spi_spl_load to match the other load functions Tom Rini
2012-08-23 5:18 ` [U-Boot] [PATCH v3 0/19] ARM: SPL: Make more generic, merge DaVinci and OMAP Prabhakar Lad
2012-08-23 11:22 ` Stefan Roese
2012-08-23 12:22 ` Stefano Babic
2012-08-23 12:33 ` Christian Riesch
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=1345677585-15696-19-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