should nand driver create ECC for a page after ERASE cmd?
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.
Signature · 2 lines
Regards, Oleksij
Quoted 11 lines · Oleksij Rempel
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#L311after 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
Signature · 2 lines
Ezequiel Garcia, VanguardiaSur www.vanguardiasur.com.ar
Am 21.12.2014 um 02:46 schrieb Ezequiel Garcia:
Quoted 10 lines · Oleksij Rempel
Quoted 9 lines
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#L311after 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.
Quoted 8 lines
Quoted 2 lines
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.
Signature · 2 lines
Regards, Oleksij
Hi Oleksij,
Quoted 10 lines · On Sat, 20 Dec 2014 09:42:29 +0100 Oleksij Rempel <[email protected]>…
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#L311after 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
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
Quoted 20 lines
Hi Oleksij,
Quoted 10 lines · On Sat, 20 Dec 2014 09:42:29 +0100 Oleksij Rempel <[email protected]>…
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#L311after 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 ;-))
Quoted 13 lines
1) Wiser controllers are generating
0xffECC bytes for a data chunk (chunk == ECC step size) filled with0xff. 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 all0xffbefore passing it to the ECC engine. If they are filled with0xffthe 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
Signature · 2 lines
Regards, Oleksij
Quoted 19 lines · Oleksij Rempel
Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
Quoted 4 lines
Well, actually it depends on your NAND/ECC controller capabilities (but given your discussion with Richard on IRC, I guess you already understood that ;-))
Quoted 13 lines
1) Wiser controllers are generating
0xffECC bytes for a data chunk (chunk == ECC step size) filled with0xff. 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 all0xffbefore passing it to the ECC engine. If they are filled with0xffthe 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.
Quoted 3 lines
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
Am 22.12.2014 um 19:41 schrieb Brian Norris:
Quoted 20 lines · Oleksij Rempel
Quoted 19 lines
Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
Quoted 17 lines
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
0xffECC bytes for a data chunk (chunk == ECC step size) filled with0xff. 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 all0xffbefore passing it to the ECC engine. If they are filled with0xffthe 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.
Quoted 7 lines
Quoted 3 lines
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_testsPatches 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?
Signature · 2 lines
Regards, Oleksij
Quoted 25 lines · On Mon, 22 Dec 2014 20:50:42 +0100 Oleksij Rempel <[email protected]>…
Am 22.12.2014 um 19:41 schrieb Brian Norris:
Quoted 24 lines · Oleksij Rempel
Quoted 22 lines
Am 21.12.2014 um 17:28 schrieb Boris Brezillon:
Quoted 4 lines
Well, actually it depends on your NAND/ECC controller capabilities (but given your discussion with Richard on IRC, I guess you already understood that ;-))
Quoted 13 lines
1) Wiser controllers are generating
0xffECC bytes for a data chunk (chunk == ECC step size) filled with0xff. 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 all0xffbefore passing it to the ECC engine. If they are filled with0xffthe 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
Quoted 7 lines
Quoted 3 lines
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...
Quoted 2 lines
Boris are you ok if i use your description for this patch?
Sure, no problem.
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com