@@ -1109,10 +1109,18 @@ static int brcmnand_hamming_ooblayout_free(struct mtd_info *mtd, int section,
if (section < sectors)
next += 6;
- if (section)
+ if (section) {
oobregion->offset = ((section - 1) * sas) + 9;
- else
- oobregion->offset = 1; /* BBI */
+ } else {
+ if (cfg->page_size == 512) {
+ /* small page uses byte 6 for BBI */
+ oobregion->offset = 0;
+ next--;
+ } else {
+ /* large page uses first 2 bytes for BBI */
+ oobregion->offset = 2;
+ }
+ }
oobregion->length = next - oobregion->offset;
Small Page NAND uses byte 6 for BBI and Large Page NAND uses first 2 bytes. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)