linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ezequiel.garcia@free-electrons.com (Ezequiel Garcia)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 22/28] mtd: nand: pxa3xx: Introduce multiple page I/O support
Date: Wed, 6 Nov 2013 08:32:11 -0300	[thread overview]
Message-ID: <20131106113210.GB2616@localhost> (raw)
In-Reply-To: <CAN8TOE_ZmcsvShKY273KQCaopJEXgtXVR1XY9pP5EKkUK+bUbA@mail.gmail.com>

On Tue, Nov 05, 2013 at 06:20:18PM -0800, Brian Norris wrote:
[..]
> 
> >> Also, do you plan to support non-ONFI NAND?
> >
> > Not for the time being. (Are there any new non-ONFI NAND devices?)
> 
> Sure there are. I've been seeing non-ONFI parts from Toshiba and
> Macronix, at least (I think Macronix is moving to ONFI soon, though).
> Samsung is around still, too.
> 

Right. Well, for now I would just add a pr_warn("Your device is not
supported. Please ask Ezequiel to add it") or something along those
lines.

BTW: So, I guess that for non-ONFI devices we must simply put the ECC
information in the DT (being a hardware parameter)?

Having followed (part) of the OMAP DT ECC discussion, I'm thinking:
wouldn't it be good to have an 'nand-ecc-strength' property in the DT?

It would match the ecc_strength_ds field. This way, the ECC mode
selection is left to the driver and not to the user.
On the other side, this can cause some severe incompatibilities
unless such driver *always* make the *same* selection.

Anyway, none of this matters in this patchset, for the time being.

[..]
> 
> From the linked response:
> 
> "So, if you set the controller to transfer 2048B you can correct up to
> 16 bits on this 2048B region, or 4 bits per 512B, hence BCH-4."
> 
> Well, "16 bits per 2048" is at least as good as BCH-4 over 512B, but
> it is not exactly the same. A true "16 bits per 2048" would be able to
> correct 16 bitflips concentrated in a 512B region, whereas BCH-4/512B
> would not.
> 

Indeed, 16-over-2048 is stronger than 4-over-512 :)

> But unless we can get better documentation/experiments with the
> controller, it's hard to tell which is the case, and it's probably not
> a big deal at this point. Your current code looks OK, I think.
> 

Ok, great.

> > Feel free to ask any further clarification about how the ECC engine
> > works. If you think it'll help, I can write a separate mail describing
> > it (to the best of my knowledge) and we can discuss there.
> >
> > In particular, the above link contains a question that is still
> > unanswered and that would help me understand this better.
> > I'll copy-paste it here:
> >
> > """
> > Regarding this: I'd really like to understand better this 'step' concept
> > and it applicability on this controller. So any clarification is welcome
> > :)
> >
> > As far as I can see: currently the hardware does ECC corrections in a
> > completely transparent fashion and merely 'reports' the no. of corrected
> > bits through some IRQ plus some registers.
> > Therefore, it implements the ecc.{read,write}_page() functions.
> >
> > So, why should I tell the NAND core any of the ECC details?
> 
> Because MTD/NAND now implements a bitflip threshold based on the
> reported ECC strength and step size. See commit:
> 
>   commit edbc4540e02c201bdd4f4d498ebb6ed517fd36e2
>   Author: Mike Dunn <mikedunn@newsguy.com>
>   Date:   Wed Apr 25 12:06:11 2012 -0700
> 
>       mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN
> 
> and some of the other related code and documentation, such as in this commit:
> 
>   commit d062d4ede877fcd2ecc4c6262abad09a6f32950a
>   Author: Mike Dunn <mikedunn@newsguy.com>
>   Date:   Wed Apr 25 12:06:08 2012 -0700
> 
>       mtd: bitflip_threshold added to mtd_info and sysfs
> 
> If you don't have the correct strength, then this may not work as
> intended. (I realized now that the ECC step size doesn't play a part
> in the bitflip threshold process; only the strength is required to be
> correct.)
> 
> ...and now that I bring this up, I see that pxa3xx_nand.c has not been
> updated to report 'max_bitflips' via return code from
> pxa3xx_nand_read_page_hwecc(). This needs fixed. I wonder how many
> other drivers are similarly broken. I just realized that my
> out-of-tree driver is broken for this feature :(
> 

Hm.. I see. Well, it's just a matter of returning the corrected bits,
which are already obtained. Furthermore, one of the last patches in
this series, namely:

"mtd: nand: pxa3xx: Add ECC BCH correctable errors detection"

Takes care of obtaining the proper corrected bits number.

(Let me paste here your other reply to this same mail)

"""
> To clarify a bit further: the ECC step size doesn't play a part in
> nand_base when dealing with max_bitflips, but it is implicit in the
> specification: the driver should be returning the maximum number of
> bitflips corrected in a single ECC sector of the page that was read.
> So if your driver reports ECC strength of 8 over a 512 byte step, then
> you should report a number in the range of 0 to 8, representing
> bitflips in a 512B sector. If you don't have this granularity (which
> it looks like you might not?) then maybe your strength-per-sector
> should really be 16-per-2048B or 16-per-1024B, etc.
"""

So, if I understand correctly and assuming the controller works as the
specification says (sorry, it's not public yet) I think the 'step' is
the chunk size and the strength is 16 bytes:

	/* In BCH mode */
	ecc->size = chunk->size;
	ecc->strength = 16;

And maybe I could try to expand some more the ECC description in the
Documentation/mtd/nand/pxa3xx-nand.txt.

-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

  parent reply	other threads:[~2013-11-06 11:32 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 12:55 [PATCH v3 00/28] Armada 370/XP NAND support Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 01/28] clk: mvebu: Add Core Divider clock Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 02/28] ARM: mvebu: Add Core Divider clock device-tree binding Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 03/28] ARM: mvebu: Add a 2 GHz fixed-clock Armada 370/XP Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 04/28] ARM: mvebu: Add the core-divider clock to " Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 05/28] mtd: nand: pxa3xx: Make config menu show supported platforms Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 06/28] mtd: nand: pxa3xx: Prevent sub-page writes Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 07/28] mtd: nand: pxa3xx: Early variant detection Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 08/28] mtd: nand: pxa3xx: Use chip->cmdfunc instead of the internal Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 09/28] mtd: nand: pxa3xx: Split FIFO size from to-be-read FIFO count Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 10/28] mtd: nand: pxa3xx: Replace host->page_size by mtd->writesize Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 11/28] mtd: nand: pxa3xx: Add a nice comment to pxa3xx_set_datasize() Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 12/28] mtd: nand: pxa3xx: Use a completion to signal device ready Ezequiel Garcia
2013-11-05 19:51   ` Brian Norris
2013-11-06  0:28     ` Ezequiel Garcia
2013-11-06  0:46       ` Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 13/28] mtd: nand: pxa3xx: Add bad block handling Ezequiel Garcia
2013-11-05 18:23   ` Brian Norris
2013-11-05 23:40     ` Ezequiel Garcia
2013-11-06  1:36       ` Brian Norris
2013-11-05 12:55 ` [PATCH v3 14/28] mtd: nand: pxa3xx: Add driver-specific ECC BCH support Ezequiel Garcia
2013-11-05 18:31   ` Brian Norris
2013-11-05 23:24     ` Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 15/28] mtd: nand: pxa3xx: Clear cmd buffer #3 (NDCB3) on command start Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 16/28] mtd: nand: pxa3xx: Add helper function to set page address Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 17/28] mtd: nand: pxa3xx: Remove READ0 switch/case falltrough Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 18/28] mtd: nand: pxa3xx: Split prepare_command_pool() in two stages Ezequiel Garcia
2013-11-05 18:32   ` Brian Norris
2013-11-05 12:55 ` [PATCH v3 19/28] mtd: nand: pxa3xx: Move the data buffer clean to prepare_start_command() Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 20/28] mtd: nand: pxa3xx: Fix SEQIN column address set Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 21/28] mtd: nand: pxa3xx: Add a read/write buffers markers Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 22/28] mtd: nand: pxa3xx: Introduce multiple page I/O support Ezequiel Garcia
2013-11-05 19:04   ` Brian Norris
2013-11-06  1:13     ` Ezequiel Garcia
2013-11-06  2:20       ` Brian Norris
2013-11-06  2:27         ` Brian Norris
2013-11-06  3:35         ` Ezequiel Garcia
2013-11-06 11:32         ` Ezequiel Garcia [this message]
2013-11-18 18:10           ` Brian Norris
2013-11-18 18:33             ` Ezequiel Garcia
2013-11-18 18:50               ` Brian Norris
2013-12-04 21:41                 ` Brian Norris
2013-11-05 19:08   ` Brian Norris
2013-11-05 12:55 ` [PATCH v3 23/28] mtd: nand: pxa3xx: Add multiple chunk write support Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 24/28] mtd: nand: pxa3xx: Add ECC BCH correctable errors detection Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 25/28] ARM: mvebu: Add support for NAND controller in Armada 370/XP Ezequiel Garcia
2013-11-05 13:29   ` Jason Cooper
2013-11-05 13:51     ` Ezequiel Garcia
2013-11-05 15:15       ` Jason Cooper
2013-11-05 15:37         ` Ezequiel Garcia
2013-11-06  8:24         ` Thomas Petazzoni
2013-11-06 11:42           ` Jason Cooper
2013-11-06 12:56             ` Thomas Petazzoni
2013-11-06 17:21               ` Jason Cooper
2013-11-05 12:55 ` [PATCH v3 26/28] ARM: mvebu: Enable NAND controller in Armada XP GP board Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 27/28] ARM: mvebu: Enable NAND controller in Armada 370 Mirabox Ezequiel Garcia
2013-11-05 12:55 ` [PATCH v3 28/28] mtd: nand: pxa3xx: Add documentation about the controller Ezequiel Garcia

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=20131106113210.GB2616@localhost \
    --to=ezequiel.garcia@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).