From patchwork Fri Oct 25 04:39:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Kushwaha X-Patchwork-Id: 286078 X-Patchwork-Delegate: yorksun@freescale.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 17DFF2C00E3 for ; Fri, 25 Oct 2013 15:40:11 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 83D914A2BC; Fri, 25 Oct 2013 06:40:09 +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 F16gy2Ux8xkw; Fri, 25 Oct 2013 06:40:09 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2DDDB4A2A6; Fri, 25 Oct 2013 06:40:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 37F8F4A293 for ; Fri, 25 Oct 2013 06:39:56 +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 uoGAozhLh0se for ; Fri, 25 Oct 2013 06:39:53 +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 va3outboundpool.messaging.microsoft.com (va3ehsobe010.messaging.microsoft.com [216.32.180.30]) by theia.denx.de (Postfix) with ESMTPS id 2F93E4A2A6 for ; Fri, 25 Oct 2013 06:39:39 +0200 (CEST) Received: from mail213-va3-R.bigfish.com (10.7.14.236) by VA3EHSOBE011.bigfish.com (10.7.40.61) with Microsoft SMTP Server id 14.1.225.22; Fri, 25 Oct 2013 04:39:35 +0000 Received: from mail213-va3 (localhost [127.0.0.1]) by mail213-va3-R.bigfish.com (Postfix) with ESMTP id 385028801D9 for ; Fri, 25 Oct 2013 04:39:35 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2dh2a8h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh1fb3h1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1fe8h1ff5h1155h) Received: from mail213-va3 (localhost.localdomain [127.0.0.1]) by mail213-va3 (MessageSwitch) id 1382675972649454_6753; Fri, 25 Oct 2013 04:39:32 +0000 (UTC) Received: from VA3EHSMHS010.bigfish.com (unknown [10.7.14.251]) by mail213-va3.bigfish.com (Postfix) with ESMTP id 9B522340073 for ; Fri, 25 Oct 2013 04:39:32 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS010.bigfish.com (10.7.99.20) with Microsoft SMTP Server (TLS) id 14.16.227.3; Fri, 25 Oct 2013 04:39:32 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.3.158.2; Fri, 25 Oct 2013 04:39:31 +0000 Received: from b32579-VirtualBox.ap.freescale.net (B32579-02-010232132102.ap.freescale.net [10.232.132.102]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r9P4dP6W010816; Thu, 24 Oct 2013 21:39:29 -0700 From: Prabhakar Kushwaha To: Date: Fri, 25 Oct 2013 10:09:23 +0530 Message-ID: <1382675963-24883-1-git-send-email-prabhakar@freescale.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: scottwood@freescale.com, yorksun@freescale.com Subject: [U-Boot] [PATCH 5/6][v2] SPL:Defines function required to env read for IFC & env_nand 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de fsl_ifs_spl.c reads data from NAND and store at a memory location in raw mode. It does not used MTD layer. To read env variable from NAND MTD layer read/write required. Hence, add mtd_block_isbad & nand_read_skip_bad function required during env variable read. Also, avoid nand_info during env read for SPL Signed-off-by: Prabhakar Kushwaha --- Based upon git://git.denx.de/u-boot-mpc85xx.git branch next Changes for v2: Sending as it is common/env_nand.c | 4 ++++ drivers/mtd/nand/fsl_ifc_spl.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/common/env_nand.c b/common/env_nand.c index 695a9ee..77ba003 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -245,7 +245,11 @@ int readenv(size_t offset, u_char *buf) size_t blocksize, len; u_char *char_ptr; +#ifdef CONFIG_SPL_BUILD + blocksize = CONFIG_ENV_SIZE;; +#else blocksize = nand_info[0].erasesize; +#endif if (!blocksize) return 1; diff --git a/drivers/mtd/nand/fsl_ifc_spl.c b/drivers/mtd/nand/fsl_ifc_spl.c index d462265..0db7142 100644 --- a/drivers/mtd/nand/fsl_ifc_spl.c +++ b/drivers/mtd/nand/fsl_ifc_spl.c @@ -11,6 +11,28 @@ #include #include #include +#ifndef CONFIG_SPL_INIT_MINIMAL +#include +#endif + +static void nand_load(unsigned int offs, int uboot_size, uchar *dst); + +#ifdef CONFIG_ENV_IS_IN_NAND +struct mtd_info nand_info[CONFIG_SYS_MAX_NAND_DEVICE]; + +int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) +{ + return 0; +} + +int nand_read_skip_bad(struct mtd_info *nand, loff_t offset, size_t *length, + size_t *actual, loff_t lim, u_char *buffer) +{ + nand_load(offset, *length, buffer); + return 0; +} +#endif + static inline int is_blank(uchar *addr, int page_size) {