aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgus Lin <argus.lin@mediatek.com>2018-06-11 06:49:59 -0400
committerMatthias Brugger <matthias.bgg@gmail.com>2018-07-16 09:50:17 -0400
commit8e62ac4bad3956536fc08e351454abc90dda1e9f (patch)
tree1076dcf3780449a3be564889a871c9b04b6f7701
parentcd760b1cd703f0846362c171ec4c49dadbd7e0eb (diff)
soc: mediatek: pwrap: add pwrap driver for mt6797 SoCs
mt6797 is a highly integrated SoCs, it uses mt6351 for power management. This patch adds pwrap driver to access mt6351. Pwrap of mt6797 support dynamic priority meichanism, sequence monitor and starvation mechanism to make transaction more reliable. A big change from V4 to V5 is we remove INT1 interrupt declaration since it is only for debug purpose. The PWRAP_RDDMY, RESET and DCM can use legacy setting, it is backwards compatible. The new caps flag declaration is not needed, just remove it. Signed-off-by: Argus Lin <argus.lin@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
-rw-r--r--drivers/soc/mediatek/mtk-pmic-wrap.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 84dafaf855b9..5768cee37fba 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -366,6 +366,39 @@ static int mt2701_regs[] = {
366 [PWRAP_ADC_RDATA_ADDR2] = 0x154, 366 [PWRAP_ADC_RDATA_ADDR2] = 0x154,
367}; 367};
368 368
369static int mt6797_regs[] = {
370 [PWRAP_MUX_SEL] = 0x0,
371 [PWRAP_WRAP_EN] = 0x4,
372 [PWRAP_DIO_EN] = 0x8,
373 [PWRAP_SIDLY] = 0xC,
374 [PWRAP_RDDMY] = 0x10,
375 [PWRAP_CSHEXT_WRITE] = 0x18,
376 [PWRAP_CSHEXT_READ] = 0x1C,
377 [PWRAP_CSLEXT_START] = 0x20,
378 [PWRAP_CSLEXT_END] = 0x24,
379 [PWRAP_STAUPD_PRD] = 0x28,
380 [PWRAP_HARB_HPRIO] = 0x50,
381 [PWRAP_HIPRIO_ARB_EN] = 0x54,
382 [PWRAP_MAN_EN] = 0x60,
383 [PWRAP_MAN_CMD] = 0x64,
384 [PWRAP_WACS0_EN] = 0x70,
385 [PWRAP_WACS1_EN] = 0x84,
386 [PWRAP_WACS2_EN] = 0x98,
387 [PWRAP_INIT_DONE2] = 0x9C,
388 [PWRAP_WACS2_CMD] = 0xA0,
389 [PWRAP_WACS2_RDATA] = 0xA4,
390 [PWRAP_WACS2_VLDCLR] = 0xA8,
391 [PWRAP_INT_EN] = 0xC0,
392 [PWRAP_INT_FLG_RAW] = 0xC4,
393 [PWRAP_INT_FLG] = 0xC8,
394 [PWRAP_INT_CLR] = 0xCC,
395 [PWRAP_TIMER_EN] = 0xF4,
396 [PWRAP_WDT_UNIT] = 0xFC,
397 [PWRAP_WDT_SRC_EN] = 0x100,
398 [PWRAP_DCM_EN] = 0x1CC,
399 [PWRAP_DCM_DBC_PRD] = 0x1D4,
400};
401
369static int mt7622_regs[] = { 402static int mt7622_regs[] = {
370 [PWRAP_MUX_SEL] = 0x0, 403 [PWRAP_MUX_SEL] = 0x0,
371 [PWRAP_WRAP_EN] = 0x4, 404 [PWRAP_WRAP_EN] = 0x4,
@@ -641,6 +674,7 @@ enum pmic_type {
641 674
642enum pwrap_type { 675enum pwrap_type {
643 PWRAP_MT2701, 676 PWRAP_MT2701,
677 PWRAP_MT6797,
644 PWRAP_MT7622, 678 PWRAP_MT7622,
645 PWRAP_MT8135, 679 PWRAP_MT8135,
646 PWRAP_MT8173, 680 PWRAP_MT8173,
@@ -1067,6 +1101,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp)
1067 pwrap_writel(wrp, 1, PWRAP_CIPHER_START); 1101 pwrap_writel(wrp, 1, PWRAP_CIPHER_START);
1068 break; 1102 break;
1069 case PWRAP_MT2701: 1103 case PWRAP_MT2701:
1104 case PWRAP_MT6797:
1070 case PWRAP_MT8173: 1105 case PWRAP_MT8173:
1071 pwrap_writel(wrp, 1, PWRAP_CIPHER_EN); 1106 pwrap_writel(wrp, 1, PWRAP_CIPHER_EN);
1072 break; 1107 break;
@@ -1396,6 +1431,18 @@ static const struct pmic_wrapper_type pwrap_mt2701 = {
1396 .init_soc_specific = pwrap_mt2701_init_soc_specific, 1431 .init_soc_specific = pwrap_mt2701_init_soc_specific,
1397}; 1432};
1398 1433
1434static const struct pmic_wrapper_type pwrap_mt6797 = {
1435 .regs = mt6797_regs,
1436 .type = PWRAP_MT6797,
1437 .arb_en_all = 0x01fff,
1438 .int_en_all = 0xffffffc6,
1439 .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
1440 .wdt_src = PWRAP_WDT_SRC_MASK_ALL,
1441 .has_bridge = 0,
1442 .init_reg_clock = pwrap_common_init_reg_clock,
1443 .init_soc_specific = NULL,
1444};
1445
1399static const struct pmic_wrapper_type pwrap_mt7622 = { 1446static const struct pmic_wrapper_type pwrap_mt7622 = {
1400 .regs = mt7622_regs, 1447 .regs = mt7622_regs,
1401 .type = PWRAP_MT7622, 1448 .type = PWRAP_MT7622,
@@ -1437,6 +1484,9 @@ static const struct of_device_id of_pwrap_match_tbl[] = {
1437 .compatible = "mediatek,mt2701-pwrap", 1484 .compatible = "mediatek,mt2701-pwrap",
1438 .data = &pwrap_mt2701, 1485 .data = &pwrap_mt2701,
1439 }, { 1486 }, {
1487 .compatible = "mediatek,mt6797-pwrap",
1488 .data = &pwrap_mt6797,
1489 }, {
1440 .compatible = "mediatek,mt7622-pwrap", 1490 .compatible = "mediatek,mt7622-pwrap",
1441 .data = &pwrap_mt7622, 1491 .data = &pwrap_mt7622,
1442 }, { 1492 }, {