From patchwork Tue Feb 5 09:23:01 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: 218202 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 DFAC82C02A1 for ; Tue, 5 Feb 2013 20:31:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 67DD74A15C; Tue, 5 Feb 2013 10:31:01 +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 0Lr6QaqRTLYg; Tue, 5 Feb 2013 10:31:01 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 67AC14A141; Tue, 5 Feb 2013 10:31:00 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 317C24A141 for ; Tue, 5 Feb 2013 10:30:58 +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 x3Vu0slhyQ3H for ; Tue, 5 Feb 2013 10:30:57 +0100 (CET) X-Greylist: delayed 447 seconds by postgrey-1.27 at theia; Tue, 05 Feb 2013 10:30:55 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-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by theia.denx.de (Postfix) with ESMTPS id 54E904A13E for ; Tue, 5 Feb 2013 10:30:55 +0100 (CET) Received: by mail-wg0-f47.google.com with SMTP id dr13so5341733wgb.26 for ; Tue, 05 Feb 2013 01:30:55 -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=mrn3Mnj7hbEkILzAq9lYU3WLQsAO7hWTvyf2pixv67o=; b=0F3HrAFlnIeoafsjKDN4Z8MgcaBWpIMVWYgENiFjR7vxmxmAIJiEYSY4tIsbGtI3aS 8LYJa4Qk/QJXRh0mUpVVI2rj27ybGXARqDDIQ05QSX4nUmPxkzcz11xlmoa6djbvfzJn Lgez/hi/DJNLALdTRQYRSjm+QDpq2GQulHDeJuHCIbWLEkGtl65R980pzzAwyFt2UmmZ IIZvUmwBELP2/quKl0bwxmMkhIcLqDIoPH3lHo1xG4baKzywpL13cIuM07WxutlVmHL/ +5ZEpIj5Sq4JbQ4LQsRdm91YV7f2d9sIUYkSzVtD4MCVp4l5Ou/6Xe+B9AMAjLdresBc Ip/A== X-Received: by 10.180.94.234 with SMTP id df10mr15624996wib.17.1360056206673; Tue, 05 Feb 2013 01:23:26 -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 df2sm24566977wib.0.2013.02.05.01.23.25 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Feb 2013 01:23:26 -0800 (PST) From: Enric Balletbo i Serra To: u-boot@lists.denx.de, trini@ti.com, javier@dowhile0.org, elezegarcia@gmail.com Date: Tue, 5 Feb 2013 10:23:01 +0100 Message-Id: <1360056181-10066-2-git-send-email-eballetbo@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360056181-10066-1-git-send-email-eballetbo@gmail.com> References: <1360056181-10066-1-git-send-email-eballetbo@gmail.com> Cc: Enric Balletbo i Serra Subject: [U-Boot] [PATCH 2/2] 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 --- arch/arm/cpu/armv7/omap3/board.c | 2 +- common/spl/Makefile | 1 + common/spl/spl.c | 5 +++++ common/spl/spl_onenand.c | 45 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 common/spl/spl_onenand.c diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c index 89c587e..63063c8 100644 --- a/arch/arm/cpu/armv7/omap3/board.c +++ b/arch/arm/cpu/armv7/omap3/board.c @@ -110,7 +110,7 @@ int board_mmc_init(bd_t *bis) void spl_board_init(void) { -#ifdef CONFIG_SPL_NAND_SUPPORT +#if defined(CONFIG_SPL_NAND_SUPPORT) || defined(CONFIG_SPL_ONENAND_SUPPORT) gpmc_init(); #endif #ifdef CONFIG_SPL_I2C_SUPPORT 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..c584247 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_ONE_NAND: + 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..247f97b --- /dev/null +++ b/common/spl/spl_onenand.c @@ -0,0 +1,45 @@ +/* + * 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; + int *src __attribute__((unused)); + int *dst __attribute__((unused)); + + 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); +}