OMAP4: Fix USB SPL Boot build errors
Signed-off-by: John Rigby <john.rigby@linaro.org>
diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile
index a684611..11f944d 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -48,6 +48,9 @@
ifdef CONFIG_SPL_MMC_SUPPORT
COBJS += spl_mmc.o
endif
+ifdef CONFIG_SPL_USB_SUPPORT
+COBJS += spl_usb.o
+endif
endif
ifndef CONFIG_SPL_BUILD
diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c
index b54b362..f982b2b 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -106,29 +106,6 @@
image_entry((u32 *)boot_params_ptr_addr);
}
-#ifdef CONFIG_SPL_DSU_SUPPORT
-extern int dsudownload(u32 *, u32 *);
-
-static void dsuload(void)
-{
- u32 loadaddr;
- u32 size;
- int err;
- struct image_header *header;
-
- err = dsudownload(&loadaddr, &size);
-
- if (err) {
- serial_printf("usb download failed");
- hang();
- }
- header = (struct image_header *)loadaddr;
- parse_image_header(header);
- memcpy((void *)image_load_addr, (void *)loadaddr, size);
- image_size = size;
-}
-#endif
-
void jump_to_image_no_args(void) __attribute__ ((noreturn));
void board_init_r(gd_t *id, ulong dummy)
{
@@ -160,7 +137,7 @@
#endif
#ifdef CONFIG_SPL_DSU_SUPPORT
case BOOT_DEVICE_USB:
- dsuload();
+ spl_dsu_load_image();
break;
#endif
default:
diff --git a/arch/arm/cpu/armv7/omap-common/spl_usb.c b/arch/arm/cpu/armv7/omap-common/spl_usb.c
new file mode 100644
index 0000000..4edaf03
--- /dev/null
+++ b/arch/arm/cpu/armv7/omap-common/spl_usb.c
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *
+ * Aneesh V <aneesh@ti.com>
+ *
+ * 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/u-boot.h>
+#include <asm/utils.h>
+#include <asm/arch/sys_proto.h>
+#include <version.h>
+#include <asm/omap_common.h>
+#include <asm/arch/mmc_host_def.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_SPL_DSU_SUPPORT
+void spl_dsu_load_image(void)
+{
+ u32 loadaddr;
+ u32 size;
+ int err;
+ struct image_header *header;
+
+ err = dsudownload(&loadaddr, &size);
+
+ if (err) {
+ serial_printf("usb download failed");
+ hang();
+ }
+ header = (struct image_header *)loadaddr;
+ spl_parse_image_header(header);
+ memcpy((void *)loadaddr, (void *)spl_image.load_addr, spl_image.size);
+}
+#endif
+
+
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index dcd4937..4af08f8 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -95,6 +95,10 @@
/* MMC SPL functions */
void spl_mmc_load_image(void);
+/* USB SPL functions */
+void spl_dsu_load_image(void);
+int dsudownload(u32 *, u32 *);
+
#ifdef CONFIG_SPL_BOARD_INIT
void spl_board_init(void);
#endif