From patchwork Fri Aug 31 18:03:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 181031 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 9B2912C0385 for ; Sat, 1 Sep 2012 04:11:50 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C7EE728106; Fri, 31 Aug 2012 20:09:44 +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 1Db799af3j2X; Fri, 31 Aug 2012 20:09:44 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C68232812F; Fri, 31 Aug 2012 20:07:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1A8AC280D4 for ; Fri, 31 Aug 2012 20:06:38 +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 BIod5cwA7axK for ; Fri, 31 Aug 2012 20:06:37 +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 C027E28097 for ; Fri, 31 Aug 2012 20:04:38 +0200 (CEST) Received: by mail-pb0-f44.google.com with SMTP id rr4so5184775pbb.3 for ; Fri, 31 Aug 2012 11:04:38 -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=nXFs5HTJTUQTuWlO6B41lndLEgUAhLtEWoAOZanvCrY=; b=yln8rSdskRFlkoXxwqFH094PHAt/yb0rd5b+r54lQL+d70oH/OUkFDIcEh622yIhE3 sBsxK8dvqGK6P4M5Hsu5zsIzuR7cCr90qh3IfkRHl3FmSMGYcQRGtBuAq++ECCr4gK7q hjCRqIdtUuhRYi8IbGcp+8Tz0Nl3YR8Dx3sqWfTFJcRn16vAC5HkLfAcy/N8hA6aoGDR gDLa4dS9EbvStwLlW/dDWoG6oRgmUzDdzFU1/5Kz7l4RiCY9FxmEr5xxUg7CUN+E8Q9E Va8oglS7QYsWeiMz2I7q39FEdKmTwE+R0AEdlkOkrhflpeCriT8a2kf6AzJ7U9hifLE9 M6tQ== Received: by 10.68.221.70 with SMTP id qc6mr18989677pbc.92.1346436278216; Fri, 31 Aug 2012 11:04:38 -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 sr4sm3887134pbc.24.2012.08.31.11.04.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 31 Aug 2012 11:04:37 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Fri, 31 Aug 2012 11:03:16 -0700 Message-Id: <1346436196-27742-30-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1346436196-27742-1-git-send-email-trini@ti.com> References: <1346436196-27742-1-git-send-email-trini@ti.com> Cc: Sudhakar Rajashekhara , Pavel Machek , Christian Riesch Subject: [U-Boot] [PATCH v6 29/29] SPL: Add support for loading image from ram in SPL. 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 From: Pavel Machek Signed-off-by: Pavel Machek Signed-off-by: Tom Rini --- Changes in v6: - Add Pavel's spl_ram_load_image for when we've already got next image residing in DDR. - Fix multiline comment in spl_ram_load_image. README | 3 +++ common/spl/spl.c | 22 ++++++++++++++++++++++ doc/README.SPL | 1 + 3 files changed, 26 insertions(+) diff --git a/README b/README index ddbeb1b..016d8bc 100644 --- a/README +++ b/README @@ -2636,6 +2636,9 @@ FIT uImage format: CONFIG_SPL_SPI_SUPPORT Support for drivers/spi/libspi.o in SPL binary + CONFIG_SPL_RAM_DEVICE + Support for running image already present in ram, in SPL binary + CONFIG_SPL_LIBGENERIC_SUPPORT Support for lib/libgeneric.o in SPL binary diff --git a/common/spl/spl.c b/common/spl/spl.c index f2f6de7..c640f87 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -128,6 +128,23 @@ static void __noreturn jump_to_image_no_args(void) image_entry((u32 *)boot_params_ptr_addr); } +#ifdef CONFIG_SPL_RAM_DEVICE +static void spl_ram_load_image(void) +{ + const struct image_header *header; + + /* + * Get the header. It will point to an address defined by handoff + * which will tell where the image located inside the flash. For + * now, it will temporary fixed to address pointed by U-Boot. + */ + header = (struct image_header *) + (CONFIG_SYS_TEXT_BASE - sizeof(struct image_header)); + + spl_parse_image_header(header); +} +#endif + void board_init_r(gd_t *dummy1, ulong dummy2) { u32 boot_device; @@ -145,6 +162,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2) boot_device = spl_boot_device(); debug("boot device - %d\n", boot_device); switch (boot_device) { +#ifdef CONFIG_SPL_RAM_DEVICE + case BOOT_DEVICE_RAM: + spl_ram_load_image(); + break; +#endif #ifdef CONFIG_SPL_MMC_SUPPORT case BOOT_DEVICE_MMC1: case BOOT_DEVICE_MMC2: diff --git a/doc/README.SPL b/doc/README.SPL index e4a5ac3..2acafba 100644 --- a/doc/README.SPL +++ b/doc/README.SPL @@ -66,6 +66,7 @@ CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o) CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o) CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o) +CONFIG_SPL_RAM_DEVICE (common/spl/spl.c) Normally CPU is assumed to be the same between the SPL and normal