[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200504093034.2739968-2-noltari@gmail.com>
Date: Mon, 4 May 2020 11:30:34 +0200
From: Álvaro Fernández Rojas
<noltari@...il.com>
To: computersforpeace@...il.com, kdasu.kdev@...il.com,
miquel.raynal@...tlin.com, richard@....at, vigneshr@...com,
sumit.semwal@...aro.org, linux-mtd@...ts.infradead.org,
bcm-kernel-feedback-list@...adcom.com,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org
Cc: Álvaro Fernández Rojas
<noltari@...il.com>
Subject: [PATCH 2/2] nand: brcmnand: fix BBI in hamming oob layout
Small Page NAND uses byte 6 for BBI and Large Page NAND uses first 2 bytes.
Signed-off-by: Álvaro Fernández Rojas <noltari@...il.com>
---
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 1bba309c7684..59c3241f4ea5 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -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;
--
2.26.2
Powered by blists - more mailing lists