From: Ivan Djelic <ivan.djelic@parrot.com>
To: Mike Dunn <mikedunn@newsguy.com>
Cc: Marek Vasut <marek.vasut@gmail.com>,
"robert.jarzmik@free.fr" <robert.jarzmik@free.fr>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] Add driver for M-sys / Sandisk diskonchip G4 nand flash
Date: Mon, 10 Oct 2011 20:12:10 +0200 [thread overview]
Message-ID: <20111010181210.GA23655@parrot.com> (raw)
In-Reply-To: <201110101751.19010.marek.vasut@gmail.com>
On Mon, Oct 10, 2011 at 04:51:18PM +0100, Marek Vasut wrote:
> On Monday, October 10, 2011 04:48:10 PM Mike Dunn wrote:
> > This is a driver for the diskonchip G4 in my Palm Treo680. I've tested it
> > fairly well; it passes the nandtest utility, and I've been able to create a
> > ubifs using it.
Hello Mike,
I had a quick look at how you handle BCH ecc correction. If I understood
correctly:
- hw generates a 56-bit polynomial remainder (56 = 14*4, m=14, t=4)
- hw-generated polynomial terms are mapped to bits in a way not compatible with
the BCH library
Still, I do not understand why you go to great lengths computing syndromes in
your code, using a mix of generated remainder tables and Galois field tables.
Why don't you just reformat the hw-generated polynomial (cheap, only 56 bits
to shuffle) and let the BCH library do the whole computation ?
> > +
> > + /* undo last step in BCH alg; currently this is a mystery to me */
Maybe I can help here :)
This last step exists because the BCH library represents nand data as a large
polynomial with high order terms first (this is consistent with several hw
generators). If N is the total bit length of array data[], then byte data[0]
will contain polynomial terms X^(N-1) (in bit 7), X^(N-2), ... X^(N-8) (in bit
0). Byte data[1] will contain X^(N-9) (bit 7) ... X^(N-16) (bit 0) and so on.
Thus, term X^i is located in byte data[(N-1-i)/8], in bit position
7-(N-1-i)%8. The last step:
errloc[i] = (errloc[i] & ~7)|(7-(errloc[i] & 7));
was added just so that users can correct bit errors with byte access:
data[errloc[i]/8] ^= 1 << (errloc[i] & 7);
instead of (the slightly more complicated):
data[errloc[i]/8] ^= 1 << (7-(errloc[i] & 7));
And that's all there is to it, really.
Looking at your code, it seems that your hw generator represents nand data[] as
a 32-bit words array with high order terms in lower bits (assuming your machine
is little-endian):
data[0] = X^(N-32) (bit 31) ... X^(N-1) (bit 0),
data[1] = X^(N-64) (bit 31) ... X^(N-33) (bit 0)
.. and so on. In your case you don't need the modulo mirroring step.
BR,
--
Ivan
next prev parent reply other threads:[~2011-10-10 18:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 14:48 [PATCH] Add driver for M-sys / Sandisk diskonchip G4 nand flash Mike Dunn
2011-10-10 15:51 ` Marek Vasut
2011-10-10 18:12 ` Ivan Djelic [this message]
2011-10-10 21:02 ` Mike Dunn
2011-10-11 11:50 ` Ivan Djelic
2011-10-11 19:17 ` Mike Dunn
2011-10-12 18:49 ` Ivan Djelic
2011-10-13 1:18 ` Mike Dunn
2011-10-13 6:58 ` Robert Jarzmik
2011-10-13 8:37 ` Ivan Djelic
2011-10-13 15:52 ` Mike Dunn
2011-10-10 20:20 ` Mike Dunn
2011-10-12 21:28 ` Robert Jarzmik
2011-10-13 0:26 ` Marek Vasut
2011-10-13 2:25 ` Mike Dunn
2011-10-13 1:53 ` Mike Dunn
2011-10-17 21:45 ` Mike Dunn
2011-10-20 16:31 ` Artem Bityutskiy
2011-10-20 19:57 ` Mike Dunn
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=20111010181210.GA23655@parrot.com \
--to=ivan.djelic@parrot.com \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=mikedunn@newsguy.com \
--cc=robert.jarzmik@free.fr \
/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).