1e2c587605e8f863e1c4c12192655934d5cf20ac
[librecmc/librecmc.git] / target / linux / mediatek / patches-4.4 / 0037-soc-mediatek-PMIC-wrap-move-wdt_src-into-the-pmic_wr.patch
1 From 6aecbc79322efd3068c6140f74a68654fbe5b5f6 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Wed, 20 Jan 2016 10:48:35 +0100
4 Subject: [PATCH 037/102] soc: mediatek: PMIC wrap: move wdt_src into the
5  pmic_wrapper_type struct
6
7 Different SoCs will use different bitmask for the wdt_src. This patch
8 defines the bitmask in the pmic_wrapper_type struct. This allows us to
9 support new SoCs with a different bitmask to the one currently used.
10
11 Signed-off-by: John Crispin <blogic@openwrt.org>
12 ---
13  drivers/soc/mediatek/mtk-pmic-wrap.c |    9 +++++----
14  1 file changed, 5 insertions(+), 4 deletions(-)
15
16 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
17 +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
18 @@ -373,6 +373,7 @@ struct pmic_wrapper_type {
19         u32 arb_en_all;
20         u32 int_en_all;
21         u32 spi_w;
22 +       u32 wdt_src;
23         int (*init_reg_clock)(struct pmic_wrapper *wrp);
24         int (*init_soc_specific)(struct pmic_wrapper *wrp);
25  };
26 @@ -829,6 +830,7 @@ static struct pmic_wrapper_type pwrap_mt
27         .arb_en_all = 0x1ff,
28         .int_en_all = ~(BIT(31) | BIT(1)),
29         .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
30 +       .wdt_src = PWRAP_WDT_SRC_MASK_ALL,
31         .init_reg_clock = pwrap_mt8135_init_reg_clock,
32         .init_soc_specific = pwrap_mt8135_init_soc_specific,
33  };
34 @@ -839,6 +841,7 @@ static struct pmic_wrapper_type pwrap_mt
35         .arb_en_all = 0x3f,
36         .int_en_all = ~(BIT(31) | BIT(1)),
37         .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
38 +       .wdt_src = PWRAP_WDT_SRC_MASK_NO_STAUPD,
39         .init_reg_clock = pwrap_mt8173_init_reg_clock,
40         .init_soc_specific = pwrap_mt8173_init_soc_specific,
41  };
42 @@ -858,7 +861,7 @@ MODULE_DEVICE_TABLE(of, of_pwrap_match_t
43  
44  static int pwrap_probe(struct platform_device *pdev)
45  {
46 -       int ret, irq, wdt_src;
47 +       int ret, irq;
48         struct pmic_wrapper *wrp;
49         struct device_node *np = pdev->dev.of_node;
50         const struct of_device_id *of_id =
51 @@ -948,9 +951,7 @@ static int pwrap_probe(struct platform_d
52          * Since STAUPD was not used on mt8173 platform,
53          * so STAUPD of WDT_SRC which should be turned off
54          */
55 -       wdt_src = pwrap_is_mt8173(wrp) ?
56 -                       PWRAP_WDT_SRC_MASK_NO_STAUPD : PWRAP_WDT_SRC_MASK_ALL;
57 -       pwrap_writel(wrp, wdt_src, PWRAP_WDT_SRC_EN);
58 +       pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN);
59         pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
60         pwrap_writel(wrp, wrp->master->int_en_all, PWRAP_INT_EN);
61