[PATCH 2/2] nand: brcmnand: fix BBI in hamming oob layout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Small Page NAND uses byte 6 for BBI and Large Page NAND uses first 2 bytes.

Signed-off-by: Álvaro Fernández Rojas <noltari@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux