5bc00b16b5bfcdd21a668cd340a6fcc801d3db67
[openwrt/openwrt.git] / target / linux / ramips / patches-4.9 / 0040-nand-hack.patch
1 --- a/drivers/mtd/nand/nand_base.c
2 +++ b/drivers/mtd/nand/nand_base.c
3 @@ -2022,6 +2022,9 @@ static int nand_do_read_ops(struct mtd_i
4 __func__, buf);
5
6 read_retry:
7 +#ifdef CONFIG_MTK_MTD_NAND
8 + ret = chip->read_page(mtd, chip, bufpoi, page);
9 +#else
10 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
11
12 /*
13 @@ -2040,6 +2043,7 @@ read_retry:
14 else
15 ret = chip->ecc.read_page(mtd, chip, bufpoi,
16 oob_required, page);
17 +#endif
18 if (ret < 0) {
19 if (use_bufpoi)
20 /* Invalidate page cache */
21 @@ -3209,8 +3213,11 @@ int nand_erase_nand(struct mtd_info *mtd
22 (page + pages_per_block))
23 chip->pagebuf = -1;
24
25 +#ifdef CONFIG_MTK_MTD_NAND
26 + status = chip->erase_mtk(mtd, page & chip->pagemask);
27 +#else
28 status = chip->erase(mtd, page & chip->pagemask);
29 -
30 +#endif
31 /*
32 * See if operation failed and additional status checks are
33 * available
34 @@ -4404,6 +4411,7 @@ int nand_scan_ident(struct mtd_info *mtd
35 * cmdfunc() both expect cmd_ctrl() to be populated,
36 * so we need to check that that's the case
37 */
38 + printk("%s:%s[%d]%p %p %p\n", __FILE__, __func__, __LINE__, chip->cmdfunc, chip->select_chip, chip->cmd_ctrl);
39 pr_err("chip.cmd_ctrl() callback is not provided");
40 return -EINVAL;
41 }
42 --- a/drivers/mtd/nand/nand_device_list.h
43 +++ b/drivers/mtd/nand/nand_device_list.h
44 @@ -44,6 +44,8 @@ static const flashdev_info gen_FlashTabl
45 {0xADBC, 0x905554, 5, 16, 512, 128, 2048, 64, 0x10801011, "H9DA4GH4JJAMC", 0},
46 {0x01F1, 0x801D01, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "S34ML01G100TF", 0},
47 {0x92F1, 0x8095FF, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "F59L1G81A", 0},
48 + {0xC8DA, 0x909544, 5, 8, 256, 128, 2048, 64, 0x30C77fff, "F59L2G81A", 0},
49 + {0xC8DC, 0x909554, 5, 8, 512, 128, 2048, 64, 0x30C77fff, "F59L4G81A", 0},
50 {0xECD3, 0x519558, 5, 8, 1024, 128, 2048, 64, 0x44333, "K9K8G8000", 0},
51 {0xC2F1, 0x801DC2, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "MX30LF1G08AA", 0},
52 {0x98D3, 0x902676, 5, 8, 1024, 256, 4096, 224, 0x00C25332, "TC58NVG3S0F", 0},
53 --- a/include/linux/mtd/nand.h
54 +++ b/include/linux/mtd/nand.h
55 @@ -825,6 +825,10 @@ struct nand_chip {
56 const struct nand_data_interface *conf,
57 bool check_only);
58
59 +#ifdef CONFIG_MTK_MTD_NAND
60 + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, u8 *buf, int page);
61 + int (*erase_mtk)(struct mtd_info *mtd, int page);
62 +#endif /* CONFIG_MTK_MTD_NAND */
63
64 int chip_delay;
65 unsigned int options;