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: 9845921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F3CBA60212 for ; Mon, 17 Jul 2017 18:20:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7DEE21F61 for ; Mon, 17 Jul 2017 18:20:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB5B428522; Mon, 17 Jul 2017 18:20:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1525721F61 for ; Mon, 17 Jul 2017 18:20:38 +0000 (UTC) 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=SQYWHPTF5JeZl0gltLLcpy5e+gtezJCKaNQv9C5VvbU=; b=bMm92Y7aYhh3uW SWJsKdzMRBXn0aa7aMxUBq9Dj0CEyevYq9SbIPwTncZaklV0Ogt6I0EkTdsmne5P3qUcsbGS5PNPX eVXQBy7akvdsZ72MERglUHAfD0q/5kNrloJBlkiJw3mKb2EKdfmKGeYRauoX737TxT3GKU3wT2bIm 9yd4xCIf78Ix10yZEljowFqCwqxworcNIX6YKFzcBCcUJj1zW1yOpI/EGiBeERVoFqOLVrlbv86yL nmC3oZpkwPozG44utWbvj0BksvbJbqQcK2GN7iVY0CaHBC49pzpgIeuigYOThqbHzutc7LYpbXLCo slXX9ve6gAAXgRefL03w==; 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 1dXAdH-0005aM-Q2; Mon, 17 Jul 2017 18:20:35 +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) 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-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Wenyou , Ludovic Desroches , Alexandre Belloni , linux-mtd , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }