aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJohn Rigby <john.rigby@linaro.org>2011-10-18 21:19:17 -0600
committerJohn Rigby <john.rigby@linaro.org>2012-01-19 12:54:22 -0700
commitf820376e390a29a20f0adb499b3fcdcb31aedb11 (patch)
treec1a5220914cde5a7d0cbbe2dc5147e739c108263 /arch
parent74b9b91f4634aec30ba5c9b1a358c5f40c8c47e1 (diff)
OMAP4: Panda: Add usb peripheral boot
Stripped down fastboot protocol for now but could be just about anything. Will revisit once a fastboot or dfu implementation hits upstream. Signed-off-by: John Rigby <john.rigby@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv7/omap-common/spl.c28
-rw-r--r--arch/arm/cpu/armv7/start.S23
-rw-r--r--arch/arm/include/asm/omap_common.h1
3 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c
index 9c35a0903..b54b36260 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -106,6 +106,29 @@ static void jump_to_image_no_args(void)
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)
{
@@ -135,6 +158,11 @@ void board_init_r(gd_t *id, ulong dummy)
spl_nand_load_image();
break;
#endif
+#ifdef CONFIG_SPL_DSU_SUPPORT
+ case BOOT_DEVICE_USB:
+ dsuload();
+ break;
+#endif
default:
printf("SPL: Un-supported Boot Device - %d!!!\n", boot_device);
hang();
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index ef08a55ab..ab05e3b15 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -123,6 +123,29 @@ IRQ_STACK_START_IN:
*/
reset:
+#if defined CONFIG_SPL_BUILD && defined CONFIG_SPL_USB
+/*
+ * When loaded over USB the code lands at the base
+ * of SRAM so we need to copy to our actual link
+ * address. The destination overlaps with the source
+ * so copy backwards.
+ */
+ ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
+ bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
+ ldr r8, =_start /* linked here */
+ adr r7, _start /* loaded here */
+ subs r6, r8, r7 /* offset */
+ beq done /* nothing todo */
+ ldr r9, =__image_copy_end /* dest = end of linked code */
+ sub r7, r9, r6 /* source = dest - offset */
+2: ldr r6, [r7], #-4
+ str r6, [r9], #-4
+ cmp r9, r8
+ bne 2b
+ ldr lr, =done
+ mov pc, lr
+done:
+#endif
bl save_boot_params
/*
* set the cpu to SVC32 mode
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 1ec651b35..dcd4937c5 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -54,6 +54,7 @@ void preloader_console_init(void);
#define BOOT_DEVICE_ONE_NAND 4
#define BOOT_DEVICE_MMC1 5
#define BOOT_DEVICE_MMC2 6
+#define BOOT_DEVICE_USB 69 /* usb peripheral that is */
#elif defined(CONFIG_OMAP34XX) /* OMAP3 */
#define BOOT_DEVICE_NONE 0
#define BOOT_DEVICE_XIP 1