The SPL is developped first for TI-OMAPx. The patch
move OMAP specific function into OMAP directory.
Signed-off-by: Stefano Babic
CC: Tom Rini
CC: Wolfgang Denk
CC: Simon Schwarz
---
arch/arm/cpu/armv7/omap-common/Makefile |2 +
arch/arm/cpu/armv7/omap-common/spl_omap.c | 71 +
arch/arm/cpu/armv7/omap3/board.c |4 ++
arch/arm/include/asm/omap_common.h| 34 --
common/spl.c |1 +
common/spl_mmc.c | 21 ++---
common/spl_nand.c | 14 +-
include/spl.h | 68 +++
8 files changed, 153 insertions(+), 62 deletions(-)
create mode 100644 arch/arm/cpu/armv7/omap-common/spl_omap.c
create mode 100644 include/spl.h
diff --git a/arch/arm/cpu/armv7/omap-common/Makefile
b/arch/arm/cpu/armv7/omap-common/Makefile
index e65e992..6fb544c 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -44,6 +44,8 @@ ifndef CONFIG_SPL_BUILD
ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
COBJS += mem-common.o
endif
+else
+COBJS += spl_omap.o
endif
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/armv7/omap-common/spl_omap.c
b/arch/arm/cpu/armv7/omap-common/spl_omap.c
new file mode 100644
index 000..692d8c2
--- /dev/null
+++ b/arch/arm/cpu/armv7/omap-common/spl_omap.c
@@ -0,0 +1,71 @@
+/*
+ * (C) Copyright 2010
+ * Texas Instruments,
+ *
+ * Aneesh V
+ *
+ * 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
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+ switch (omap_boot_device()) {
+ case BOOT_DEVICE_MMC1:
+ omap_mmc_init(0);
+ break;
+ case BOOT_DEVICE_MMC2:
+ omap_mmc_init(1);
+ break;
+ }
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_SPL_NAND_SUPPORT
+void spl_arch_nand_init(void)
+{
+ switch (omap_boot_mode()) {
+ case NAND_MODE_HW_ECC:
+ debug("spl: nand - using hw ecc\n");
+ gpmc_init();
+ nand_init();
+ break;
+ default:
+ puts("spl: ERROR: This bootmode is not implemented - hanging");
+ hang();
+ }
+}
+#endif
+
+u32 spl_boot_mode(void)
+{
+ return omap_boot_mode();
+}
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 889d650..f06d614 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -42,6 +42,10 @@
#include
#include
+#ifdef CONFIG_SPL_BUILD
+#include
+#endif
+
/* Declarations */
extern omap3_sysinfo sysinfo;
static void omap3_setup_aux_cr(void);
diff --git a/arch/arm/include/asm/omap_common.h
b/arch/arm/include/asm/omap_common.h
index 8a7d1e5..e46e612 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -64,43 +64,9 @@ void preloader_console_init(void);
#define BOOT_DEVICE_XIPWAIT7
#endif
-/* Boot type */
-#defineMMCSD_MODE_UNDEFINED0
-#define MMCSD_MODE_RAW 1
-#define MMCSD_MODE_FAT 2
-#define NAND_MODE_HW_ECC 3
-
-struct spl_image_info {
- const char *name;
- u8 os;
- u32 load_addr;
- u32 entry_point;
- u32 size;
-};
-
-extern struct spl_image_info spl_image;
-
-extern u32* boot_params_ptr;
u32 omap_boot_device(void);
u32 omap_boot_mode(void);
-/* SPL common function s*/
-void spl_parse_image_header(const struct image_header *header);
-void omap_rev_string(char *omap_rev_string);
-int spl_uboot_key(void);
-void spl_board_prepare_for_linux(void);
-int spl_start_uboot(void);
-
-/* NAND SPL functions */
-void spl_nand_load_image(void);
-
-/* MMC SPL functions */
-void spl_mmc_load_image(void);
-
-#ifdef CONFIG_SPL_BOARD_INIT
-void spl_board_init(void);
-#endif
-
/*
* silicon revisions.
* Moving this to common, so that most of code can be moved to common,
diff --git a/common/spl.c b/common/spl.c
index 1671a03..5fdf3fb 100644
--- a/common/spl.c
+++ b/common/spl