From: ezequiel.garcia@free-electrons.com (Ezequiel Garcia)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 26/31] mtd: nand: pxa3xx: Introduce multiple page I/O support
Date: Thu, 7 Nov 2013 20:45:00 -0300 [thread overview]
Message-ID: <20131107234459.GB2467@localhost> (raw)
In-Reply-To: <1383837455-30721-27-git-send-email-ezequiel.garcia@free-electrons.com>
Hello,
I have a concern about the ECC mode and strength determination.
On Thu, Nov 07, 2013 at 12:17:30PM -0300, Ezequiel Garcia wrote:
[..]
> @@ -1152,7 +1289,28 @@ static int armada370_ecc_init(struct pxa3xx_nand_info *info,
> struct nand_ecc_ctrl *ecc,
> int strength, int page_size)
> {
> - /* Unimplemented yet */
> + if (strength == 4 && page_size == 4096) {
> + info->ecc_bch = 1;
> + info->chunk_size = 2048;
> + info->spare_size = 32;
> + info->ecc_size = 32;
> + ecc->mode = NAND_ECC_HW;
> + ecc->size = info->chunk_size;
> + ecc->layout = &ecc_layout_4KB_bch4bit;
> + ecc->strength = 16;
> + return 1;
> +
> + } else if (strength == 8 && page_size == 4096) {
> + info->ecc_bch = 1;
> + info->chunk_size = 1024;
> + info->spare_size = 0;
> + info->ecc_size = 32;
> + ecc->mode = NAND_ECC_HW;
> + ecc->size = info->chunk_size;
> + ecc->layout = &ecc_layout_4KB_bch8bit;
> + ecc->strength = 16;
> + return 1;
> + }
> return 0;
> }
>
The above shows I tried to be very careful (aka paranoid) in the ECC
mode determination. Please note that what I call "ECC mode", is
determined by the chunk->size value only.
As the included documentation explains this controller supports two
different BCH ECC strength: 16-over-1024, or 16-over-2048. Setting the chunk
size to either 1024 or 2048 is what determines which of the above will
actually take effect.
In past mails, we've refered to these two as BCH4 or BCH8, but this is not
really accurate (as Brian has pointed out) so I droped that terms in
favor of the real thing: 16 correctable bits over 1024 data bytes, or
16 correctable bits over 2048 data bytes.
In turn, such BCH mode setting affects heavily the page layout, because
after each transfered chunk (which is either 1024+spare or 2048+spare)
the controller reads and writes a 30B ECC region.
In other words, the kernel cannot arbitrarily change this setting, or
the image won't be readable/writeable any longer.
For this reason, I'm starting to think the above method of picking
the "ECC mode" based solely on the page size or the strength is slightly
fragile (future developers might come and "improve" the driver breaking
images).
Besides: what if a user wants the kernel to use a "higher" than
required strength?
In conclusion: I'm starting to think a better (and long-term safer)
approach is to set the ECC mode in the DT. I know this sucks, but from
my point of view the flash device contains an image that "must" be
read/write with a given ECC mode, and this ECC mode is by no means
discoverable.
Now, let's suppose we want to set this in the DT: what property
would we use? "marvell,nand-ecc-opt = 16-2048"? (a bit odd, no?).
What do you think?
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
next prev parent reply other threads:[~2013-11-07 23:45 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-07 15:17 [PATCH v4 00/31] Armada 370/XP NAND support Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 01/31] clk: mvebu: Add Core Divider clock Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 02/31] ARM: mvebu: Add Core Divider clock device-tree binding Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 03/31] ARM: mvebu: Add a 2 GHz fixed-clock Armada 370/XP Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 04/31] ARM: mvebu: Add the core-divider clock to " Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 05/31] mtd: nand: pxa3xx: devicetree binding update Ezequiel Garcia
2013-11-07 15:32 ` Jason Cooper
2013-11-07 16:41 ` Ezequiel Garcia
2013-11-07 17:54 ` Jason Cooper
2013-11-07 15:17 ` [PATCH v4 06/31] mtd: nand: pxa3xx: Add documentation about the controller Ezequiel Garcia
2013-11-14 19:00 ` Brian Norris
2013-11-14 19:49 ` Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 07/31] mtd: nand: pxa3xx: Make config menu show supported platforms Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 08/31] mtd: nand: pxa3xx: Prevent sub-page writes Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 09/31] mtd: nand: pxa3xx: read_page() returns max_bitflips Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 10/31] mtd: nand: pxa3xx: Early variant detection Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 11/31] mtd: nand: pxa3xx: Use chip->cmdfunc instead of the internal Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 12/31] mtd: nand: pxa3xx: Split FIFO size from to-be-read FIFO count Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 13/31] mtd: nand: pxa3xx: Replace host->page_size by mtd->writesize Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 14/31] mtd: nand: pxa3xx: Add a nice comment to pxa3xx_set_datasize() Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 15/31] mtd: nand: pxa3xx: Use a completion to signal device ready Ezequiel Garcia
2013-11-14 18:39 ` Brian Norris
2013-11-14 18:53 ` Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 16/31] mtd: nand: pxa3xx: Use waitfunc() to wait for the device to be ready Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 17/31] mtd: nand: pxa3xx: Add bad block handling Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 18/31] mtd: nand: pxa3xx: Add driver-specific ECC BCH support Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 19/31] mtd: nand: pxa3xx: Clear cmd buffer #3 (NDCB3) on command start Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 20/31] mtd: nand: pxa3xx: Add helper function to set page address Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 21/31] mtd: nand: pxa3xx: Remove READ0 switch/case falltrough Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 22/31] mtd: nand: pxa3xx: Split prepare_command_pool() in two stages Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 23/31] mtd: nand: pxa3xx: Move the data buffer clean to prepare_start_command() Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 24/31] mtd: nand: pxa3xx: Fix SEQIN column address set Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 25/31] mtd: nand: pxa3xx: Add a read/write buffers markers Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 26/31] mtd: nand: pxa3xx: Introduce multiple page I/O support Ezequiel Garcia
2013-11-07 23:45 ` Ezequiel Garcia [this message]
2013-11-08 0:46 ` Brian Norris
2013-11-08 3:21 ` Ezequiel Garcia
2013-11-14 15:40 ` Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 27/31] mtd: nand: pxa3xx: Add multiple chunk write support Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 28/31] mtd: nand: pxa3xx: Add ECC BCH correctable errors detection Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 29/31] ARM: mvebu: Add support for NAND controller in Armada 370/XP Ezequiel Garcia
2013-11-24 3:42 ` Jason Cooper
2013-11-07 15:17 ` [PATCH v4 30/31] ARM: mvebu: Enable NAND controller in Armada XP GP board Ezequiel Garcia
2013-11-07 15:17 ` [PATCH v4 31/31] ARM: mvebu: Enable NAND controller in Armada 370 Mirabox Ezequiel Garcia
2013-11-07 23:28 ` [PATCH v4 00/31] Armada 370/XP NAND support Ezequiel Garcia
2013-11-10 23:24 ` 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=20131107234459.GB2467@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).