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
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.
11 Signed-off-by: John Crispin <blogic@openwrt.org>
13 drivers/soc/mediatek/mtk-pmic-wrap.c | 9 +++++----
14 1 file changed, 5 insertions(+), 4 deletions(-)
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 {
23 int (*init_reg_clock)(struct pmic_wrapper *wrp);
24 int (*init_soc_specific)(struct pmic_wrapper *wrp);
26 @@ -829,6 +830,7 @@ static struct pmic_wrapper_type pwrap_mt
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,
34 @@ -839,6 +841,7 @@ static struct pmic_wrapper_type pwrap_mt
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,
42 @@ -858,7 +861,7 @@ MODULE_DEVICE_TABLE(of, of_pwrap_match_t
44 static int pwrap_probe(struct platform_device *pdev)
46 - int ret, irq, wdt_src;
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
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);