diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2020-05-14 18:19:35 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2020-05-18 18:24:06 +0200 |
commit | 86583384ff4ce144c17997bd462ee0835e28310b (patch) | |
tree | a6af580ac8ccd1162bd41687de5e3c670527a1d6 /target/linux/bcm63xx/patches-5.4/437-mtd-rawnand-brcmnand-improve-hamming-oob-layout.patch | |
parent | dcee4eaa4214dce19800ea04da0dd92ebf7af29a (diff) | |
download | upstream-86583384ff4ce144c17997bd462ee0835e28310b.tar.gz upstream-86583384ff4ce144c17997bd462ee0835e28310b.tar.bz2 upstream-86583384ff4ce144c17997bd462ee0835e28310b.zip |
bcm63xx: smp: add NAND support
NAND controller is present on BCM6328, BCM6362, BCM6368 and BCM63268.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm63xx/patches-5.4/437-mtd-rawnand-brcmnand-improve-hamming-oob-layout.patch')
-rw-r--r-- | target/linux/bcm63xx/patches-5.4/437-mtd-rawnand-brcmnand-improve-hamming-oob-layout.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/target/linux/bcm63xx/patches-5.4/437-mtd-rawnand-brcmnand-improve-hamming-oob-layout.patch b/target/linux/bcm63xx/patches-5.4/437-mtd-rawnand-brcmnand-improve-hamming-oob-layout.patch new file mode 100644 index 0000000000..68bbc7ad19 --- /dev/null +++ b/target/linux/bcm63xx/patches-5.4/437-mtd-rawnand-brcmnand-improve-hamming-oob-layout.patch @@ -0,0 +1,52 @@ +--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c ++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c +@@ -1003,33 +1003,30 @@ static int brcmnand_hamming_ooblayout_fr + struct brcmnand_cfg *cfg = &host->hwcfg; + int sas = cfg->spare_area_size << cfg->sector_size_1k; + int sectors = cfg->page_size / (512 << cfg->sector_size_1k); ++ u32 next; + +- if (section >= sectors * 2) ++ if (section > sectors) + return -ERANGE; + +- oobregion->offset = (section / 2) * sas; ++ next = (section * sas); ++ if (section < sectors) ++ next += 6; + +- if (section & 1) { +- oobregion->offset += 9; +- oobregion->length = 7; ++ if (section) { ++ oobregion->offset = ((section - 1) * sas) + 9; + } else { +- oobregion->length = 6; +- +- /* First sector of each page may have BBI */ +- if (!section) { +- /* +- * Small-page NAND use byte 6 for BBI while large-page +- * NAND use bytes 0 and 1. +- */ +- if (cfg->page_size > 512) { +- oobregion->offset += 2; +- oobregion->length -= 2; +- } else { +- oobregion->length--; +- } ++ if (cfg->page_size > 512) { ++ /* Large page NAND uses first 2 bytes for BBI */ ++ oobregion->offset = 2; ++ } else { ++ /* Small page NAND uses last byte before ECC for BBI */ ++ oobregion->offset = 0; ++ next--; + } + } + ++ oobregion->length = next - oobregion->offset; ++ + return 0; + } + |