ramips: fixup nand support on v4.9

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin 2017-06-01 12:19:57 +02:00
parent 21f25bc4a3
commit 9bc9457b85
3 changed files with 4576 additions and 1 deletions

View file

@ -170,7 +170,6 @@ CONFIG_MTD_M25P80=y
CONFIG_MTD_NAND=y CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP=y
# CONFIG_MTD_PHYSMAP_OF_VERSATILE is not set
CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIRMWARE=y
CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y
@ -182,6 +181,7 @@ CONFIG_MTD_UBI_BLOCK=y
# CONFIG_MTD_UBI_FASTMAP is not set # CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set # CONFIG_MTD_UBI_GLUEBI is not set
CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTK_MTD_NAND=y
CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_FLOW_LIMIT=y
CONFIG_NET_MEDIATEK_GSW_MT7621=y CONFIG_NET_MEDIATEK_GSW_MT7621=y

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
Index: linux-4.9.30/drivers/mtd/nand/nand_base.c
===================================================================
--- linux-4.9.30.orig/drivers/mtd/nand/nand_base.c
+++ linux-4.9.30/drivers/mtd/nand/nand_base.c
@@ -2014,6 +2014,9 @@ static int nand_do_read_ops(struct mtd_i
__func__, buf);
read_retry:
+#ifdef CONFIG_MTK_MTD_NAND
+ ret = chip->read_page(mtd, chip, bufpoi, page);
+#else
chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
/*
@@ -2032,6 +2035,7 @@ read_retry:
else
ret = chip->ecc.read_page(mtd, chip, bufpoi,
oob_required, page);
+#endif
if (ret < 0) {
if (use_bufpoi)
/* Invalidate page cache */
@@ -3195,8 +3199,11 @@ int nand_erase_nand(struct mtd_info *mtd
(page + pages_per_block))
chip->pagebuf = -1;
+#ifdef CONFIG_MTK_MTD_NAND
+ status = chip->erase_mtk(mtd, page & chip->pagemask);
+#else
status = chip->erase(mtd, page & chip->pagemask);
-
+#endif
/*
* See if operation failed and additional status checks are
* available
@@ -4404,6 +4411,7 @@ int nand_scan_ident(struct mtd_info *mtd
* cmdfunc() both expect cmd_ctrl() to be populated,
* so we need to check that that's the case
*/
+ printk("%s:%s[%d]%p %p %p\n", __FILE__, __func__, __LINE__, chip->cmdfunc, chip->select_chip, chip->cmd_ctrl);
pr_err("chip.cmd_ctrl() callback is not provided");
return -EINVAL;
}
Index: linux-4.9.30/drivers/mtd/nand/nand_device_list.h
===================================================================
--- linux-4.9.30.orig/drivers/mtd/nand/nand_device_list.h
+++ linux-4.9.30/drivers/mtd/nand/nand_device_list.h
@@ -43,6 +43,8 @@ static const flashdev_info gen_FlashTabl
{0xADBC, 0x905554, 5, 16, 512, 128, 2048, 64, 0x10801011, "H9DA4GH4JJAMC", 0},
{0x01F1, 0x801D01, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "S34ML01G100TF", 0},
{0x92F1, 0x8095FF, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "F59L1G81A", 0},
+ {0xC8DA, 0x909544, 5, 8, 256, 128, 2048, 64, 0x30C77fff, "F59L2G81A", 0},
+ {0xC8DC, 0x909554, 5, 8, 512, 128, 2048, 64, 0x30C77fff, "F59L4G81A", 0},
{0xECD3, 0x519558, 5, 8, 1024, 128, 2048, 64, 0x44333, "K9K8G8000", 0},
{0xC2F1, 0x801DC2, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "MX30LF1G08AA", 0},
{0x98D3, 0x902676, 5, 8, 1024, 256, 4096, 224, 0x00C25332, "TC58NVG3S0F", 0},
Index: linux-4.9.30/include/linux/mtd/nand.h
===================================================================
--- linux-4.9.30.orig/include/linux/mtd/nand.h
+++ linux-4.9.30/include/linux/mtd/nand.h
@@ -825,6 +825,10 @@ struct nand_chip {
const struct nand_data_interface *conf,
bool check_only);
+#ifdef CONFIG_MTK_MTD_NAND
+ int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, u8 *buf, int page);
+ int (*erase_mtk)(struct mtd_info *mtd, int page);
+#endif /* CONFIG_MTK_MTD_NAND */
int chip_delay;
unsigned int options;