1 --- a/drivers/mtd/nand/nand_base.c
2 +++ b/drivers/mtd/nand/nand_base.c
3 @@ -1908,6 +1908,9 @@ static int nand_do_read_ops(struct mtd_i
7 +#ifdef CONFIG_MTK_MTD_NAND
8 + ret = chip->read_page(mtd, chip, bufpoi, page);
10 if (nand_standard_page_accessors(&chip->ecc))
11 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
13 @@ -1927,6 +1930,7 @@ read_retry:
15 ret = chip->ecc.read_page(mtd, chip, bufpoi,
20 /* Invalidate page cache */
21 @@ -2761,9 +2765,14 @@ static int nand_do_write_ops(struct mtd_
22 memset(chip->oob_poi, 0xff, mtd->oobsize);
25 - ret = nand_write_page(mtd, chip, column, bytes, wbuf,
27 - (ops->mode == MTD_OPS_RAW));
28 + if (chip->write_page)
29 + ret = chip->write_page(mtd, chip, column, bytes, wbuf,
31 + (ops->mode == MTD_OPS_RAW));
33 + ret = nand_write_page(mtd, chip, column, bytes, wbuf,
35 + (ops->mode == MTD_OPS_RAW));
39 --- a/include/linux/mtd/rawnand.h
40 +++ b/include/linux/mtd/rawnand.h
41 @@ -885,6 +885,9 @@ struct nand_chip {
42 int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
43 int (*erase)(struct mtd_info *mtd, int page);
44 int (*scan_bbt)(struct mtd_info *mtd);
45 + int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
46 + uint32_t offset, int data_len, const uint8_t *buf,
47 + int oob_required, int page, int raw);
48 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
49 int feature_addr, uint8_t *subfeature_para);
50 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
51 @@ -893,6 +896,9 @@ struct nand_chip {
52 int (*setup_data_interface)(struct mtd_info *mtd, int chipnr,
53 const struct nand_data_interface *conf);
55 +#ifdef CONFIG_MTK_MTD_NAND
56 + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, u8 *buf, int page);
57 +#endif /* CONFIG_MTK_MTD_NAND */