From patchwork Mon Aug 27 23:18:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 180312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D8A4E2C00CB for ; Tue, 28 Aug 2012 09:24:48 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B07E8280E7; Tue, 28 Aug 2012 01:23:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gLrTgFOV+8-V; Tue, 28 Aug 2012 01:23:05 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9F9652812A; Tue, 28 Aug 2012 01:20:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5EF09280F3 for ; Tue, 28 Aug 2012 01:20:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SwmJypUKNXEi for ; Tue, 28 Aug 2012 01:20:01 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by theia.denx.de (Postfix) with ESMTPS id 76466280D3 for ; Tue, 28 Aug 2012 01:19:24 +0200 (CEST) Received: by mail-pb0-f44.google.com with SMTP id rr4so8206516pbb.3 for ; Mon, 27 Aug 2012 16:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=8yC5MedDdbrO92t6XZLf146fTd69AzZsgPrvhw/Zgis=; b=mvtFpM6smaAf1m2AjIMlicCcZ1ZrKqg7+bVm3mD5ff5i1EvvcBhZqLaBWIZHrcZWZd Dv1O8/U/2SOrxVTW7lEfJvQyfH5zwhVX1EJtgxh1CzbjIyREXW8g8aZ23NOD7dqR036T WIdC5wh+hz/MPwsFyKxb259tNozWcUYlEYUwo5GFfi71GfId3ulzEcryCobCZ23cR4sz gRVrVn/UlzMIRFrX6f6uW5bbqmtlbN90S1NkAiBm2QYL8egffDoOj6+wZKb9FNj2MYc+ mBIkSmTDJxk6jXsLSeewlyA3WsXVph7nnCmYCi3++ueOKVhxdSNQpkey+pcQSfNREp3Z 5m2A== Received: by 10.68.116.48 with SMTP id jt16mr37786361pbb.101.1346109564333; Mon, 27 Aug 2012 16:19:24 -0700 (PDT) Received: from localhost.localdomain (ip68-230-54-74.ph.ph.cox.net. [68.230.54.74]) by mx.google.com with ESMTPS id wn1sm15616267pbc.57.2012.08.27.16.19.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Aug 2012 16:19:23 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Mon, 27 Aug 2012 16:18:45 -0700 Message-Id: <1346109527-17182-24-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1346109527-17182-1-git-send-email-trini@ti.com> References: <1346109527-17182-1-git-send-email-trini@ti.com> Cc: Sudhakar Rajashekhara , Christian Riesch Subject: [U-Boot] [PATCH v5 23/25] SPL: SPI: Enhance spi_spl_load to match the other load functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Tom Rini --- common/spl/spl.c | 4 ++-- drivers/mtd/spi/spi_spl_load.c | 23 ++++++++++++----------- include/spl.h | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index c5ede68..3d0cb97 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -167,8 +167,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #endif #ifdef CONFIG_SPL_SPI_SUPPORT case BOOT_DEVICE_SPI: - spi_boot(); - break; + spl_spi_load_image(); + break; #endif default: puts("SPL: Un-supported Boot Device\n"); diff --git a/drivers/mtd/spi/spi_spl_load.c b/drivers/mtd/spi/spi_spl_load.c index 1aa30ac..d4f81f2 100644 --- a/drivers/mtd/spi/spi_spl_load.c +++ b/drivers/mtd/spi/spi_spl_load.c @@ -24,16 +24,17 @@ #include #include +#include /* * The main entry for SPI booting. It's necessary that SDRAM is already * configured and available since this code loads the main U-Boot image * from SPI into SDRAM and starts it from there. */ -void spi_boot(void) +void spl_spi_load_image(void) { struct spi_flash *flash; - void (*uboot)(void) __noreturn; + struct image_header *header; /* * Load U-Boot image from SPI flash into RAM @@ -42,17 +43,17 @@ void spi_boot(void) flash = spi_flash_probe(CONFIG_SPL_SPI_BUS, CONFIG_SPL_SPI_CS, CONFIG_SF_DEFAULT_SPEED, SPI_MODE_3); if (!flash) { - puts("failed.\n"); + puts("SPI probe failed.\n"); hang(); } - spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, - CONFIG_SYS_SPI_U_BOOT_SIZE, - (void *) CONFIG_SYS_TEXT_BASE); + /* use CONFIG_SYS_TEXT_BASE as temporary storage area */ + header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); - /* - * Jump to U-Boot image - */ - uboot = (void *) CONFIG_SYS_TEXT_BASE; - (*uboot)(); + /* Load u-boot, mkimage header is 64 bytes. */ + spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, 0x40, + (void *) header); + spl_parse_image_header(header); + spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, + spl_image.size, (void *)spl_image.load_addr); } diff --git a/include/spl.h b/include/spl.h index cf441a1..af94a82 100644 --- a/include/spl.h +++ b/include/spl.h @@ -69,7 +69,7 @@ void spl_mmc_load_image(void); void spl_ymodem_load_image(void); /* SPI SPL functions */ -void spi_boot(void); +void spl_spi_load_image(void); #ifdef CONFIG_SPL_BOARD_INIT void spl_board_init(void);