[PATCH 02/14] mtd: rawnand: brcmnand: Fix BCH ECC layout for large page NAND parts

Linus Walleij linus.walleij at linaro.org
Sun Jan 15 20:53:00 CET 2023


From: Kamal Dasu <kdasu.kdev at gmail.com>

The way oobregion->offset is derived for large page NAND parts is
wrong, fixes it.

Fixes: ef5eeea6e911 ("mtd: nand: brcm: switch to mtd_ooblayout_ops")
Signed-off-by: Kamal Dasu <kdasu.kdev at gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli at gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 8ea33e861354..65aab4be87b9 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -968,7 +968,7 @@ static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section,
 	if (section >= sectors)
 		return -ERANGE;
 
-	oobregion->offset = (section * (sas + 1)) - chip->ecc.bytes;
+	oobregion->offset = ((section + 1) * sas) - chip->ecc.bytes;
 	oobregion->length = chip->ecc.bytes;
 
 	return 0;
-- 
2.39.0



More information about the U-Boot mailing list