From patchwork Sat Dec 31 02:44:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 133712 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 1813EB6FC5 for ; Sat, 31 Dec 2011 13:45:51 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Rgovf-0004ij-Sb; Sat, 31 Dec 2011 02:44:16 +0000 Received: from ch1ehsobe006.messaging.microsoft.com ([216.32.181.186] helo=ch1outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RgovU-0004i7-5d; Sat, 31 Dec 2011 02:44:05 +0000 Received: from mail188-ch1-R.bigfish.com (10.43.68.240) by CH1EHSOBE004.bigfish.com (10.43.70.54) with Microsoft SMTP Server id 14.1.225.23; Sat, 31 Dec 2011 02:43:36 +0000 Received: from mail188-ch1 (localhost [127.0.0.1]) by mail188-ch1-R.bigfish.com (Postfix) with ESMTP id 928621002D1; Sat, 31 Dec 2011 02:43:36 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h668h839h) 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 mail188-ch1 (localhost.localdomain [127.0.0.1]) by mail188-ch1 (MessageSwitch) id 1325299414484392_24392; Sat, 31 Dec 2011 02:43:34 +0000 (UTC) Received: from CH1EHSMHS001.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.251]) by mail188-ch1.bigfish.com (Postfix) with ESMTP id 726B86C0043; Sat, 31 Dec 2011 02:43:34 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS001.bigfish.com (10.43.70.1) with Microsoft SMTP Server (TLS) id 14.1.225.23; Sat, 31 Dec 2011 02:43:34 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.355.3; Fri, 30 Dec 2011 20:43:58 -0600 Received: from localhost.ap.freescale.net (udp161149uds.ap.freescale.net [10.192.242.25]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id pBV2hr8B009711; Fri, 30 Dec 2011 20:43:54 -0600 (CST) From: Huang Shijie To: Subject: [PATCH v3] MTD/GPMI bugfix : reset the BCH module when it is not MX23 Date: Sat, 31 Dec 2011 10:44:57 +0800 Message-ID: <1325299497-11060-1-git-send-email-b32955@freescale.com> X-Mailer: git-send-email 1.7.3.2 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 [216.32.181.186 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Huang Shijie , koen.beel.barco@gmail.com, w.sang@pengutronix.de, marek.vasut@gmail.com, linux-mtd@lists.infradead.org, shijie8@gmail.com, linux-arm-kernel@lists.infradead.org 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 In MX28, if we do not reset the BCH module. The BCH module may becomes unstable when the board reboots for several thousands times. This bug has been catched in customer's production. The patch adds some comments, and fixes it now. Also change gpmi_reset_block() to static. Signed-off-by: Huang Shijie Acked-by: Marek Vasut --- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c index de4db76..d774aaa 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c @@ -69,7 +69,8 @@ static int clear_poll_bit(void __iomem *addr, u32 mask) * [1] enable the module. * [2] reset the module. * - * In most of the cases, it's ok. But there is a hardware bug in the BCH block. + * In most of the cases, it's ok. + * But in MX23, there is a hardware bug in the BCH block(see 2847 from errata). * If you try to soft reset the BCH block, it becomes unusable until * the next hard reset. This case occurs in the NAND boot mode. When the board * boots by NAND, the ROM of the chip will initialize the BCH blocks itself. @@ -78,8 +79,12 @@ static int clear_poll_bit(void __iomem *addr, u32 mask) * * To avoid this bug, just add a new parameter `just_enable` for * the mxs_reset_block(), and rewrite it here. + * + * The bug has been fixed in the following chips, such as MX28. + * But in MX28, if you do NOT reset the BCH module, the BCH module may also + * becomes unstable too. So reset the BCH module if it's not MX23. */ -int gpmi_reset_block(void __iomem *reset_addr, bool just_enable) +static int gpmi_reset_block(void __iomem *reset_addr, bool just_enable) { int ret; int timeout = 0x400; @@ -206,7 +211,8 @@ int bch_set_geometry(struct gpmi_nand_data *this) if (ret) goto err_out; - ret = gpmi_reset_block(r->bch_regs, true); + /* see comments for gpmi_reset_block(). */ + ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); if (ret) goto err_out;