From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wg0-f49.google.com ([74.125.82.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TKyvF-0006S8-Ci for barebox@lists.infradead.org; Sun, 07 Oct 2012 22:02:07 +0000 Received: by mail-wg0-f49.google.com with SMTP id gg4so2101007wgb.18 for ; Sun, 07 Oct 2012 15:02:05 -0700 (PDT) From: Vicente Date: Mon, 8 Oct 2012 00:01:26 +0200 Message-Id: <1349647287-28224-13-git-send-email-vicencb@gmail.com> In-Reply-To: <1349647287-28224-1-git-send-email-vicencb@gmail.com> References: <1349647287-28224-1-git-send-email-vicencb@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 12/13] omap4: add support for loading second stage from usb To: barebox@lists.infradead.org Cc: Vicente Signed-off-by: Vicente --- arch/arm/mach-omap/xload.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c index 9fa8221..240d3ff 100644 --- a/arch/arm/mach-omap/xload.c +++ b/arch/arm/mach-omap/xload.c @@ -139,6 +139,24 @@ static void *omap_xload_boot_spi(int offset) return to; } +static void *omap4_xload_boot_usb(void){ + int ret; + void *buf; + int len; + + ret = mount("omap4_usbboot", "omap4_usbbootfs", "/"); + if (ret) { + printf("Unable to mount omap4_usbbootfs (%d)\n", ret); + return NULL; + } + + buf = read_file("/barebox.bin", &len); + if (!buf) + printf("could not read barebox.bin from omap4_usbbootfs\n"); + + return buf; +} + enum omap_boot_src omap_bootsrc(void) { #if defined(CONFIG_ARCH_OMAP3) @@ -161,6 +179,14 @@ int run_shell(void) printf("booting from MMC1\n"); func = omap_xload_boot_mmc(); break; + case OMAP_BOOTSRC_USB1: + if (IS_ENABLED(CONFIG_FS_OMAP4_USBBOOT)) { + printf("booting from USB1\n"); + func = omap4_xload_boot_usb(); + break; + } else { + printf("booting from usb1 not enabled\n"); + } case OMAP_BOOTSRC_UNKNOWN: printf("unknown boot source. Fall back to nand\n"); case OMAP_BOOTSRC_NAND: -- 1.7.12.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox