aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2018-11-09 13:30:51 +0100
committerRafał Miłecki <rafal@milecki.pl>2018-11-09 13:31:47 +0100
commit9a3c805584b6adf3fa4f0db5c127a056b0c6d667 (patch)
tree3d2b30b9baf9ea1044daa8b00f5e26a7beca7cb1 /target
parentdbba87aa6a03f7a85e9acc910df26364235220a9 (diff)
downloadupstream-9a3c805584b6adf3fa4f0db5c127a056b0c6d667.tar.gz
upstream-9a3c805584b6adf3fa4f0db5c127a056b0c6d667.tar.bz2
upstream-9a3c805584b6adf3fa4f0db5c127a056b0c6d667.zip
ramips: use separated mtd patch reverting write_page() removal
This helps understanding mtd changes needed to get downstream NAND driver working. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch67
-rw-r--r--target/linux/ramips/patches-4.14/0040-nand-hack.patch30
2 files changed, 68 insertions, 29 deletions
diff --git a/target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch b/target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch
new file mode 100644
index 0000000000..4758f18558
--- /dev/null
+++ b/target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch
@@ -0,0 +1,67 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Subject: [PATCH] Revert "mtd: nand: Remove unused chip->write_page() hook"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This reverts commit f107d7a43923a83d837b3ea3c7b7de58cd014bbd.
+
+OpenWrt's downstream driver mtk_nand2 still uses that callback.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+
+--- a/drivers/mtd/nand/nand_base.c
++++ b/drivers/mtd/nand/nand_base.c
+@@ -2577,7 +2577,7 @@ static int nand_write_page_syndrome(stru
+ }
+
+ /**
+- * nand_write_page - write one page
++ * nand_write_page - [REPLACEABLE] write one page
+ * @mtd: MTD device structure
+ * @chip: NAND chip descriptor
+ * @offset: address offset within the page
+@@ -2761,9 +2761,9 @@ static int nand_do_write_ops(struct mtd_
+ memset(chip->oob_poi, 0xff, mtd->oobsize);
+ }
+
+- ret = nand_write_page(mtd, chip, column, bytes, wbuf,
+- oob_required, page,
+- (ops->mode == MTD_OPS_RAW));
++ ret = chip->write_page(mtd, chip, column, bytes, wbuf,
++ oob_required, page,
++ (ops->mode == MTD_OPS_RAW));
+ if (ret)
+ break;
+
+@@ -4719,6 +4719,9 @@ int nand_scan_tail(struct mtd_info *mtd)
+ }
+ }
+
++ if (!chip->write_page)
++ chip->write_page = nand_write_page;
++
+ /*
+ * Check ECC mode, default to software if 3byte/512byte hardware ECC is
+ * selected and we have 256 byte pagesize fallback to software ECC
+--- a/include/linux/mtd/rawnand.h
++++ b/include/linux/mtd/rawnand.h
+@@ -862,6 +862,7 @@ struct nand_manufacturer_ops {
+ * structure which is shared among multiple independent
+ * devices.
+ * @priv: [OPTIONAL] pointer to private chip data
++ * @write_page: [REPLACEABLE] High-level page write function
+ * @manufacturer: [INTERN] Contains manufacturer information
+ */
+
+@@ -885,6 +886,9 @@ struct nand_chip {
+ int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
+ int (*erase)(struct mtd_info *mtd, int page);
+ int (*scan_bbt)(struct mtd_info *mtd);
++ int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
++ uint32_t offset, int data_len, const uint8_t *buf,
++ int oob_required, int page, int raw);
+ int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
+ int feature_addr, uint8_t *subfeature_para);
+ int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
diff --git a/target/linux/ramips/patches-4.14/0040-nand-hack.patch b/target/linux/ramips/patches-4.14/0040-nand-hack.patch
index c906d7fa6a..58cdf1bce7 100644
--- a/target/linux/ramips/patches-4.14/0040-nand-hack.patch
+++ b/target/linux/ramips/patches-4.14/0040-nand-hack.patch
@@ -18,37 +18,9 @@
if (ret < 0) {
if (use_bufpoi)
/* Invalidate page cache */
-@@ -2761,9 +2765,14 @@ static int nand_do_write_ops(struct mtd_
- memset(chip->oob_poi, 0xff, mtd->oobsize);
- }
-
-- ret = nand_write_page(mtd, chip, column, bytes, wbuf,
-- oob_required, page,
-- (ops->mode == MTD_OPS_RAW));
-+ if (chip->write_page)
-+ ret = chip->write_page(mtd, chip, column, bytes, wbuf,
-+ oob_required, page,
-+ (ops->mode == MTD_OPS_RAW));
-+ else
-+ ret = nand_write_page(mtd, chip, column, bytes, wbuf,
-+ oob_required, page,
-+ (ops->mode == MTD_OPS_RAW));
- if (ret)
- break;
-
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
-@@ -885,6 +885,9 @@ struct nand_chip {
- int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
- int (*erase)(struct mtd_info *mtd, int page);
- int (*scan_bbt)(struct mtd_info *mtd);
-+ int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint32_t offset, int data_len, const uint8_t *buf,
-+ int oob_required, int page, int raw);
- int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
- int feature_addr, uint8_t *subfeature_para);
- int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
-@@ -893,6 +896,9 @@ struct nand_chip {
+@@ -897,6 +897,9 @@ struct nand_chip {
int (*setup_data_interface)(struct mtd_info *mtd, int chipnr,
const struct nand_data_interface *conf);