From patchwork Mon Nov 28 06:27:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 700001 X-Patchwork-Delegate: sbabic@denx.de 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 3tS84Z5MW5z9vFN for ; Tue, 29 Nov 2016 01:21:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0DD2A75F3; Mon, 28 Nov 2016 15:21:32 +0100 (CET) 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 PA0CI_IQX78n; Mon, 28 Nov 2016 15:21:32 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 48A91B3848; Mon, 28 Nov 2016 15:21:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 86867A7597 for ; Mon, 28 Nov 2016 07:35:14 +0100 (CET) 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 oHw8ZIm_jPD3 for ; Mon, 28 Nov 2016 07:35:14 +0100 (CET) X-Greylist: delayed 427 seconds by postgrey-1.34 at theia; Mon, 28 Nov 2016 07:35:11 CET 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 1.mo2.mail-out.ovh.net (1.mo2.mail-out.ovh.net [46.105.63.121]) by theia.denx.de (Postfix) with ESMTPS id 35691A7579 for ; Mon, 28 Nov 2016 07:35:11 +0100 (CET) Received: from player731.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id 2DA5713736 for ; Mon, 28 Nov 2016 07:28:04 +0100 (CET) Received: from localhost.localdomain (unknown [109.241.15.61]) (Authenticated sender: l.majewski@majess.pl) by player731.ha.ovh.net (Postfix) with ESMTPSA id D7992420074; Mon, 28 Nov 2016 07:27:52 +0100 (CET) From: Lukasz Majewski To: Tom Rini Date: Mon, 28 Nov 2016 07:27:46 +0100 Message-Id: <1480314466-8878-1-git-send-email-l.majewski@majess.pl> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1474015431-24329-1-git-send-email-l.majewski@majess.pl> References: <1474015431-24329-1-git-send-email-l.majewski@majess.pl> X-Ovh-Tracer-Id: 14876515471409070601 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelfedrfeehgdekkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-Mailman-Approved-At: Mon, 28 Nov 2016 15:21:30 +0100 Cc: Marek Vasut , u-boot@lists.denx.de, Stefan Roese , Lukasz Majewski Subject: [U-Boot] [PATCH] SPL: NOR: Add CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE define to enable whole image copy from NOR X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This define gives the possibility to copy entire image (including header) from NOR parallel memory to e.g. SDRAM. The legacy behavior is preserved, since other board don't enabled this option. Signed-off-by: Lukasz Majewski --- common/spl/Kconfig | 10 ++++++++++ common/spl/spl_nor.c | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index df9e0ce..d31b26d 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -399,6 +399,16 @@ config SPL_NOR_SUPPORT a memory-mapped device makes it very easy to access. Loading from NOR is typically achieved with just a memcpy(). +config SPL_NOR_COPY_ENTIRE_IMAGE + bool + depends on SPL_NOR_SUPPORT + prompt "Copy entire image from NOR memory" + default n + help + By default the SPL NOR driver supports copying only payload to + destination address. Say Y if you want to copy entire image (including + its image header). + config SPL_ONENAND_SUPPORT bool "Support OneNAND flash" depends on SPL diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 6bfa399..44f3e99 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -10,13 +10,15 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { + void *img_src; int ret; +#ifndef CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE /* * Loading of the payload to SDRAM is done with skipping of * the mkimage header in this SPL NOR driver */ spl_image->flags |= SPL_COPY_PAYLOAD_ONLY; - +#endif #ifdef CONFIG_SPL_OS_BOOT if (!spl_start_uboot()) { const struct image_header *header; @@ -65,9 +67,13 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, if (ret) return ret; + img_src = (void *)CONFIG_SYS_UBOOT_BASE; +#ifndef CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE + img_src += sizeof(struct image_header)); +#endif + memcpy((void *)(unsigned long)spl_image->load_addr, - (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)), - spl_image->size); + img_src, spl_image->size); return 0; }