2018-01-16 22:07:58 +00:00
|
|
|
--- a/drivers/mtd/nand/nand_base.c
|
|
|
|
+++ b/drivers/mtd/nand/nand_base.c
|
2018-03-22 17:34:08 +00:00
|
|
|
@@ -1908,6 +1908,9 @@ static int nand_do_read_ops(struct mtd_i
|
2018-01-16 22:07:58 +00:00
|
|
|
__func__, buf);
|
|
|
|
|
|
|
|
read_retry:
|
|
|
|
+#ifdef CONFIG_MTK_MTD_NAND
|
|
|
|
+ ret = chip->read_page(mtd, chip, bufpoi, page);
|
|
|
|
+#else
|
|
|
|
if (nand_standard_page_accessors(&chip->ecc))
|
|
|
|
chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
|
|
|
|
|
2018-03-22 17:34:08 +00:00
|
|
|
@@ -1927,6 +1930,7 @@ read_retry:
|
2018-01-16 22:07:58 +00:00
|
|
|
else
|
|
|
|
ret = chip->ecc.read_page(mtd, chip, bufpoi,
|
|
|
|
oob_required, page);
|
|
|
|
+#endif
|
|
|
|
if (ret < 0) {
|
|
|
|
if (use_bufpoi)
|
|
|
|
/* Invalidate page cache */
|
2018-05-08 15:44:23 +00:00
|
|
|
@@ -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;
|
2018-01-16 22:07:58 +00:00
|
|
|
|
|
|
|
--- a/include/linux/mtd/rawnand.h
|
|
|
|
+++ b/include/linux/mtd/rawnand.h
|
2018-05-08 15:44:23 +00:00
|
|
|
@@ -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 {
|
2018-01-16 22:07:58 +00:00
|
|
|
int (*setup_data_interface)(struct mtd_info *mtd, int chipnr,
|
|
|
|
const struct nand_data_interface *conf);
|
|
|
|
|
|
|
|
+#ifdef CONFIG_MTK_MTD_NAND
|
|
|
|
+ int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, u8 *buf, int page);
|
|
|
|
+#endif /* CONFIG_MTK_MTD_NAND */
|
|
|
|
|
|
|
|
int chip_delay;
|
|
|
|
unsigned int options;
|