From patchwork Sat Jun 14 03:18:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Kushwaha X-Patchwork-Id: 359748 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 1DC98140078 for ; Sat, 14 Jun 2014 13:18:55 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4FD54B6B0; Sat, 14 Jun 2014 05:18:51 +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 DJZjEuwAGMhB; Sat, 14 Jun 2014 05:18:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 24DC84B76F; Sat, 14 Jun 2014 05:18:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 943544B76F for ; Sat, 14 Jun 2014 05:18:45 +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 YOLrqKU07U7X for ; Sat, 14 Jun 2014 05:18:42 +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 na01-bn1-obe.outbound.protection.outlook.com (mail-bn1lp0145.outbound.protection.outlook.com [207.46.163.145]) by theia.denx.de (Postfix) with ESMTPS id 5C9864B6B0 for ; Sat, 14 Jun 2014 05:18:39 +0200 (CEST) Received: from CH1PR03CA001.namprd03.prod.outlook.com (10.255.156.146) by BL2PR03MB452.namprd03.prod.outlook.com (10.141.92.21) with Microsoft SMTP Server (TLS) id 15.0.959.24; Sat, 14 Jun 2014 03:18:35 +0000 Received: from BY2FFO11FD028.protection.gbl (10.255.156.132) by CH1PR03CA001.outlook.office365.com (10.255.156.146) with Microsoft SMTP Server (TLS) id 15.0.959.24 via Frontend Transport; Sat, 14 Jun 2014 03:18:34 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD028.mail.protection.outlook.com (10.1.15.217) with Microsoft SMTP Server (TLS) id 15.0.959.15 via Frontend Transport; Sat, 14 Jun 2014 03:18:34 +0000 Received: from b32579-VirtualBox.ap.freescale.net (B32579-02-010232132154.ap.freescale.net [10.232.132.154]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s5E3IMPx019836; Fri, 13 Jun 2014 20:18:32 -0700 From: Prabhakar Kushwaha To: Date: Sat, 14 Jun 2014 08:48:19 +0530 Message-ID: <1402715899-31732-1-git-send-email-prabhakar@freescale.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(87936001)(4396001)(81542001)(50466002)(19580405001)(74662001)(47776003)(80022001)(83072002)(86362001)(88136002)(20776003)(21056001)(62966002)(93916002)(104166001)(104016001)(64706001)(92566001)(6806004)(77982001)(84676001)(31966008)(48376002)(50226001)(85852003)(19580395003)(87286001)(81342001)(46102001)(79102001)(44976005)(76482001)(36756003)(99396002)(77156001)(102836001)(33646001)(77096999)(97736001)(89996001)(74502001)(69596002)(83322001)(68736004)(92726001)(26826002)(81156002)(50986999); DIR:OUT; SFP:; SCL:1; SRVR:BL2PR03MB452; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 02426D11FE Received-SPF: Fail (: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=prabhakar@freescale.com; X-OriginatorOrg: freescale.com Cc: scottwood@freescale.com, yorksun@freescale.com Subject: [U-Boot] [PATCH][v3] driver/nand: Add support of 16K SRAM for IFC 2.0 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 Internal SRAM has been incresed from 8KB to 16KB for IFC cotroller ver 2.0. Update the page offset calculation logic to support the same. Signed-off-by: Prabhakar Kushwaha --- Changes for v2: rebased the patch Changes for v3: Incorporated Scott's comments - removed switch case - modified fsl_ifc_spl.c file drivers/mtd/nand/fsl_ifc_nand.c | 4 +++- drivers/mtd/nand/fsl_ifc_spl.c | 6 +++++- include/fsl_ifc.h | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c index 280e14e..8b453cb 100644 --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -23,7 +23,6 @@ #define CONFIG_SYS_FSL_IFC_BANK_COUNT 4 #endif -#define FSL_IFC_V1_1_0 0x01010000 #define MAX_BANKS CONFIG_SYS_FSL_IFC_BANK_COUNT #define ERR_BYTE 0xFF /* Value returned for read bytes when read failed */ @@ -1040,6 +1039,9 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr) if (ret) return ret; + if (ver >= FSL_IFC_V2_0_0) + priv->bufnum_mask = (priv->bufnum_mask * 2) + 1; + ret = nand_scan_ident(mtd, 1, NULL); if (ret) return ret; diff --git a/drivers/mtd/nand/fsl_ifc_spl.c b/drivers/mtd/nand/fsl_ifc_spl.c index 5100772..e336cb1 100644 --- a/drivers/mtd/nand/fsl_ifc_spl.c +++ b/drivers/mtd/nand/fsl_ifc_spl.c @@ -97,7 +97,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst) int pages_per_blk; int blk_size; int bad_marker = 0; - int bufnum_mask, bufnum; + int bufnum_mask, bufnum, ver = 0; int csor, cspr; int pos = 0; @@ -130,6 +130,10 @@ int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst) bad_marker = 5; } + ver = ifc_in32(&ifc->ifc_rev); + if (ver >= FSL_IFC_V2_0_0) + bufnum_mask = (bufnum_mask * 2) + 1; + pages_per_blk = 32 << ((csor & CSOR_NAND_PB_MASK) >> CSOR_NAND_PB_SHIFT); diff --git a/include/fsl_ifc.h b/include/fsl_ifc.h index b353b04..11474b7 100644 --- a/include/fsl_ifc.h +++ b/include/fsl_ifc.h @@ -12,6 +12,8 @@ #include #include +#define FSL_IFC_V1_1_0 0x01010000 +#define FSL_IFC_V2_0_0 0x02000000 #ifdef CONFIG_SYS_FSL_IFC_LE #define ifc_in32(a) in_le32(a)