From patchwork Tue Apr 10 02:56:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 151509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C69C5B6FF4 for ; Tue, 10 Apr 2012 12:47:27 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SHR5n-0004MD-OK; Tue, 10 Apr 2012 02:46:03 +0000 Received: from am1ehsobe003.messaging.microsoft.com ([213.199.154.206] helo=am1outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SHR5l-0004Lr-0l for linux-mtd@lists.infradead.org; Tue, 10 Apr 2012 02:46:01 +0000 Received: from mail38-am1-R.bigfish.com (10.3.201.239) by AM1EHSOBE002.bigfish.com (10.3.204.22) with Microsoft SMTP Server id 14.1.225.23; Tue, 10 Apr 2012 02:45:58 +0000 Received: from mail38-am1 (localhost [127.0.0.1]) by mail38-am1-R.bigfish.com (Postfix) with ESMTP id C6CD34E02AE; Tue, 10 Apr 2012 02:45:58 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h668h839hd24h) 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 mail38-am1 (localhost.localdomain [127.0.0.1]) by mail38-am1 (MessageSwitch) id 1334025956486587_28329; Tue, 10 Apr 2012 02:45:56 +0000 (UTC) Received: from AM1EHSMHS002.bigfish.com (unknown [10.3.201.247]) by mail38-am1.bigfish.com (Postfix) with ESMTP id 7435C1C012E; Tue, 10 Apr 2012 02:45:56 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS002.bigfish.com (10.3.207.102) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 10 Apr 2012 02:45:55 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.1.355.3; Mon, 9 Apr 2012 21:45:52 -0500 Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q3A2jnuf011728; Mon, 9 Apr 2012 19:45:50 -0700 From: Huang Shijie To: Subject: [PATCH] mtd : add parsing code for one kind of Hynix's nand chip Date: Tue, 10 Apr 2012 10:56:46 +0800 Message-ID: <1334026606-18327-1-git-send-email-b32955@freescale.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [213.199.154.206 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Huang Shijie , linux-mtd@lists.infradead.org, Huang Shijie X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Huang Shijie The H27UBG8T2A is not supported by the current code. Its full-id is : 0xad, 0xd7, 0x94, 0x9a, 0x74, 0x42. Now, add the parsing code for it. Signed-off-by: Huang Shijie Signed-off-by: Huang Shijie --- drivers/mtd/nand/nand_base.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 6315b94..8997023 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -3028,6 +3028,49 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, mtd->erasesize = (128 * 1024) << (((extid >> 1) & 0x04) | (extid & 0x03)); busw = 0; + } else if (id_data[0] == NAND_MFR_HYNIX && id_data[1] == 0xd7) { + /* Calc pagesize */ + mtd->writesize = 2048 << (extid & 0x03); + extid >>= 2; + + /* Calc oobsize */ + switch (extid & 0x03) { + case 0: + mtd->oobsize = 128; + break; + case 1: + mtd->oobsize = 224; + break; + case 2: + mtd->oobsize = 448; + break; + default: + pr_info("Cannot parse out the oobsize.\n"); + break; + } + extid >>= 2; + + /* Calc blocksize */ + extid = (((extid >> 1) & 0x04) | (extid & 0x03)); + + switch (extid) { + case 0: + case 1: + case 2: + mtd->erasesize = (128 * 1024) << extid; + break; + case 3: + mtd->erasesize = (128 * 1024) * 6; + break; + case 4: + case 5: + mtd->erasesize = (128 * 1024) << (extid - 1); + break; + default: + pr_info("Cannot parse out the blocksize.\n"); + break; + } + busw = 0; } else { /* Calc pagesize */ mtd->writesize = 1024 << (extid & 0x03);