* should nand driver create ECC for a page after ERASE cmd?
@ 2014-12-20 8:42 Oleksij Rempel
2014-12-21 1:46 ` Ezequiel Garcia
2014-12-21 16:28 ` Boris Brezillon
0 siblings, 2 replies; 8+ messages in thread
From: Oleksij Rempel @ 2014-12-20 8:42 UTC (permalink / raw)
To: linux-mtd,
boris.brezillon@free-electrons.com >> Boris Brezillon,
computersforpeace
[-- Attachment #1: Type: text/plain, Size: 864 bytes --]
Hello all,
i'm trying to pass mtd/tests for my driver.. on pagetest i fail on this
place:
http://lxr.free-electrons.com/source/drivers/mtd/tests/pagetest.c#L311
after ERASE cmd this test trying to read same page. Driver will report
ECC error on read, because erased page has no ECC data in OOB.
What is correct way to handle it?
Right now i think about fallowing scenarios:
- nand should write page filled with 0xFFs, to generate ECC. (i think it
is wrong)
- nand should check if ECC == 0xFF.. and return other error number. (not
really good)
- write some oob filed to mark erased page?
- other variants?
in all cases it looks like it should be task of mtd or nand layer to
send needed request and not the task of a driver.
PS: i think it is a cause of "error -74 (ECC error) during ubiattach" in
my case.
--
Regards,
Oleksij
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should nand driver create ECC for a page after ERASE cmd?
2014-12-20 8:42 should nand driver create ECC for a page after ERASE cmd? Oleksij Rempel
@ 2014-12-21 1:46 ` Ezequiel Garcia
2014-12-21 14:13 ` Oleksij Rempel
2014-12-21 16:28 ` Boris Brezillon
1 sibling, 1 reply; 8+ messages in thread
From: Ezequiel Garcia @ 2014-12-21 1:46 UTC (permalink / raw)
To: Oleksij Rempel, linux-mtd,
boris.brezillon@free-electrons.com >> Boris Brezillon,
computersforpeace
On 12/20/2014 05:42 AM, Oleksij Rempel wrote:
> Hello all,
>
> i'm trying to pass mtd/tests for my driver.. on pagetest i fail on this
> place:
> http://lxr.free-electrons.com/source/drivers/mtd/tests/pagetest.c#L311
>
> after ERASE cmd this test trying to read same page. Driver will report
> ECC error on read, because erased page has no ECC data in OOB.
>
> What is correct way to handle it?
>
[..]
This might help, although I'm not sure it's the best solution.
$ git grep is_buf_blank drivers/mtd/nand/pxa3xx_nand.c
--
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should nand driver create ECC for a page after ERASE cmd?
2014-12-21 1:46 ` Ezequiel Garcia
@ 2014-12-21 14:13 ` Oleksij Rempel
0 siblings, 0 replies; 8+ messages in thread
From: Oleksij Rempel @ 2014-12-21 14:13 UTC (permalink / raw)
To: Ezequiel Garcia, linux-mtd,
boris.brezillon@free-electrons.com >> Boris Brezillon,
computersforpeace
[-- Attachment #1: Type: text/plain, Size: 693 bytes --]
Am 21.12.2014 um 02:46 schrieb Ezequiel Garcia:
> On 12/20/2014 05:42 AM, Oleksij Rempel wrote:
>> Hello all,
>>
>> i'm trying to pass mtd/tests for my driver.. on pagetest i fail on this
>> place:
>> http://lxr.free-electrons.com/source/drivers/mtd/tests/pagetest.c#L311
>>
>> after ERASE cmd this test trying to read same page. Driver will report
>> ECC error on read, because erased page has no ECC data in OOB.
>>
>> What is correct way to handle it?
>>
> [..]
>
> This might help, although I'm not sure it's the best solution.
>
> $ git grep is_buf_blank drivers/mtd/nand/pxa3xx_nand.c
>
Thank you! It should be good starting point.
--
Regards,
Oleksij
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should nand driver create ECC for a page after ERASE cmd?
2014-12-20 8:42 should nand driver create ECC for a page after ERASE cmd? Oleksij Rempel
2014-12-21 1:46 ` Ezequiel Garcia
@ 2014-12-21 16:28 ` Boris Brezillon
2014-12-21 18:44 ` Oleksij Rempel
1 sibling, 1 reply; 8+ messages in thread
From: Boris Brezillon @ 2014-12-21 16:28 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: computersforpeace, linux-mtd
Hi Oleksij,
On Sat, 20 Dec 2014 09:42:29 +0100
Oleksij Rempel <linux@rempel-privat.de> wrote:
> Hello all,
>
> i'm trying to pass mtd/tests for my driver.. on pagetest i fail on this
> place:
> http://lxr.free-electrons.com/source/drivers/mtd/tests/pagetest.c#L311
>
> after ERASE cmd this test trying to read same page. Driver will report
> ECC error on read, because erased page has no ECC data in OOB.
>
> What is correct way to handle it?
Well, actually it depends on your NAND/ECC controller capabilities (but
given your discussion with Richard on IRC, I guess you already
understood that ;-))
1) Wiser controllers are generating 0xff ECC bytes for a data chunk
(chunk == ECC step size) filled with 0xff. With BCH algorithms this is
easily done by XORing the ECC bytes with the appropriate pattern (see
soft BCH implementation)
2) Some controller just verify if the data chunk + ECC bytes are all
0xff before passing it to the ECC engine. If they are filled with 0xff
the ECC correction is bypassed.
This method has one drawback: it does not properly handle bitflips
occurring in erased pages (if one bitflip occurs the NAND controller
consider the chunk as not empty, and pass it to the BCH engine).
3) The controller does not handle erased pages at all, and in this case
you'll have to manually test it (as Ezequiel suggested) when you
encounter an ECC error.
Regards,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should nand driver create ECC for a page after ERASE cmd?
2014-12-21 16:28 ` Boris Brezillon
@ 2014-12-21 18:44 ` Oleksij Rempel
2014-12-22 18:41 ` Brian Norris
0 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2014-12-21 18:44 UTC (permalink / raw)
To: Boris Brezillon; +Cc: computersforpeace, linux-mtd
[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]
Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
> Hi Oleksij,
>
> On Sat, 20 Dec 2014 09:42:29 +0100
> Oleksij Rempel <linux@rempel-privat.de> wrote:
>
>> Hello all,
>>
>> i'm trying to pass mtd/tests for my driver.. on pagetest i fail on this
>> place:
>> http://lxr.free-electrons.com/source/drivers/mtd/tests/pagetest.c#L311
>>
>> after ERASE cmd this test trying to read same page. Driver will report
>> ECC error on read, because erased page has no ECC data in OOB.
>>
>> What is correct way to handle it?
>
> Well, actually it depends on your NAND/ECC controller capabilities (but
> given your discussion with Richard on IRC, I guess you already
> understood that ;-))
>
> 1) Wiser controllers are generating 0xff ECC bytes for a data chunk
> (chunk == ECC step size) filled with 0xff. With BCH algorithms this is
> easily done by XORing the ECC bytes with the appropriate pattern (see
> soft BCH implementation)
> 2) Some controller just verify if the data chunk + ECC bytes are all
> 0xff before passing it to the ECC engine. If they are filled with 0xff
> the ECC correction is bypassed.
> This method has one drawback: it does not properly handle bitflips
> occurring in erased pages (if one bitflip occurs the NAND controller
> consider the chunk as not empty, and pass it to the BCH engine).
> 3) The controller does not handle erased pages at all, and in this case
> you'll have to manually test it (as Ezequiel suggested) when you
> encounter an ECC error.
Thanks a lot to all responses,
i recognised my mistake and learned from it.
Boris,
i think your explanation can be placed to mtd web page, some where here :)
http://www.linux-mtd.infradead.org/doc/general.html#L_mtd_tests
--
Regards,
Oleksij
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should nand driver create ECC for a page after ERASE cmd?
2014-12-21 18:44 ` Oleksij Rempel
@ 2014-12-22 18:41 ` Brian Norris
2014-12-22 19:50 ` Oleksij Rempel
0 siblings, 1 reply; 8+ messages in thread
From: Brian Norris @ 2014-12-22 18:41 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: Boris Brezillon, linux-mtd
On Sun, Dec 21, 2014 at 07:44:26PM +0100, Oleksij Rempel wrote:
> Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
> > Well, actually it depends on your NAND/ECC controller capabilities (but
> > given your discussion with Richard on IRC, I guess you already
> > understood that ;-))
> >
> > 1) Wiser controllers are generating 0xff ECC bytes for a data chunk
> > (chunk == ECC step size) filled with 0xff. With BCH algorithms this is
> > easily done by XORing the ECC bytes with the appropriate pattern (see
> > soft BCH implementation)
> > 2) Some controller just verify if the data chunk + ECC bytes are all
> > 0xff before passing it to the ECC engine. If they are filled with 0xff
> > the ECC correction is bypassed.
> > This method has one drawback: it does not properly handle bitflips
> > occurring in erased pages (if one bitflip occurs the NAND controller
> > consider the chunk as not empty, and pass it to the BCH engine).
> > 3) The controller does not handle erased pages at all, and in this case
> > you'll have to manually test it (as Ezequiel suggested) when you
> > encounter an ECC error.
>
> Boris,
> i think your explanation can be placed to mtd web page, some where here :)
> http://www.linux-mtd.infradead.org/doc/general.html#L_mtd_tests
Patches are welcome:
http://www.linux-mtd.infradead.org/faq/general.html#L_mtdwww
Brian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should nand driver create ECC for a page after ERASE cmd?
2014-12-22 18:41 ` Brian Norris
@ 2014-12-22 19:50 ` Oleksij Rempel
2014-12-23 11:27 ` Boris Brezillon
0 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2014-12-22 19:50 UTC (permalink / raw)
To: Brian Norris; +Cc: Boris Brezillon, linux-mtd
[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]
Am 22.12.2014 um 19:41 schrieb Brian Norris:
> On Sun, Dec 21, 2014 at 07:44:26PM +0100, Oleksij Rempel wrote:
>> Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
>>> Well, actually it depends on your NAND/ECC controller capabilities (but
>>> given your discussion with Richard on IRC, I guess you already
>>> understood that ;-))
>>>
>>> 1) Wiser controllers are generating 0xff ECC bytes for a data chunk
>>> (chunk == ECC step size) filled with 0xff. With BCH algorithms this is
>>> easily done by XORing the ECC bytes with the appropriate pattern (see
>>> soft BCH implementation)
>>> 2) Some controller just verify if the data chunk + ECC bytes are all
>>> 0xff before passing it to the ECC engine. If they are filled with 0xff
>>> the ECC correction is bypassed.
>>> This method has one drawback: it does not properly handle bitflips
>>> occurring in erased pages (if one bitflip occurs the NAND controller
>>> consider the chunk as not empty, and pass it to the BCH engine).
>>> 3) The controller does not handle erased pages at all, and in this case
>>> you'll have to manually test it (as Ezequiel suggested) when you
>>> encounter an ECC error.
>>
>> Boris,
>> i think your explanation can be placed to mtd web page, some where here :)
>> http://www.linux-mtd.infradead.org/doc/general.html#L_mtd_tests
>
> Patches are welcome:
>
> http://www.linux-mtd.infradead.org/faq/general.html#L_mtdwww
No problem,
should it go to "general.html#L_mtd_tests" or some other section? Boris
are you ok if i use your description for this patch?
--
Regards,
Oleksij
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should nand driver create ECC for a page after ERASE cmd?
2014-12-22 19:50 ` Oleksij Rempel
@ 2014-12-23 11:27 ` Boris Brezillon
0 siblings, 0 replies; 8+ messages in thread
From: Boris Brezillon @ 2014-12-23 11:27 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: Brian Norris, linux-mtd
On Mon, 22 Dec 2014 20:50:42 +0100
Oleksij Rempel <linux@rempel-privat.de> wrote:
> Am 22.12.2014 um 19:41 schrieb Brian Norris:
> > On Sun, Dec 21, 2014 at 07:44:26PM +0100, Oleksij Rempel wrote:
> >> Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
> >>> Well, actually it depends on your NAND/ECC controller capabilities (but
> >>> given your discussion with Richard on IRC, I guess you already
> >>> understood that ;-))
> >>>
> >>> 1) Wiser controllers are generating 0xff ECC bytes for a data chunk
> >>> (chunk == ECC step size) filled with 0xff. With BCH algorithms this is
> >>> easily done by XORing the ECC bytes with the appropriate pattern (see
> >>> soft BCH implementation)
> >>> 2) Some controller just verify if the data chunk + ECC bytes are all
> >>> 0xff before passing it to the ECC engine. If they are filled with 0xff
> >>> the ECC correction is bypassed.
> >>> This method has one drawback: it does not properly handle bitflips
> >>> occurring in erased pages (if one bitflip occurs the NAND controller
> >>> consider the chunk as not empty, and pass it to the BCH engine).
> >>> 3) The controller does not handle erased pages at all, and in this case
> >>> you'll have to manually test it (as Ezequiel suggested) when you
> >>> encounter an ECC error.
> >>
> >> Boris,
> >> i think your explanation can be placed to mtd web page, some where here :)
> >> http://www.linux-mtd.infradead.org/doc/general.html#L_mtd_tests
> >
> > Patches are welcome:
> >
> > http://www.linux-mtd.infradead.org/faq/general.html#L_mtdwww
>
> No problem,
>
> should it go to "general.html#L_mtd_tests" or some other section?
IMHO, it should go somewhere in the NAND page:
http://www.linux-mtd.infradead.org/doc/nand.html
Maybe adding a NAND controller section would make sense...
> Boris are you ok if i use your description for this patch?
>
Sure, no problem.
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-12-23 11:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-20 8:42 should nand driver create ECC for a page after ERASE cmd? Oleksij Rempel
2014-12-21 1:46 ` Ezequiel Garcia
2014-12-21 14:13 ` Oleksij Rempel
2014-12-21 16:28 ` Boris Brezillon
2014-12-21 18:44 ` Oleksij Rempel
2014-12-22 18:41 ` Brian Norris
2014-12-22 19:50 ` Oleksij Rempel
2014-12-23 11:27 ` Boris Brezillon
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).