soc: mediatek: pwrap: Add MT6789 support
Subsystems (2)
v4 cover soc: mediatek: pwrap: Add MT6789 support
This series continues the MediaTek MT6789 (Helio G99) 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]
Original authorship and Signed-off-by are preserved on patches 1 and 3.
Changes since v3:
- Split the unrelated spi-mt65xx binding patch out into its own standalone submission (suggested by Roman Vivchar).
- Add sender Signed-off-by on rebased patches 1 and 3.
The v3/v4 rebase 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 v4 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.
---
Rebased onto mainline with Rob Herring's Acked-by from v1 preserved.
.../devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml +1 -0
@@ -33,6 +33,7 @@ properties: - mediatek,mt2701-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)
Re: [PATCH v4 1/3] dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789
Hi,
Quoted 8 lines · On Friday, November 27th, 2026 at 5:00 AM, Ilia Snezhkov via B4 Relay…
From: Arseniy Velikanov <[email protected]>
Add a compatible for the PMIC Wrapper found on the MT6789 SoC.
Signed-off-by Arseniy Velikanov <[email protected]>Signed-off-by Ilia Snezhkov <[email protected]>---
Best regards,
Roman
PATCH v4 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.
---
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
@@ -2533,7 +2533,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) {dev_dbg (wrp->dev,"init failed with %d\n" , ret);
@@ -2554,16 +2555,18 @@ static int pwrap_probe(struct platform_device *pdev) }/* 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 v4 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) SoC.
MT6789 uses the PMIF-SPI arbiter interface with bank 3 interrupt registers (INT_EN at 0x450, INT_FLG at 0x458, INT_CLR at 0x45C, mask 0x180000) and WACS2 software interface at 0x880..0x8A8. Register offsets and wrapper parameters are verified on live MT6789 hardware (iKKO MindOne, MT6366 PMIC).
---
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 ,
@@ -1316,6 +1329,7 @@ enum pwrap_type {PWRAP_MT2701 ,PWRAP_MT6765 ,PWRAP_MT6779 , +PWRAP_MT6789 ,PWRAP_MT6795 ,PWRAP_MT6797 , PWRAP_MT6873,
@@ -1852,6 +1866,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 :
@@ -2302,6 +2317,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 ,
@@ -2448,6 +2476,7 @@ static const struct of_device_id of_pwrap_match_tbl[] = { { .compatible = "mediatek,mt2701-pwrap", .data = &pwrap_mt2701 }, { .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 v4 3/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
Quoted 10 lines · On Friday, November 27th, 2026 at 5:00 AM, Ilia Snezhkov via B4 Relay…
From: Arseniy Velikanov <[email protected]>
Add PMIC-Wrapper support for the MediaTek MT6789 (Helio G99) SoC.
MT6789 uses the PMIF-SPI arbiter interface with bank 3 interrupt registers (
INT_ENat0x450,INT_FLGat0x458,INT_CLRat0x45C, mask0x180000) and WACS2 software interface at 0x880..0x8A8. Register offsets and wrapper parameters are verified on live MT6789 hardware (iKKO MindOne, MT6366 PMIC).
Quoted 6 lines
Signed-off-by Arseniy Velikanov <[email protected]>Signed-off-by Ilia Snezhkov <[email protected]>---
Changes since v2:
- AddedPWRAP_INT_FLG(0x458) andPWRAP_INT_CLR(0x45C) matching bank 3PWRAP_INT_EN(0x450).
I don't see INT_FLG and INT_CLR in the 5.10 kernel [1]. Where did you find them?
Also, the series doesn't apply on next-20261125. It might be due to recent mt6572 changes. Please rebase.
Best regards,
Roman