nand: Proper definition of "extra" OOB regions? (4x interleaved, then one bulk user)
lede at allycomm.com
Thu Jun 13 12:32:53 PDT 2019
I've been trying to track down the proper way to express the Paragon
SPI NAND's OOB "user" data segments, but am not clear how upper
layers interpret the combination of `mtd_ooblayout_ops.free` and the
overall OOB size, typically set through the `NAND_MEMORG` macro.
Rather than churn Patchwork and those that donate their time and
energy follow, review, and manage patches, would it be possible to
confirm that the last 64 bytes of this chip's user OOB, which
is not contiguous with any other user areas, should (or should not)
be defined in `.free` as a fifth section?
In the case of the Paragon chips, there is a total of 128 bytes of OOB,
split into a 4-byte BBM reservation, four repeats of 15-byte sections
with "factory" and "user" areas interleaved, then the remaining 64 bytes
available as a user area, not contiguous with other user areas.
0x800 -- 4 bytes BBM
0x804 -- 2 bytes user
0x806 -- 13 bytes factory ECC
0x813 -- 2 bytes user
0x815 -- 13 bytes factory ECC
0x822 -- 2 bytes user
0x824 -- 13 bytes factory ECC
0x831 -- 2 bytes user
0x833 -- 13 bytes factory ECC
0x840 -- 64 bytes user <== this is the subject of the question
Clearly, the 4 regions of interleaved OOB data needs to be described
in both `.ecc` and `.free`. What isn't completely clear to me is the
remaining 64-byte area.
Is that the OOB area is defined as 128 bytes and that only 64 bytes
have been reserved sufficient, or should those 64 bytes, which
are not contiguous with any of the other "user" segments be a fifth
section in defining `.free`?
That the driver "works" without defining a fifth region in a specific,
UBI-based application doesn't assure me that it will work properly
in all applications with all upper-layer consumers.
Examining supported chips with similar OOB layouts with multiple
sections then an "additional" area, such as the GigaDevice GD5FxGQ4xA,
was not terribly insightful. The GD5F1GQ4UAY datasheet marks the
upper 64-byte region as "reserved", in contrast to "User meta data"
and it is not described in the current `gigadevice.c`. As such,
it isn't convincing evidence that it was omitted as "not required",
because it was marked "reserved", or perhaps for some other reason.
As a side note, the datasheet also marks the first byte of each region
as "reserved", which is not reflected in the current `gigadevice.c`,
which includes it in the free region for sections 1-3.
More information about the linux-mtd