aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-4.4/0059-mtd-nand-backport-fixes.patch
blob: d5f7a40f95da892f51ff032550982aa4fdcde8c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From bb79410956e03e7c775c38338c5826f8591378a9 Mon Sep 17 00:00:00 2001
From: John Crispin <blogic@openwrt.org>
Date: Thu, 31 Mar 2016 02:28:08 +0200
Subject: [PATCH 59/91] mtd: nand: backport fixes

---
 drivers/mtd/nand/mtksdg1_nand.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/mtksdg1_nand.c b/drivers/mtd/nand/mtksdg1_nand.c
index 55dd17d..f92b949 100644
--- a/drivers/mtd/nand/mtksdg1_nand.c
+++ b/drivers/mtd/nand/mtksdg1_nand.c
@@ -107,6 +107,9 @@ static struct nand_ecclayout nand_4k_128 = {
 	.oobfree = { {0, 32} },
 };
 
+static const char * const part_probes[] = {
+	"cmdlinepart", "RedBoot", "ofpart", NULL };
+
 /* NFI register access */
 static inline void mtk_nfi_writel(struct mtk_nfc_host *host, u32 val, u32 reg)
 {
@@ -1298,6 +1301,7 @@ static int mtk_nfc_probe(struct platform_device *pdev)
 
 	chip = &host->chip;
 	mtd = nand_to_mtd(chip);
+	mtd->priv = chip;
 	host->dev = dev;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1428,7 +1432,10 @@ static int mtk_nfc_probe(struct platform_device *pdev)
 	}
 	host->switch_oob = false;
 
-	ret = mtd_device_parse_register(mtd, NULL, NULL, NULL, 0);
+	ret = mtd_device_parse_register(mtd, part_probes,
+			&(struct mtd_part_parser_data) {
+				.of_node = pdev->dev.of_node,
+			}, NULL, 0);
 	if (ret) {
 		dev_err(dev, "mtd parse partition error\n");
 		goto nand_free;
-- 
1.7.10.4