aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2016-02-19 03:44:11 -0500
committerMatthias Brugger <matthias.bgg@gmail.com>2016-04-20 07:03:03 -0400
commit95b25c589158d97fbc6d5504b434aef263798fa7 (patch)
tree616ade19539b7f6ce4edb0708dfac2da5499e7b1
parent174f7b4ce15f9edd77caac67a82c686c54788485 (diff)
soc: mediatek: PMIC wrap: move wdt_src into the pmic_wrapper_type struct
Different SoCs will use different bitmask for the wdt_src. This patch defines the bitmask in the pmic_wrapper_type struct. This allows us to support new SoCs with a different bitmask to the one currently used. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
-rw-r--r--drivers/soc/mediatek/mtk-pmic-wrap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 8ce1bad3b605..aa54df304449 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -373,6 +373,7 @@ struct pmic_wrapper_type {
373 u32 arb_en_all; 373 u32 arb_en_all;
374 u32 int_en_all; 374 u32 int_en_all;
375 u32 spi_w; 375 u32 spi_w;
376 u32 wdt_src;
376 int (*init_reg_clock)(struct pmic_wrapper *wrp); 377 int (*init_reg_clock)(struct pmic_wrapper *wrp);
377 int (*init_soc_specific)(struct pmic_wrapper *wrp); 378 int (*init_soc_specific)(struct pmic_wrapper *wrp);
378}; 379};
@@ -829,6 +830,7 @@ static struct pmic_wrapper_type pwrap_mt8135 = {
829 .arb_en_all = 0x1ff, 830 .arb_en_all = 0x1ff,
830 .int_en_all = ~(BIT(31) | BIT(1)), 831 .int_en_all = ~(BIT(31) | BIT(1)),
831 .spi_w = PWRAP_MAN_CMD_SPI_WRITE, 832 .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
833 .wdt_src = PWRAP_WDT_SRC_MASK_ALL,
832 .init_reg_clock = pwrap_mt8135_init_reg_clock, 834 .init_reg_clock = pwrap_mt8135_init_reg_clock,
833 .init_soc_specific = pwrap_mt8135_init_soc_specific, 835 .init_soc_specific = pwrap_mt8135_init_soc_specific,
834}; 836};
@@ -839,6 +841,7 @@ static struct pmic_wrapper_type pwrap_mt8173 = {
839 .arb_en_all = 0x3f, 841 .arb_en_all = 0x3f,
840 .int_en_all = ~(BIT(31) | BIT(1)), 842 .int_en_all = ~(BIT(31) | BIT(1)),
841 .spi_w = PWRAP_MAN_CMD_SPI_WRITE, 843 .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
844 .wdt_src = PWRAP_WDT_SRC_MASK_NO_STAUPD,
842 .init_reg_clock = pwrap_mt8173_init_reg_clock, 845 .init_reg_clock = pwrap_mt8173_init_reg_clock,
843 .init_soc_specific = pwrap_mt8173_init_soc_specific, 846 .init_soc_specific = pwrap_mt8173_init_soc_specific,
844}; 847};
@@ -858,7 +861,7 @@ MODULE_DEVICE_TABLE(of, of_pwrap_match_tbl);
858 861
859static int pwrap_probe(struct platform_device *pdev) 862static int pwrap_probe(struct platform_device *pdev)
860{ 863{
861 int ret, irq, wdt_src; 864 int ret, irq;
862 struct pmic_wrapper *wrp; 865 struct pmic_wrapper *wrp;
863 struct device_node *np = pdev->dev.of_node; 866 struct device_node *np = pdev->dev.of_node;
864 const struct of_device_id *of_id = 867 const struct of_device_id *of_id =
@@ -948,9 +951,7 @@ static int pwrap_probe(struct platform_device *pdev)
948 * Since STAUPD was not used on mt8173 platform, 951 * Since STAUPD was not used on mt8173 platform,
949 * so STAUPD of WDT_SRC which should be turned off 952 * so STAUPD of WDT_SRC which should be turned off
950 */ 953 */
951 wdt_src = pwrap_is_mt8173(wrp) ? 954 pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN);
952 PWRAP_WDT_SRC_MASK_NO_STAUPD : PWRAP_WDT_SRC_MASK_ALL;
953 pwrap_writel(wrp, wdt_src, PWRAP_WDT_SRC_EN);
954 pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN); 955 pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
955 pwrap_writel(wrp, wrp->master->int_en_all, PWRAP_INT_EN); 956 pwrap_writel(wrp, wrp->master->int_en_all, PWRAP_INT_EN);
956 957