From patchwork Mon Jun 29 11:58:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ebenard@free.fr X-Patchwork-Id: 29270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id D3629B7079 for ; Mon, 29 Jun 2009 22:01:57 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MLFV7-0003yU-JD; Mon, 29 Jun 2009 11:58:21 +0000 Received: from smtp5-g21.free.fr ([212.27.42.5]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MLFUy-0003ws-ES for linux-mtd@lists.infradead.org; Mon, 29 Jun 2009 11:58:19 +0000 Received: from smtp5-g21.free.fr (localhost [127.0.0.1]) by smtp5-g21.free.fr (Postfix) with ESMTP id 2917CD48183; Mon, 29 Jun 2009 13:58:04 +0200 (CEST) Received: from localhost.localdomain (tal33-2-82-228-175-43.fbx.proxad.net [82.228.175.43]) by smtp5-g21.free.fr (Postfix) with ESMTP id DE844D480D6; Mon, 29 Jun 2009 13:58:01 +0200 (CEST) From: ebenard@free.fr To: linux-mtd@lists.infradead.org Subject: [PATCH] Fix 2k pagesize NAND on i.MX27 Date: Mon, 29 Jun 2009 13:58:01 +0200 Message-Id: <1246276681-7377-1-git-send-email-ebenard@free.fr> X-Mailer: git-send-email 1.6.0.4 X-Spam-Score: 0.0 (/) Cc: s.hauer@pengutronix.de, Eric Benard X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Eric Benard This patch allows i.MX27 to support 2k pagesize NAND flash. We are using a 1.8V NAND flash which datasheet (unfortunatly only available under NDA) says : Page size: x8: 2,112 bytes (2,048 + 64 bytes). Without this patch, all sectors are marked as bad eraseblock. Signed-off-by: Eric Benard Acked-by : Sascha Hauer --- drivers/mtd/nand/mxc_nand.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 76beea4..65b26d5 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -857,6 +857,17 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, } } +/* Define some generic bad / good block scan pattern which are used + * while scanning a device for factory marked good / bad blocks. */ +static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; + +static struct nand_bbt_descr smallpage_memorybased = { + .options = NAND_BBT_SCAN2NDPAGE, + .offs = 5, + .len = 1, + .pattern = scan_ff_pattern +}; + static int __init mxcnd_probe(struct platform_device *pdev) { struct nand_chip *this; @@ -973,7 +984,10 @@ static int __init mxcnd_probe(struct platform_device *pdev) goto escan; } - host->pagesize_2k = (mtd->writesize == 2048) ? 1 : 0; + if (mtd->writesize == 2048) { + host->pagesize_2k = 1; + this->badblock_pattern = &smallpage_memorybased; + } if (this->ecc.mode == NAND_ECC_HW) { switch (mtd->oobsize) {