Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755419AbbLBUR2 (ORCPT ); Wed, 2 Dec 2015 15:17:28 -0500 Received: from proxima.lp0.eu ([81.2.80.65]:46215 "EHLO proxima.lp0.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413AbbLBUR1 (ORCPT ); Wed, 2 Dec 2015 15:17:27 -0500 Subject: Re: [PATCH] mtd: brcmnand: Workaround false ECC uncorrectable errors To: Jonas Gorski References: <5659FF4A.7080203@simon.arlott.org.uk> Cc: Brian Norris , Kamal Dasu , David Woodhouse , MTD Maling List , bcm-kernel-feedback-list , Linux Kernel Mailing List , Florian Fainelli From: Simon Arlott Message-ID: <565F51D2.4010204@simon.arlott.org.uk> Date: Wed, 2 Dec 2015 20:17:22 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1490 Lines: 40 On 01/12/15 10:41, Jonas Gorski wrote: > On Sat, Nov 28, 2015 at 8:23 PM, Simon Arlott wrote: >> + >> + /* Go to start of buffer */ >> + buf -= FC_WORDS; >> + >> + /* Erased if all data bytes are 0xFF */ >> + buf_erased = memchr_inv(buf, 0xFF, FC_WORDS) == NULL; >> + >> + if (!buf_erased) >> + goto out_free; > > We now have a function exactly for that use case in 4.4, > nand_check_erased_buf [1], consider using that. This also has the > benefit of treating bit flips as correctable as long as the ECC scheme > is strong enough. I have no idea whether or not it's appropriate to specify bitflips_threshold > 0 so it'd just be a more complex way to do a memchr_inv() search for 0xFF. The code also has to check for the hamming code bytes being all 0x00, because according to the comments [2], the controller also has difficulty with the non-erased all-0xFFs scenario too. [2] https://github.com/lp0/bcm963xx_4.12L.06B_consumer/blob/dd8fcb13046f738c311507dc2fcfd3e5d57a88e0/kernel/linux/drivers/mtd/brcmnand/brcmnand_base.c#L2459 > > Jonas > > [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/mtd/nand/nand_base.c#n1110 > -- Simon Arlott -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/