From patchwork Fri Feb 8 09:14:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo Serra X-Patchwork-Id: 219071 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 9B6CC2C008C for ; Fri, 8 Feb 2013 20:21:05 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D16364A09F; Fri, 8 Feb 2013 10:21:03 +0100 (CET) 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 GaRSgGq+Uwdc; Fri, 8 Feb 2013 10:21:03 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 47AFB4A087; Fri, 8 Feb 2013 10:21:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3DFCC4A087 for ; Fri, 8 Feb 2013 10:20:59 +0100 (CET) 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 qjxAN7ENfn-1 for ; Fri, 8 Feb 2013 10:20:58 +0100 (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 mail-wg0-f54.google.com (mail-wg0-f54.google.com [74.125.82.54]) by theia.denx.de (Postfix) with ESMTPS id 4CFC94A04E for ; Fri, 8 Feb 2013 10:20:56 +0100 (CET) Received: by mail-wg0-f54.google.com with SMTP id fm10so2712355wgb.21 for ; Fri, 08 Feb 2013 01:20:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=/64zNRiuNBv3JwhWTML4Dut9WSxnMOmzj5RTIEu8Au0=; b=kBIlaOLcb1O0UI9B88x6yTsvxozYMosHpQ1IBxH5mUIDBWkdHIT2iR6DaWHDvy/1GS nKAPiQuRfTykOZYf26s+EY+2643xME16muIIogfXGiTJ55JoDwx8waZceh2reh52Pbzj 17yjjNhoWvJ/bnkOcGli0G1NGZyvyPWm5sJ/lAgZ8/lsPhVslpc4gLwYUDrIgdRuu8Ug aaltxZxW0KWCNsmkIK3C85SKBH58Sq6BFs0Yhcq6MOSBhtAzO1nwKArafuQ2VBSbzwvF 45VOGYO87il9W4WBw8z1CKUMXS+rXa/bYbcTMqdr8Cs/mBs+fz6BXTAS2IzaA9U40NL9 pBrA== X-Received: by 10.180.80.74 with SMTP id p10mr998136wix.19.1360314918288; Fri, 08 Feb 2013 01:15:18 -0800 (PST) Received: from localhost.localdomain (43.Red-2-139-180.staticIP.rima-tde.net. [2.139.180.43]) by mx.google.com with ESMTPS id fx5sm14176704wib.11.2013.02.08.01.15.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 08 Feb 2013 01:15:17 -0800 (PST) From: Enric Balletbo i Serra To: u-boot@lists.denx.de, trini@ti.com, javier@dowhile0.org, elezegarcia@gmail.com Date: Fri, 8 Feb 2013 10:14:48 +0100 Message-Id: <1360314889-16955-4-git-send-email-eballetbo@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360314889-16955-1-git-send-email-eballetbo@gmail.com> References: <1360314889-16955-1-git-send-email-eballetbo@gmail.com> Cc: Enric Balletbo i Serra Subject: [U-Boot] [PATCHv2 3/4] SPL: ONENAND: Support SPL to boot u-boot from OneNAND. 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: Enric Balletbo i Serra This patch will allow use SPL to boot an u-boot from the OneNAND. Tested with IGEPv2 board with a OneNAND from Numonyx Signed-off-by: Enric Balletbo i Serra --- common/spl/Makefile | 1 + common/spl/spl.c | 5 +++++ common/spl/spl_onenand.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 common/spl/spl_onenand.c diff --git a/common/spl/Makefile b/common/spl/Makefile index 5698a23..da2afc1 100644 --- a/common/spl/Makefile +++ b/common/spl/Makefile @@ -18,6 +18,7 @@ COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o COBJS-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o +COBJS-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o endif diff --git a/common/spl/spl.c b/common/spl/spl.c index ff9ba7b..293c7e1 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -197,6 +197,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_nand_load_image(); break; #endif +#ifdef CONFIG_SPL_ONENAND_SUPPORT + case BOOT_DEVICE_ONENAND: + spl_onenand_load_image(); + break; +#endif #ifdef CONFIG_SPL_NOR_SUPPORT case BOOT_DEVICE_NOR: spl_nor_load_image(); diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c new file mode 100644 index 0000000..a839557 --- /dev/null +++ b/common/spl/spl_onenand.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2013 + * ISEE 2007 SL - Enric Balletbo i Serra + * + * Based on common/spl/spl_nand.c + * Copyright (C) 2011 + * Corscience GmbH & Co. KG - Simon Schwarz + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#include +#include +#include +#include +#include + +void spl_onenand_load_image(void) +{ + struct image_header *header; + + debug("spl: onenand\n"); + + /*use CONFIG_SYS_TEXT_BASE as temporary storage area */ + header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); + /* Load u-boot */ + onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, + CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header); + spl_parse_image_header(header); + onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, + spl_image.size, (void *)spl_image.load_addr); +}