From patchwork Wed Aug 15 21:30:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 177837 X-Patchwork-Delegate: trini@ti.com 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 96F8A2C00E5 for ; Thu, 16 Aug 2012 07:33:07 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6FA0B2824B; Wed, 15 Aug 2012 23:32:49 +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 2CnRam+2tTln; Wed, 15 Aug 2012 23:32:49 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4D5222825A; Wed, 15 Aug 2012 23:32:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6D772280FC for ; Wed, 15 Aug 2012 23:31:27 +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 u3y6w6gIuamT for ; Wed, 15 Aug 2012 23:31:26 +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 CF57A2820E for ; Wed, 15 Aug 2012 23:31:12 +0200 (CEST) Received: by mail-pb0-f44.google.com with SMTP id rr4so472999pbb.3 for ; Wed, 15 Aug 2012 14:31:12 -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=gySGdnNqble3NSfBGgKWeEbn3xjNMVH8WlTrMj6vTDc=; b=e9XosjzZbnSFlpepRH7wnrkkFv5Uo1sPiR2XHs9oYBKk+DLizaPi2j658sb9cZocvc fRO9vj/fMYjedV4pG0cdkpiwtUdtLlGwHabaUkRnwPq1YtjyOidNhoRqVld65HNFDCiJ jI0IRne9a3ipnuHjINGOR2YdBr4ECmUBsZzrYdmGi7wtR74Ah0GVmzVXkVskylyuYV5T iuaxGHaIMj4I9Fx/eunUF6G8u+R8nWjn3N5urxxMC9eOBDgZQny2mdsRUpw6fxJtI27G BoCKdMibEmhs2mwZkTMrJGQFVC2BQVfLDQNLTpUpPiHdhhDWO2ClyA+mYw+Fv2xyWlun ee1g== Received: by 10.68.218.196 with SMTP id pi4mr9653138pbc.128.1345066272413; Wed, 15 Aug 2012 14:31:12 -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 kp3sm1128717pbc.64.2012.08.15.14.31.11 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 15 Aug 2012 14:31:11 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Wed, 15 Aug 2012 14:30:54 -0700 Message-Id: <1345066254-6911-18-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345066254-6911-1-git-send-email-trini@ti.com> References: <1345066254-6911-1-git-send-email-trini@ti.com> Cc: Sudhakar Rajashekhara , Heiko Schocher , Christian Riesch Subject: [U-Boot] [PATCH 17/17] ARM: SPL: 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 --- arch/arm/include/asm/spl.h | 2 +- arch/arm/lib/spl.c | 4 ++-- drivers/mtd/spi/spi_spl_load.c | 23 ++++++++++++----------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h index f0eb96f..6e60902 100644 --- a/arch/arm/include/asm/spl.h +++ b/arch/arm/include/asm/spl.h @@ -61,7 +61,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); diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c index dc26750..2532111 100644 --- a/arch/arm/lib/spl.c +++ b/arch/arm/lib/spl.c @@ -177,8 +177,8 @@ void board_init_r(gd_t *id, ulong dummy) #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..f439ca5 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); }