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