From patchwork Wed Jan 5 07:17:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Chou X-Patchwork-Id: 77574 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 9E103B6F2B for ; Wed, 5 Jan 2011 18:16:21 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C84AF283A6; Wed, 5 Jan 2011 08:16:19 +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 9stmrd1urVGK; Wed, 5 Jan 2011 08:16:19 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ABFB928396; Wed, 5 Jan 2011 08:16:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1D77728396 for ; Wed, 5 Jan 2011 08:16:16 +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 DFgNnRi7aqtO for ; Wed, 5 Jan 2011 08:16:14 +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 www.wytron.com.tw (www.wytron.com.tw [211.75.82.101]) by theia.denx.de (Postfix) with ESMTPS id 0662F28394 for ; Wed, 5 Jan 2011 08:16:12 +0100 (CET) Received: from [192.168.1.15] (helo=darkstar.wytron.com.tw) by www.wytron.com.tw with esmtp (Exim 4.69) (envelope-from ) id 1PaNbK-0000Wn-QS; Wed, 05 Jan 2011 15:16:06 +0800 From: Thomas Chou To: Scott McNutt Date: Wed, 5 Jan 2011 15:17:35 +0800 Message-Id: <1294211855-18584-1-git-send-email-thomas@wytron.com.tw> X-Mailer: git-send-email 1.7.3.4 X-SA-Exim-Connect-IP: 192.168.1.15 X-SA-Exim-Mail-From: thomas@wytron.com.tw X-SA-Exim-Scanned: No (on www.wytron.com.tw); SAEximRunCond expanded to false Cc: u-boot@lists.denx.de, nios2-dev@sopc.et.ntust.edu.tw Subject: [U-Boot] [PATCH] nios2: reset cfi flash before reading env X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 Flash might be in unknown state when u-boot is started with jtag. And got wrong env data. So reset it in board early init. Signed-off-by: Thomas Chou --- board/altera/nios2-generic/nios2-generic.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c index 89848cf..b76e479 100644 --- a/board/altera/nios2-generic/nios2-generic.c +++ b/board/altera/nios2-generic/nios2-generic.c @@ -24,12 +24,18 @@ #include #include +#include +#include void text_base_hook(void); /* nop hook for text_base.S */ int board_early_init_f(void) { text_base_hook(); +#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_SYS_FLASH_BASE) + writeb(AMD_CMD_RESET, CONFIG_SYS_FLASH_BASE); + writeb(FLASH_CMD_RESET, CONFIG_SYS_FLASH_BASE); +#endif return 0; }