From patchwork Mon Jul 17 18:20:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 789668 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xBBSB0WYLz9s06 for ; Tue, 18 Jul 2017 04:20:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MDMp/vp/"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z3o1KnC/5HVZP/vq1NGNFzTyMOds0nQxawwumsFSlUs=; b=MDMp/vp/HGo56d c4eLXcxG1c5Q34vhAMafvZKIdNNa6LyVZJsU9sUzMjaSdrsy0gvyUoQp8VWQ6j6xi195VSZfrjt6o ArIZyDlHCPZmKmaEwtadw+iY6Ax/Xzq5lSco/4ApclfD1LxHchZ8XylCUfyRKJ/qxfEJhf1fiJFzD 59SInnu18MzmhNdtVB5HYkX2lrPm/+QitWANBU97p8E0JN9tkBmwCGeCphMTDGTqnO+g0hMy+/4ob v8VmkXdivQsuNt63/jc1mXGC1kczStClp/VY7imSMwWBf+VF9wnsZ3tzpBNpJICHkWdCBZJyDyY8P kJrtluXqAKYInL1zibqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXAdW-0005nr-AW; Mon, 17 Jul 2017 18:20:50 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXAdD-0005UX-1a; Mon, 17 Jul 2017 18:20:33 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id A31F020929; Mon, 17 Jul 2017 20:20:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.free-electrons.com (Postfix) with ESMTPSA id 6489920900; Mon, 17 Jul 2017 20:20:07 +0200 (CEST) Date: Mon, 17 Jul 2017 20:20:08 +0200 From: Boris Brezillon To: Romain Izard Subject: Re: Uncorrectable bitflips with Linux 4.12 on SAMA5D2 Message-ID: <20170717202008.6c798789@bbrezillon> In-Reply-To: <20170717194809.4a080e0c@bbrezillon> References: <20170717194809.4a080e0c@bbrezillon> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170717_112031_382017_BA91C1A6 X-CRM114-Status: GOOD ( 24.32 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Ferre , Yang Wenyou , Ludovic Desroches , Alexandre Belloni , linux-mtd , "linux-arm-kernel@lists.infradead.org" Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Le Mon, 17 Jul 2017 19:48:09 +0200, Boris Brezillon a écrit : > +Ludovic, Nicolas and Alexandre > > Hi Romain, > > Le Mon, 17 Jul 2017 18:11:26 +0200, > Romain Izard a écrit : > > > Hello, > > > > On a custom board based on Microchip's SAMA5D2 SoC, I am encountering > > ECC problems with the NAND Flash controller. The board is currently > > working with Linux v4.9.x, but it does not with Linux 4.12. > > > > Some pages on the NAND Flash memory chip of the device have bitflips. > > With Linux 4.9.x, the bitflips are fixed by the PMECC code, but with > > Linux 4.12, the errors are reported as uncorrectable. > > > > From my end, I updated the board's device tree to include the > > sama5d2.dtsi as it exists in Linux 4.12, but the rest of the file is > > the same as for Linux 4.9. From my understanding, it should be > > sufficient as the legacy DTB binding for the NAND controller is > > supported. > > I know Ludovic add some problems with the NAND controller on sama5d2, > but it was with the new bindings (see the fixes here [1]). > > Your problem seems a bit different since you're using the backward > compat code. Can you try with the following patch applied? --->8--- From cb95a16cdd497137872c44d5dd4e251ec73c79c1 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 17 Jul 2017 20:09:59 +0200 Subject: [PATCH] mtd: nand: atmel: Fix DT backward compatibility in pmecc.c PMECC caps extraction from old DT bindings is broken, thus leading to erroneous EL registers offset, which in turn make HW ECC unusable on sama5d2 when old bindings are in use. Passing the NAND dev node instead of the NFC node to of_match_node() solves the problem. Signed-off-by: Boris Brezillon Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver") Cc: Tested-by: Romain Izard --- drivers/mtd/nand/atmel/pmecc.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c index 55a8ee5306ea..8c210a5776bc 100644 --- a/drivers/mtd/nand/atmel/pmecc.c +++ b/drivers/mtd/nand/atmel/pmecc.c @@ -945,6 +945,7 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev) */ struct platform_device *pdev = to_platform_device(userdev); const struct atmel_pmecc_caps *caps; + const struct of_device_id *match; /* No PMECC engine available. */ if (!of_property_read_bool(userdev->of_node, @@ -953,21 +954,11 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev) caps = &at91sam9g45_caps; - /* - * Try to find the NFC subnode and extract the associated caps - * from there. - */ - np = of_find_compatible_node(userdev->of_node, NULL, - "atmel,sama5d3-nfc"); - if (np) { - const struct of_device_id *match; - - match = of_match_node(atmel_pmecc_legacy_match, np); - if (match && match->data) - caps = match->data; - - of_node_put(np); - } + /* Find the caps associated to the NAND dev node. */ + match = of_match_node(atmel_pmecc_legacy_match, + userdev->of_node); + if (match && match->data) + caps = match->data; pmecc = atmel_pmecc_create(pdev, caps, 1, 2); }