query: nand read/write method for 2048 + 64 byte page
I noticed
http://lists.infradead.org/pipermail/linux-mtd/2009-June/026133.html
I don't think I understand the question. But I have two comments that might help:
- First, the ECC schemes don't dictate much about how the OOB area gets laid out, so what's the problem? Just pick a layout that doesn't clobber manufacturer bad block markers and you'll be pretty much OK. Stick all ECC at the end, to keep it simple.
- Second, I believe that you will see some issues if you try to have ECC cover the OOB too. Problem being that the raw_write primitives are used to write OOB data and they don't believe it will be ECC protected.
ECC_HW should probably work fine. You'll just provide your own ecclayout struct, and set things up so the NAND core knows the hardware works in 512 byte chunks that give 7 byte each of ECC data.
- Dave
Quoted 13 lines · David Brownell
I noticed
http://lists.infradead.org/pipermail/linux-mtd/2009-June/026133.html
I don't think I understand the question. But I have two comments that might help:
- First, the ECC schemes don't dictate much about how the OOB area gets laid out, so what's the problem? Just pick a layout that doesn't clobber manufacturer bad block markers and you'll be pretty much OK. Stick all ECC at the end, to keep it simple.
Quoted 4 lines
- Second, I believe that you will see some issues if you try to have ECC cover the OOB too. Problem being that the
raw_writeprimitives are used to write OOB data and they don't believe it will be ECC protected.
My point is to protect OOB too (other than ECC bytes).
So, should we implement new OOB area read/write primitives to support this?
And in that case how will we be handling those cases where spare bytes are protected by clubbing them with main area bytes to generate ECC? (as example in my previous mail)
Quoted 8 lines
ECC_HWshould probably work fine. You'll just provide your own ecclayout struct, and set things up so the NAND core knows the hardware works in 512 byte chunks that give 7 byte each of ECC data.- Dave
Signature · 3 lines
--- Regards, \/ | |\/| /-\ |_
Quoted 7 lines · vimal singh
Quoted 4 lines
- Second, I believe that you will see some issues if you try to have ECC cover the OOB too. Problem being that the
raw_writeprimitives are used to write OOB data and they don't believe it will be ECC protected.My point is to protect OOB too (other than ECC bytes).
So, should we implement new OOB area read/write primitives to support this?
It's not so much a case of "can it be done"; you may have noticed that ECC_HW_SYNDROME can do that. While that layout is problematic, it certainly allows for "prepad" data to be included in the ECC. For a 2K page, with 7 ECC bytes for each 512+9 bytes of data, the page layout is
4 * (512 bytes data + 9 bytes OOB + 7 bytes ECC)
where prepad == 9 ... but such layouts have obvious nasty characteristics, since you can't DMA the whole 2K of data in one chunk, and since it clobbers manufacturer bad block markers.
(FWIW I call such layouts "Infix OOB", where the Out-of-Band data is actually not out-of-band in the spare area.)
Or if the hardware allows you could just use 521 byte ECC chunks (8-bit NAND only!) and when you run out of 2K page buffer, roll directly into the OOB data. You'd have to provide i/o methods that manage OOB and ECC data that way, but that seems like it'd suffice as a driver-specific kind of override, using ECC_HW and your matching ecclayout.
Quoted 3 lines
And in that case how will we be handling those cases where spare bytes are protected by clubbing them with main area bytes to generate ECC? (as example in my previous mail)
You haven't addressed my observation that there's software out there which is going to be writing the OOB data and yet not expecting it to invalidate the ECC... as in, maybe you want to change a version byte from 0x0f to 0x10. That has the look of a five bit ECC error! Or from 0x10 to 0x11, well that's an easily corrected single bit error.
- Dave
Quoted 9 lines · David Brownell
Quoted 7 lines · vimal singh
Quoted 4 lines
- Second, I believe that you will see some issues if you try to have ECC cover the OOB too. Problem being that the
raw_writeprimitives are used to write OOB data and they don't believe it will be ECC protected.My point is to protect OOB too (other than ECC bytes).
So, should we implement new OOB area read/write primitives to support this?
Quoted 7 lines
It's not so much a case of "can it be done"; you may have noticed that
ECC_HW_SYNDROMEcan do that. While that layout is problematic, it certainly allows for "prepad" data to be included in the ECC. For a 2K page, with 7 ECC bytes for each 512+9 bytes of data, the page layout is4 * (512 bytes data + 9 bytes OOB + 7 bytes ECC)
The problem is that HW ECC engine in BCH mode dose not provide any possible configuration where we can keep ECC bytes in main area itself. OOB + ECC data has to be in only spare area.
Would it not be the good idea to perform read/write for full (2112 bytes) page? And enable HW_ECC before read/write and then call for ecc.calculate or ecc.correct accordingly. Rest all things can be taken care by underlying controller driver.
Quoted 33 lines
where prepad == 9 ... but such layouts have obvious nasty characteristics, since you can't DMA the whole 2K of data in one chunk, and since it clobbers manufacturer bad block markers.
(FWIW I call such layouts "Infix OOB", where the Out-of-Band data is actually not out-of-band in the spare area.)
Or if the hardware allows you could just use 521 byte ECC chunks (8-bit NAND only!) and when you run out of 2K page buffer, roll directly into the OOB data. You'd have to provide i/o methods that manage OOB and ECC data that way, but that seems like it'd suffice as a driver-specific kind of override, using
ECC_HWand your matching ecclayout.Quoted 3 lines
And in that case how will we be handling those cases where spare bytes are protected by clubbing them with main area bytes to generate ECC? (as example in my previous mail)
You haven't addressed my observation that there's software out there which is going to be writing the OOB data and yet not expecting it to invalidate the ECC... as in, maybe you want to change a version byte from
0x0fto0x10. That has the look of a five bit ECC error! Or from0x10to0x11, well that's an easily corrected single bit error.- Dave
Signature · 7 lines
--- Regards, \/ | |\/| /-\ |_ ____ __o ------ -\<, ----- ( )/ ( )
Quoted 3 lines · vimal singh
The problem is that HW ECC engine in BCH mode dose not provide any possible configuration where we can keep ECC bytes in main area itself. OOB + ECC data has to be in only spare area.
Healthy. I disike that "infix OOB" myself. It is however a standard ECC mode in the NAND framework. :(
So you're asking about how to map hardware-specific details to the NAND framework? That wasn't clear.
Quoted 1 line
Would it not be the good idea to perform read/write for full (2112 bytes) page?
I'm not sure I can answer that without reading up on that particular NAND ECC engine.
Recall however that the NAND framework will think in terms of 2KB reads, with OOB data on the side. There will be separate reads for 2K and then 64 bytes.
Quoted 3 lines
And enable
HW_ECCbefore read/write and then call for ecc.calculate or ecc.correct accordingly. Rest all things can be taken care by underlying controller driver.
Those sentences seem to elide critical parts of the process. Like the details of OOB and ECC handling, which seem to be what you're not sure of...
Hi Vimal,
Quoted 7 lines · vimal singh
Quoted 5 lines
The problem is that HW ECC engine in BCH mode dose not provide any
possible configuration where we can keep ECC bytes in main area
itself. OOB + ECC data has to be in only spare area.
Quoted 6 lines
Healthy. I disike that "infix OOB" myself. It is however a standard ECC mode in the NAND framework. :(
So you're asking about how to map hardware-specific details
to the NAND framework? That wasn't clear.
I think better you use some of the bytes of OOB area , In almoost al NAND you can read 2K page size or 4K page size additinal you have to read OOB or spare area of NAND.
Quoted 5 lines
Quoted 4 lines
Would it not be the good idea to perform read/write for full (2112 bytes) page?
Quoted 13 lines
I'm not sure I can answer that without reading up on that particular NAND ECC engine.
Recall however that the NAND framework will think in terms of 2KB reads, with OOB data on the side. There will be separate reads for 2K and then 64 bytes.
Quoted 5 lines
And enable
HW_ECCbefore read/write and then call for ecc.calculate or
ecc.correct accordingly. Rest all things can be taken care by
underlying controller driver.
I donot think when Hw_ecc is enable some software ECC calculation is required.
Quoted 7 lines
Those sentences seem to elide critical parts of the process.
Like the details of OOB and ECC handling, which seem to be what you're not sure of...
Thanks
Amit
Quoted 4 lines
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 15 lines · Amit Kumar Sharma
Hi Vimal,
Quoted 13 lines · vimal singh
Quoted 5 lines
The problem is that HW ECC engine in BCH mode dose not provide any
possible configuration where we can keep ECC bytes in main area
itself. OOB + ECC data has to be in only spare area.Healthy. I disike that "infix OOB" myself. It is however a standard ECC mode in the NAND framework. :(
So you're asking about how to map hardware-specific details
to the NAND framework? That wasn't clear.
Yes, that's right.
Quoted 14 lines
I think better you use some of the bytes of OOB area , In almoost al NAND you can read 2K page size or 4K page size additinal you have to read OOB or spare area of NAND.
Quoted 11 lines
Quoted 4 lines
Would it not be the good idea to perform read/write for full (2112 bytes) page?
I'm not sure I can answer that without reading up on that particular NAND ECC engine.
Recall however that the NAND framework will think in terms of 2KB reads, with OOB data on the side. There will be separate reads for 2K and then 64 bytes.
The question is, how to involve 'main area bytes + OOB bytes (+ ECC bytes, in case of reads)', while writing / reading a page to/from nand device.
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
And enable
HW_ECCbefore read/write and then call for ecc.calculate or
ecc.correct accordingly. Rest all things can be taken care by
underlying controller driver.I donot think when
Hw_eccis enable some software ECC calculation is required.
You may need SW algo to correct the errors indicated by HW generated ECCs.
Quoted 5 lines
Quoted 5 lines
Those sentences seem to elide critical parts of the process.
Like the details of OOB and ECC handling, which seem to be what you're not sure of...
OOB area details are part of filesystem used in question. But we certainly have control over defining layout for OOB area, which then can be used by any upper layer SW component.
Quoted 12 lines
Quoted 2 lines
Thanks
AmitQuoted 4 lines
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Signature · 7 lines
--- Regards, \/ | |\/| /-\ |_ ____ __o ------ -\<, ----- ( )/ ( )