From patchwork Thu Dec 8 10:49:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengzhou Liu X-Patchwork-Id: 130135 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 86F36100C47 for ; Thu, 8 Dec 2011 22:24:03 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A015128082; Thu, 8 Dec 2011 12:23: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 qeqp8EmmD6Az; Thu, 8 Dec 2011 12:23:59 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 03BC328083; Thu, 8 Dec 2011 12:23:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A3A9F28083 for ; Thu, 8 Dec 2011 12:23:54 +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 QPgxP3IwwxUK for ; Thu, 8 Dec 2011 12:23:52 +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 TX2EHSOBE006.bigfish.com (tx2ehsobe003.messaging.microsoft.com [65.55.88.13]) by theia.denx.de (Postfix) with ESMTPS id 63EC228082 for ; Thu, 8 Dec 2011 12:23:51 +0100 (CET) Received: from mail162-tx2-R.bigfish.com (10.9.14.245) by TX2EHSOBE006.bigfish.com (10.9.40.26) with Microsoft SMTP Server id 14.1.225.23; Thu, 8 Dec 2011 11:23:35 +0000 Received: from mail162-tx2 (localhost [127.0.0.1]) by mail162-tx2-R.bigfish.com (Postfix) with ESMTP id B7E2D62040A for ; Thu, 8 Dec 2011 11:23:47 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h65h) X-Spam-TCS-SCL: 4:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail162-tx2 (localhost.localdomain [127.0.0.1]) by mail162-tx2 (MessageSwitch) id 1323343427558073_18074; Thu, 8 Dec 2011 11:23:47 +0000 (UTC) Received: from TX2EHSMHS018.bigfish.com (unknown [10.9.14.238]) by mail162-tx2.bigfish.com (Postfix) with ESMTP id 7D0A9500044 for ; Thu, 8 Dec 2011 11:23:47 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS018.bigfish.com (10.9.99.118) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 8 Dec 2011 11:23:47 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.339.2; Thu, 8 Dec 2011 05:23:46 -0600 Received: from localhost (tank.ap.freescale.net [10.193.20.104]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id pB8BNhjF025531; Thu, 8 Dec 2011 05:23:44 -0600 (CST) From: Shengzhou Liu To: Date: Thu, 8 Dec 2011 18:49:08 +0800 Message-ID: <1323341352-14996-1-git-send-email-Shengzhou.Liu@freescale.com> X-Mailer: git-send-email 1.6.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: scottwood@freescale.com, kumar.gala@freescale.com, Shengzhou Liu Subject: [U-Boot] [PATCH 1/5] mtd/nand: Add function board_nand_init_tail() for some special NAND controllers 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 In some NAND controllers there is a size limitation of RAM buffer(2K bytes). To support large-page NAND chips with greater than 2K pagesize, we need a large buffer, but we don't know pagesize before calling nand_scan_ident(), for more flexible and to identify different cases of large-page greater than 2K bytes, we have a board_nand_init_tail() between nand_scan_ident() and nand_scan_tail(). Signed-off-by: Shengzhou Liu --- drivers/mtd/nand/nand.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c index d987f4c..800541e 100644 --- a/drivers/mtd/nand/nand.c +++ b/drivers/mtd/nand/nand.c @@ -39,6 +39,14 @@ static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE] = CONFIG_SYS_NAND_BASE_LIS static const char default_nand_name[] = "nand"; static __attribute__((unused)) char dev_name[CONFIG_SYS_MAX_NAND_DEVICE][8]; +int __board_nand_init_tail(struct mtd_info *mtd, struct nand_chip *nand) +{ + /* Allow for init at tail in controller-specific file for some reason */ + return 0; +} +int board_nand_init_tail(struct mtd_info *mtd, struct nand_chip *nand) +__attribute__((weak, alias("__board_nand_init_tail"))); + static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, ulong base_addr) { @@ -51,7 +59,16 @@ static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr; if (board_nand_init(nand) == 0) { - if (nand_scan(mtd, maxchips) == 0) { + if (!nand_scan_ident(mtd, maxchips, NULL)) { + if (board_nand_init_tail(mtd, nand)) { + mtd->name = NULL; + return; + } + + if (nand_scan_tail(mtd)) { + mtd->name = NULL; + return; + } if (!mtd->name) mtd->name = (char *)default_nand_name; #ifdef CONFIG_NEEDS_MANUAL_RELOC