public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Mario Rugiero <mrugiero@gmail.com>
Cc: Richard Weinberger <richard.weinberger@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtd: nand: add option to erase NAND blocks even if detected as bad.
Date: Fri, 12 May 2017 10:24:07 +0200	[thread overview]
Message-ID: <20170512102407.217b805a@bbrezillon> (raw)
In-Reply-To: <CAKKQwLTGFY+bfFCoPNtvpFK-w-3SnNc_G2xDd_xip3iiwVDM4A@mail.gmail.com>

On Fri, 12 May 2017 05:16:08 -0300
Mario Rugiero <mrugiero@gmail.com> wrote:

> 2017-05-12 5:12 GMT-03:00 Richard Weinberger <richard.weinberger@gmail.com>:
> > Mario,
> >
> > On Fri, May 12, 2017 at 7:39 AM, Mario J. Rugiero <mrugiero@gmail.com> wrote:  
> >> Some chips used under a custom vendor driver can get their blocks
> >> incorrectly detected as bad blocks, out of incompatibilities
> >> between such drivers and MTD drivers.
> >> When there are too many misdetected bad blocks, the device becomes
> >> unusable because a bad block table can't be allocated, aside from
> >> all the legitimately good blocks which become unusable under these
> >> conditions.
> >> This adds a build option to workaround the issue by enabling the
> >> user to free up space regardless of what the driver thinks about
> >> the blocks.  
> >
> > Hmm, this sounds like a gross hack.  
> It is, but I see no other solution. The NAND chips were used in an
> incompatible way by a hack-n-slash driver made by allwinner, and
> trying to load them with a proper MTD driver fails miserably if this
> is not done.
> If anyone can propose a better solution I'll more than happily implement it.
> I'm open to suggestions, and of course I'm open to rejection of my
> patches if needed.

u-boot provides the nand.scrub command, which does exactly what you're
looking for. And no, I don't think it's a good idea to allow erasing
bad blocks, at least not by default.

If we really want to support this feature in linux, this should be
explicitly enabled through debugfs.

> >  
> >> Example usage: recovering NAND chips on sunxi devices, as explained
> >> here: http://linux-sunxi.org/Mainline_NAND_Howto#Known_issues  
> >
> > What this wiki suggests is not wise.
> > How can you know which blocks are really bad and which not?  
> You don't, at least not without an even grosser hack implementing read
> support for their incompatible format.
> Would that be better? I might attempt it if desired.

No, please don't do that, at least not in the kernel. If you really
want to parse the old format, you should develop a tool that reads NAND
pages in raw mode, stores the list of bad blocks somewhere and then
re-use this list to select which blocks should be forcibly erased.

Not sure it's worth the pain :-).

  reply	other threads:[~2017-05-12  8:24 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12  5:39 [PATCH] mtd: nand: add option to erase NAND blocks even if detected as bad Mario J. Rugiero
2017-05-12  5:52 ` [PATCH v2] " Mario J. Rugiero
2017-05-12  7:39 ` [PATCH v3] " Mario J. Rugiero
2017-05-15  8:21   ` Boris Brezillon
2017-05-15  9:23     ` Richard Weinberger
2017-05-15  9:41       ` Boris Brezillon
2017-05-15 10:10         ` Richard Weinberger
2017-05-15 11:05           ` Boris Brezillon
2017-05-15 13:16             ` Mario Rugiero
2017-05-15 13:20               ` Boris Brezillon
2017-05-12  8:12 ` [PATCH] " Richard Weinberger
2017-05-12  8:16   ` Mario Rugiero
2017-05-12  8:24     ` Boris Brezillon [this message]
2017-05-12  8:33       ` Richard Weinberger
2017-05-12  8:44         ` Boris Brezillon
2017-05-12  8:45           ` Richard Weinberger
2017-05-12  8:34       ` Mario Rugiero
2017-05-12  8:45         ` Boris Brezillon
     [not found]           ` <CAKKQwLQueea6G4B-cng9QdpjtRWyBWHw1Mq9ai3DVp31xswANg@mail.gmail.com>
2017-05-12  9:02             ` Boris Brezillon
2017-05-12  9:15               ` Mario Rugiero
2017-05-12  9:16                 ` Mario Rugiero
2017-05-12  9:32                   ` Boris Brezillon
2017-05-12  9:19                 ` Richard Weinberger
2017-05-12  9:26                   ` Mario Rugiero
2017-05-12  9:34                     ` Boris Brezillon
2017-05-12 10:06                       ` Mario Rugiero
2017-05-12 10:19                         ` Boris Brezillon
2017-05-12 10:23                           ` Mario Rugiero
2017-05-12 10:34                             ` Mario Rugiero
2017-05-13  9:17                             ` Richard Weinberger
2017-05-15  2:54                               ` Mario Rugiero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170512102407.217b805a@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mrugiero@gmail.com \
    --cc=richard.weinberger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox