ramips: fix the number of uarts for MT7688
[librecmc/librecmc.git] / target / linux / mediatek / patches-4.4 / 0076-mtd-nand-add-power-domains-to-the-mediatek-driver.patch
1 From 5dc0d474396e04e6c140d71f0e113eb1c03501c5 Mon Sep 17 00:00:00 2001
2 From: John Crispin <john@phrozen.org>
3 Date: Tue, 17 May 2016 05:44:10 +0200
4 Subject: [PATCH 076/102] mtd: nand: add power domains to the mediatek driver
5
6 Signed-off-by: John Crispin <john@phrozen.org>
7 ---
8  drivers/mtd/nand/mtk_nand.c |   13 ++++++++++++-
9  1 file changed, 12 insertions(+), 1 deletion(-)
10
11 --- a/drivers/mtd/nand/mtk_nand.c
12 +++ b/drivers/mtd/nand/mtk_nand.c
13 @@ -16,6 +16,7 @@
14  
15  #include <linux/platform_device.h>
16  #include <linux/dma-mapping.h>
17 +#include <linux/pm_runtime.h>
18  #include <linux/interrupt.h>
19  #include <linux/delay.h>
20  #include <linux/clk.h>
21 @@ -102,6 +103,7 @@
22  #define NFI_MASTER_STA         (0x224)
23  #define                MASTER_STA_MASK         (0x0FFF)
24  #define NFI_EMPTY_THRESH       (0x23C)
25 +#define NFI_ACCCON1            (0x244)
26  
27  #define MTK_NAME               "mtk-nand"
28  #define KB(x)                  ((x) * 1024UL)
29 @@ -539,6 +541,8 @@ static void mtk_nfc_bad_mark_swap(struct
30         struct mtk_nfc_nand_chip *nand = to_mtk_nand(chip);
31         u32 bad_pos = nand->bad_mark.pos;
32  
33 +       return;
34 +
35         if (raw)
36                 bad_pos += nand->bad_mark.sec * mtk_data_len(chip);
37         else
38 @@ -946,7 +950,8 @@ static int mtk_nfc_read_oob_std(struct m
39  
40  static inline void mtk_nfc_hw_init(struct mtk_nfc *nfc)
41  {
42 -       nfi_writel(nfc, 0x10804211, NFI_ACCCON);
43 +       nfi_writel(nfc, 0x30c77fff, NFI_ACCCON);
44 +       nfi_writel(nfc, 0xC03222, NFI_ACCCON1);
45         nfi_writew(nfc, 0xf1, NFI_CNRNB);
46         nfi_writew(nfc, PAGEFMT_8K_16K, NFI_PAGEFMT);
47  
48 @@ -1328,6 +1333,9 @@ static int mtk_nfc_probe(struct platform
49                 goto clk_disable;
50         }
51  
52 +       pm_runtime_enable(dev);
53 +       pm_runtime_get_sync(dev);
54 +
55         platform_set_drvdata(pdev, nfc);
56  
57         ret = mtk_nfc_nand_chips_init(dev, nfc);
58 @@ -1362,6 +1370,9 @@ static int mtk_nfc_remove(struct platfor
59         mtk_ecc_release(nfc->ecc);
60         mtk_nfc_disable_clk(&nfc->clk);
61  
62 +       pm_runtime_put_sync(&pdev->dev);
63 +       pm_runtime_disable(&pdev->dev);
64 +
65         return 0;
66  }
67