kernel: update kernel 4.4 to version 4.4.7
[openwrt.git] / target / linux / mediatek / patches-4.4 / 0029-soc-mediatek-PMIC-wrap-clear-the-STAUPD_TRIG-bit-of-.patch
1 From 7e0c3f4f4c7a55eda670c97b1b3b793ceecc1655 Mon Sep 17 00:00:00 2001
2 From: Henry Chen <henryc.chen@mediatek.com>
3 Date: Thu, 21 Jan 2016 19:04:00 +0800
4 Subject: [PATCH 29/81] soc: mediatek: PMIC wrap: clear the STAUPD_TRIG bit of
5  WDT_SRC_EN
6
7 Since STAUPD interrupts aren't handled on mt8173, disable watchdog timeout
8 monitor of STAUPD to avoid WDT_INT triggered by STAUPD.
9
10 Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
11 Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
12 Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
13 ---
14  drivers/soc/mediatek/mtk-pmic-wrap.c |   19 +++++++++++++++++--
15  1 file changed, 17 insertions(+), 2 deletions(-)
16
17 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
18 +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
19 @@ -60,6 +60,15 @@
20  #define PWRAP_MAN_CMD_OP_OUTD          (0x9 << 8)
21  #define PWRAP_MAN_CMD_OP_OUTQ          (0xa << 8)
22  
23 +/* macro for Watch Dog Timer Source */
24 +#define PWRAP_WDT_SRC_EN_STAUPD_TRIG           (1 << 25)
25 +#define PWRAP_WDT_SRC_EN_HARB_STAUPD_DLE       (1 << 20)
26 +#define PWRAP_WDT_SRC_EN_HARB_STAUPD_ALE       (1 << 6)
27 +#define PWRAP_WDT_SRC_MASK_ALL                 0xffffffff
28 +#define PWRAP_WDT_SRC_MASK_NO_STAUPD   ~(PWRAP_WDT_SRC_EN_STAUPD_TRIG | \
29 +                                         PWRAP_WDT_SRC_EN_HARB_STAUPD_DLE | \
30 +                                         PWRAP_WDT_SRC_EN_HARB_STAUPD_ALE)
31 +
32  /* macro for slave device wrapper registers */
33  #define PWRAP_DEW_BASE                 0xbc00
34  #define PWRAP_DEW_EVENT_OUT_EN         (PWRAP_DEW_BASE + 0x0)
35 @@ -822,7 +831,7 @@ MODULE_DEVICE_TABLE(of, of_pwrap_match_t
36  
37  static int pwrap_probe(struct platform_device *pdev)
38  {
39 -       int ret, irq;
40 +       int ret, irq, wdt_src;
41         struct pmic_wrapper *wrp;
42         struct device_node *np = pdev->dev.of_node;
43         const struct of_device_id *of_id =
44 @@ -912,7 +921,13 @@ static int pwrap_probe(struct platform_d
45  
46         /* Initialize watchdog, may not be done by the bootloader */
47         pwrap_writel(wrp, 0xf, PWRAP_WDT_UNIT);
48 -       pwrap_writel(wrp, 0xffffffff, PWRAP_WDT_SRC_EN);
49 +       /*
50 +        * Since STAUPD was not used on mt8173 platform,
51 +        * so STAUPD of WDT_SRC which should be turned off
52 +        */
53 +       wdt_src = pwrap_is_mt8173(wrp) ?
54 +                       PWRAP_WDT_SRC_MASK_NO_STAUPD : PWRAP_WDT_SRC_MASK_ALL;
55 +       pwrap_writel(wrp, wdt_src, PWRAP_WDT_SRC_EN);
56         pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
57         pwrap_writel(wrp, ~((1 << 31) | (1 << 1)), PWRAP_INT_EN);
58