d27209292a170e9f6b6debfcefae5ca3f2b849f3
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.14 / 0162-mtd-nand-mtk-use-nand_reset-to-reset-NAND-devices-in.patch
1 From fb607c7c1eaeb47ec2ffed99cab571892cb6af7d Mon Sep 17 00:00:00 2001
2 From: Xiaolei Li <xiaolei.li@mediatek.com>
3 Date: Thu, 2 Nov 2017 10:05:07 +0800
4 Subject: [PATCH 162/224] mtd: nand: mtk: use nand_reset() to reset NAND
5 devices in resume function
6
7 Previously, we only select chips and then send reset command to a NAND
8 device during resuming nand driver. There is a lack of deselecting chips.
9 It is advised to reset and initialize a NAND device using nand_reset().
10
11 Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
12 Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
13 Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
14 ---
15 drivers/mtd/nand/mtk_nand.c | 8 ++------
16 1 file changed, 2 insertions(+), 6 deletions(-)
17
18 --- a/drivers/mtd/nand/mtk_nand.c
19 +++ b/drivers/mtd/nand/mtk_nand.c
20 @@ -1540,7 +1540,6 @@ static int mtk_nfc_resume(struct device
21 struct mtk_nfc *nfc = dev_get_drvdata(dev);
22 struct mtk_nfc_nand_chip *chip;
23 struct nand_chip *nand;
24 - struct mtd_info *mtd;
25 int ret;
26 u32 i;
27
28 @@ -1553,11 +1552,8 @@ static int mtk_nfc_resume(struct device
29 /* reset NAND chip if VCC was powered off */
30 list_for_each_entry(chip, &nfc->chips, node) {
31 nand = &chip->nand;
32 - mtd = nand_to_mtd(nand);
33 - for (i = 0; i < chip->nsels; i++) {
34 - nand->select_chip(mtd, i);
35 - nand->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
36 - }
37 + for (i = 0; i < chip->nsels; i++)
38 + nand_reset(nand, i);
39 }
40
41 return 0;