soc: mediatek: pwrap: Add MT6789 support
Subsystems (2)
v5 cover soc: mediatek: pwrap: Add MT6789 support
This series continues the MediaTek MT6789 (Helio G99/G99+/G100/G200, MT8781) PMIC wrapper support originally posted by Arseniy Velikanov (on CC):
- pwrap v1: https://lore.kernel.org/linux-mediatek/[email protected]/
- v3: https://lore.kernel.org/r/[email protected]
- v4: https://lore.kernel.org/r/[email protected]
Original authorship and Signed-off-by are preserved on patches 1 and 3.
Changes since v4:
- Rebased onto linux-next (resolving conflicts with mt6572 support and the dev_err_probe() conversion in pwrap_probe(), per Roman Vivchar).
- Collected Reviewed-by from Roman Vivchar on patch 1/3.
- Clarified PMIF bank 3 INT_FLG/INT_CLR (0x458/0x45C) provenance in patch 3/3 commit message.
- Added [email protected] to Cc.
The v3-v5 rebases and arbiter fix were prepared with an AI coding assistant.
Arseniy Velikanov (2):
dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789
soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
Ilia Snezhkov (1):
soc: mediatek: mtk-pmic-pwrap: Skip WDT source and init on arbiter
SoCs
.../bindings/soc/mediatek/mediatek,pwrap.yaml | 1 + drivers/soc/mediatek/mtk-pmic-wrap.c | 50 +++++++++++++++---- 2 files changed, 42 insertions(+), 9 deletions(-)
Signature · 1 line
2.54.0 (Apple Git-157)
PATCH v5 1/3 dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789
From: Arseniy Velikanov <[email protected]>
Add a compatible for the PMIC Wrapper found on the MT6789 SoC.
---
Changes since v4:
- Rebased onto linux-next (after mt6572 binding additions).
- Collected Reviewed-by from Roman Vivchar (keeping Rob Herring's Acked-by from v1).
.../devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml +1 -0
@@ -34,6 +34,7 @@ properties: - mediatek,mt6572-pwrap - mediatek,mt6765-pwrap - mediatek,mt6779-pwrap + - mediatek,mt6789-pwrap - mediatek,mt6795-pwrap - mediatek,mt6797-pwrap - mediatek,mt6873-pwrap
Signature · 1 line
2.54.0 (Apple Git-157)
PATCH v5 2/3 soc: mediatek: mtk-pmic-pwrap: Skip WDT source and init on arbiter SoCs
In reply to Ilia SnezhkovCommit 9d498d0b4043 ("soc: mediatek: pwrap: add arbiter capability") added PWRAP_CAP_ARB for PMIF-SPI arbiter SoCs (MT6873, MT8195, and the upcoming MT6789), where the bootloader already initializes the wrapper and the watchdog registers (PWRAP_WDT_UNIT, PWRAP_WDT_SRC_EN, and PWRAP_WDT_SRC_EN_1) are absent from the per-SoC register tables.
However, pwrap_probe() only guarded PWRAP_WDT_UNIT with !HAS_CAP(wrp->master->caps, PWRAP_CAP_ARB), leaving the writes to PWRAP_WDT_SRC_EN and PWRAP_WDT_SRC_EN_1 unconditional. Because omitted entries in static const int regs[] default to 0, those writes land at offset 0x0 (PWRAP_INIT_DONE2) and overwrite it with wdt_src (0xffffffff) on every probe. Similarly, falling into pwrap_init() on PWRAP_CAP_ARB SoCs would write legacy non-arbiter registers whose offsets also default to 0x0.
Extend the !HAS_CAP(wrp->master->caps, PWRAP_CAP_ARB) guard in pwrap_probe() to cover PWRAP_WDT_SRC_EN, PWRAP_WDT_SRC_EN_1, and the cold pwrap_init() fallback.
---
Changes since v4:
- Rebased onto linux-next (after dev_err_probe() conversion in pwrap_probe()).
Added in v3. Drafted with an AI coding assistant.
drivers/soc/mediatek/mtk-pmic-wrap.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/soc/mediatek/mtk-pmic-wrap.c +12 -9
@@ -2553,7 +2553,8 @@ static int pwrap_probe(struct platform_device *pdev)* The PMIC could already be initialized by the bootloader. * Skip initialization here in this case. */ -if (!pwrap_readl (wrp,PWRAP_INIT_DONE2 )) { +if (!HAS_CAP (wrp->master->caps,PWRAP_CAP_ARB ) && + !pwrap_readl (wrp,PWRAP_INIT_DONE2 )) { ret =pwrap_init (wrp);if (ret)return dev_err_probe (wrp->dev, ret,"init failed\n" );
@@ -2571,16 +2572,18 @@ static int pwrap_probe(struct platform_device *pdev) "initialization isn't finished\n");/* Initialize watchdog, may not be done by the bootloader */ -if (!HAS_CAP (wrp->master->caps,PWRAP_CAP_ARB )) +if (!HAS_CAP (wrp->master->caps,PWRAP_CAP_ARB )) {pwrap_writel (wrp,0xf ,PWRAP_WDT_UNIT ); -/* -* Since STAUPD was not used on mt8173 platform, -* so STAUPD of WDT_SRC which should be turned off -*/ -pwrap_writel (wrp, wrp->master->wdt_src,PWRAP_WDT_SRC_EN ); -if (HAS_CAP (wrp->master->caps,PWRAP_CAP_WDT_SRC1 )) -pwrap_writel (wrp, wrp->master->wdt_src,PWRAP_WDT_SRC_EN_1 ); +/* +* Since STAUPD was not used on mt8173 platform, +* so STAUPD of WDT_SRC which should be turned off +*/ +pwrap_writel (wrp, wrp->master->wdt_src,PWRAP_WDT_SRC_EN ); +if (HAS_CAP (wrp->master->caps,PWRAP_CAP_WDT_SRC1 )) +pwrap_writel (wrp, wrp->master->wdt_src, +PWRAP_WDT_SRC_EN_1 ); + }if (HAS_CAP (wrp->master->caps,PWRAP_CAP_ARB ))pwrap_writel (wrp,0x3 ,PWRAP_TIMER_EN );
Signature · 1 line
2.54.0 (Apple Git-157)
PATCH v5 3/3 soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
In reply to Ilia SnezhkovFrom: Arseniy Velikanov <[email protected]>
Add PMIC-Wrapper support for the MediaTek MT6789 (Helio G99/G99+/G100/ G200 and tablet/IoT variant MT8781) SoC.
MT6789 uses the PMIF-SPI arbiter interface with the same register layout as MT8195/MT6833: bank 3 interrupt registers (INT_EN at 0x450, INT_FLG at 0x458, INT_CLR at 0x45C, mask 0x180000, matching PMIF_IRQ_*_3 in drivers/spmi/spmi-mtk-pmif.c) and WACS2 software interface at 0x880..0x8A8. Register offsets and wrapper parameters are verified on live MT6789 hardware (iKKO MindOne, MT6366 PMIC).
---
Changes since v4:
- Rebased onto linux-next (after mt6572 additions).
- Clarified PMIF bank 3 INT_FLG (0x458) / INT_CLR (0x45C) provenance and MT6789 SoC variants in the commit message.
Changes since v2:
- Added PWRAP_INT_FLG (0x458) and PWRAP_INT_CLR (0x45C) matching bank 3 PWRAP_INT_EN (0x450).
- Depends on patch 2/3 so probing does not write wdt_src to offset 0x0.
- Updated with an AI coding assistant.
drivers/soc/mediatek/mtk-pmic-wrap.c | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/soc/mediatek/mtk-pmic-wrap.c +29 -0
@@ -640,6 +640,19 @@ static const int mt6779_regs[] = { [PWRAP_WACS2_VLDCLR] = 0xC28, }; +static const int mt6789_regs[] = { + [PWRAP_INIT_DONE2 ] =0x0 , + [PWRAP_TIMER_EN ] =0x3E4 , + [PWRAP_INT_EN ] =0x450 , + [PWRAP_INT_FLG ] =0x458 , + [PWRAP_INT_CLR ] =0x45C , + [PWRAP_WACS2_CMD ] =0x880 , + [PWRAP_SWINF_2_WDATA_31_0 ] =0x884 , + [PWRAP_SWINF_2_RDATA_31_0 ] =0x894 , + [PWRAP_WACS2_VLDCLR ] =0x8A4 , + [PWRAP_WACS2_RDATA ] =0x8A8 , +}; +static const int mt6795_regs[] = { [PWRAP_MUX_SEL ] =0x0 , [PWRAP_WRAP_EN ] =0x4 ,
@@ -1317,6 +1330,7 @@ enum pwrap_type {PWRAP_MT6572 ,PWRAP_MT6765 ,PWRAP_MT6779 , +PWRAP_MT6789 ,PWRAP_MT6795 ,PWRAP_MT6797 , PWRAP_MT6873,
@@ -1859,6 +1873,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp)case PWRAP_MT7622 :pwrap_writel (wrp,0 ,PWRAP_CIPHER_EN );break ; +case PWRAP_MT6789 :case PWRAP_MT6873 :case PWRAP_MT8183 :case PWRAP_MT8195 :
@@ -2327,6 +2342,19 @@ static const struct pmic_wrapper_type pwrap_mt6779 = { .init_soc_specific = NULL, }; +static const struct pmic_wrapper_type pwrap_mt6789 = { + .regs = mt6789_regs, + .type =PWRAP_MT6789 , + .arb_en_all =0x777f , + .int_en_all =0x180000 , + .int1_en_all =0 , + .spi_w =PWRAP_MAN_CMD_SPI_WRITE , + .wdt_src =PWRAP_WDT_SRC_MASK_ALL , + .caps =PWRAP_CAP_ARB , + .init_reg_clock = pwrap_common_init_reg_clock, + .init_soc_specific =NULL , +}; +static const struct pmic_wrapper_type pwrap_mt6795 = { .regs = mt6795_regs, .type =PWRAP_MT6795 ,
@@ -2474,6 +2502,7 @@ static const struct of_device_id of_pwrap_match_tbl[] = { { .compatible = "mediatek,mt6572-pwrap", .data = &pwrap_mt6572 }, { .compatible = "mediatek,mt6765-pwrap", .data = &pwrap_mt6765 }, { .compatible = "mediatek,mt6779-pwrap", .data = &pwrap_mt6779 }, + { .compatible = "mediatek,mt6789-pwrap", .data = &pwrap_mt6789 }, { .compatible = "mediatek,mt6795-pwrap", .data = &pwrap_mt6795 }, { .compatible = "mediatek,mt6797-pwrap", .data = &pwrap_mt6797 }, { .compatible = "mediatek,mt6873-pwrap", .data = &pwrap_mt6873 },
Signature · 1 line
2.54.0 (Apple Git-157)
Re: [PATCH v5 3/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
Hi,
Quoted 7 lines · On Saturday, November 28th, 2026 at 6:36 AM, Ilia Snezhkov via B4 Relay…
From: Arseniy Velikanov <[email protected]>
Add PMIC-Wrapper support for the MediaTek MT6789 (Helio G99/G99+/G100/ G200 and tablet/IoT variant MT8781) SoC.
MT6789 uses the PMIF-SPI arbiter interface with the same register layout as MT8195/MT6833:
mt6833 is not upstream, and mt8195 has different offsets for pwrap. Please either say 'similar' or reword this part.
Quoted 11 lines
bank 3 interrupt registers (
INT_ENat0x450,INT_FLG
at0x458,INT_CLRat0x45C, mask0x180000, matching PMIF_IRQ_*_3 indrivers/spmi/spmi-mtk-pmif.c) and WACS2 software interface at 0x880..0x8A8.Register offsets and wrapper parameters are verified on live MT6789 hardware (iKKO MindOne, MT6366 PMIC).
Signed-off-by Arseniy Velikanov <[email protected]>Signed-off-by Ilia Snezhkov <[email protected]>---
Aside from the commit message, this looks fine to me. Though please wait around a week before sending a new revision. This series went from v2 to v5 very quickly, and Angelo and others may still want time to take a look at it.
Best regards,
Roman