aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq40xx/patches-4.14/030-mtd-nand-Use-standard-large-page-OOB-layout-when-usi.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2018-02-21 20:40:50 +0100
committerMathias Kresin <dev@kresin.me>2018-03-14 19:04:50 +0100
commit54b275c8ed3ad20c447fd46deec83384822ac79d (patch)
tree4198c9f77e467b316940cb78297d3030e67d67ea /target/linux/ipq40xx/patches-4.14/030-mtd-nand-Use-standard-large-page-OOB-layout-when-usi.patch
parentb7f115f22a9d79bd45bfe27cfb8d491dac49feb4 (diff)
downloadupstream-54b275c8ed3ad20c447fd46deec83384822ac79d.tar.gz
upstream-54b275c8ed3ad20c447fd46deec83384822ac79d.tar.bz2
upstream-54b275c8ed3ad20c447fd46deec83384822ac79d.zip
ipq40xx: add target
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> Signed-off-by: Mathias Kresin <dev@kresin.me> Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux/ipq40xx/patches-4.14/030-mtd-nand-Use-standard-large-page-OOB-layout-when-usi.patch')
-rw-r--r--target/linux/ipq40xx/patches-4.14/030-mtd-nand-Use-standard-large-page-OOB-layout-when-usi.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/target/linux/ipq40xx/patches-4.14/030-mtd-nand-Use-standard-large-page-OOB-layout-when-usi.patch b/target/linux/ipq40xx/patches-4.14/030-mtd-nand-Use-standard-large-page-OOB-layout-when-usi.patch
new file mode 100644
index 0000000000..479a890bb4
--- /dev/null
+++ b/target/linux/ipq40xx/patches-4.14/030-mtd-nand-Use-standard-large-page-OOB-layout-when-usi.patch
@@ -0,0 +1,47 @@
+From 882fd1577cbe7812ae3a48988180c5f0fda475ca Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@free-electrons.com>
+Date: Sat, 26 Aug 2017 17:19:15 +0200
+Subject: [PATCH] mtd: nand: Use standard large page OOB layout when using
+ NAND_ECC_NONE
+
+Use the core's large page OOB layout functions when not reserving any
+space for ECC bytes in the OOB layout. Fix ->nand_ooblayout_ecc_lp()
+to return -ERANGE instead of a zero length in this case.
+
+Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
+Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
+---
+ drivers/mtd/nand/nand_base.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/nand_base.c
++++ b/drivers/mtd/nand/nand_base.c
+@@ -115,7 +115,7 @@ static int nand_ooblayout_ecc_lp(struct
+ struct nand_chip *chip = mtd_to_nand(mtd);
+ struct nand_ecc_ctrl *ecc = &chip->ecc;
+
+- if (section)
++ if (section || !ecc->total)
+ return -ERANGE;
+
+ oobregion->length = ecc->total;
+@@ -4707,6 +4707,19 @@ int nand_scan_tail(struct mtd_info *mtd)
+ mtd_set_ooblayout(mtd, &nand_ooblayout_lp_hamming_ops);
+ break;
+ default:
++ /*
++ * Expose the whole OOB area to users if ECC_NONE
++ * is passed. We could do that for all kind of
++ * ->oobsize, but we must keep the old large/small
++ * page with ECC layout when ->oobsize <= 128 for
++ * compatibility reasons.
++ */
++ if (ecc->mode == NAND_ECC_NONE) {
++ mtd_set_ooblayout(mtd,
++ &nand_ooblayout_lp_ops);
++ break;
++ }
++
+ WARN(1, "No oob scheme defined for oobsize %d\n",
+ mtd->oobsize);
+ ret = -EINVAL;