soc/spi: mediatek: Add MT6789 PMIC wrapper and SPI support
Subsystems (3)
v3 cover soc/spi: mediatek: Add MT6789 PMIC wrapper and SPI support
This series continues the stalled July 2025 MediaTek MT6789 (Helio G99) initial bring-up patches originally posted by Arseniy Velikanov (on CC):
- pwrap v1: https://lore.kernel.org/linux-mediatek/[email protected]/
- spi v1: https://lore.kernel.org/linux-mediatek/[email protected]/
Original authorship and Signed-off-by are preserved on patches 1, 3, and 4.
Changes since v2:
- Patch 2 (new): guard PWRAP_WDT_SRC_EN, PWRAP_WDT_SRC_EN_1, and cold pwrap_init() with !HAS_CAP(wrp->master->caps, PWRAP_CAP_ARB) so arbiter SoCs (MT6873, MT8195, MT6789) do not write wdt_src to offset 0x0 (PWRAP_INIT_DONE2) during probe.
- Patch 3 (was 2/3): add [PWRAP_INT_FLG] = 0x458 and [PWRAP_INT_CLR] = 0x45C to mt6789_regs[] matching PMIF-SPI bank 3 (INT_EN at 0x450, int_en_all = 0x180000) so pwrap_interrupt() does not clobber offset 0x0 and leave a level-high IRQ asserted.
- Patch 4 (was 3/3): renumbered to 4/4, unchanged.
The v3 rebase and fixes were prepared with an AI coding assistant.
Base: torvalds/linux master 4dce97c6c265.
Arseniy Velikanov (3):
dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789
soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789
Ilia Snezhkov (1):
soc: mediatek: mtk-pmic-pwrap: Skip WDT source and init on arbiter SoCs
.../bindings/soc/mediatek/mediatek,pwrap.yaml | 1 + .../bindings/spi/mediatek,spi-mt65xx.yaml | 4 +++ drivers/soc/mediatek/mtk-pmic-wrap.c | 44 ++++++++++++++++--- 3 files changed, 43 insertions(+), 6 deletions(-)
Signature · 1 line
2.54.0 (Apple Git-157)
PATCH v3 1/4 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 v7.4-rc4 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)
PATCH v3 2/4 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.
---
New in v3 (caught during v2 review). 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 v3 3/4 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) so pwrap_interrupt() clears the real status register instead of writing 0xffffffff to offset 0x0.
- Depends on patch 2/4 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)
PATCH v3 4/4 dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789
In reply to Ilia SnezhkovFrom: Arseniy Velikanov <[email protected]>
Add the SPI controller compatible for the MediaTek MT6789 SoC with mediatek,mt6893-spi as its fallback compatible, addressing v1 review feedback that MT6789 SPI is programming-model compatible with MT6893 without requiring a driver change.
--- .../devicetree/bindings/spi/mediatek,spi-mt65xx.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml +4 -0
@@ -39,6 +39,10 @@ properties: - mediatek,mt7988-spi-single - mediatek,mt8188-spi-ipm - const: mediatek,spi-ipm + - items: + - enum: + - mediatek,mt6789-spi + - const: mediatek,mt6893-spi - items: - enum: - mediatek,mt8196-spi
Signature · 1 line
2.54.0 (Apple Git-157)
Quoted 7 lines · On Thursday, November 26th, 2026 at 5:10 AM, Ilia Snezhkov via B4 Relay…
This series continues the stalled July 2025 MediaTek MT6789 (Helio G99) initial bring-up patches originally posted by Arseniy Velikanov (on CC):
- pwrap v1: https://lore.kernel.org/linux-mediatek/[email protected]/
- spi v1: https://lore.kernel.org/linux-mediatek/[email protected]/Original authorship and Signed-off-by are preserved on patches 1, 3, and 4.
Why this series has both spi and pwrap? There's no dependency between them.
Quoted 12 lines
Changes since v2:
- Patch 2 (new): guardPWRAP_WDT_SRC_EN,PWRAP_WDT_SRC_EN_1, and coldpwrap_init()with !HAS_CAP(wrp->master->caps,PWRAP_CAP_ARB) so arbiter SoCs (MT6873, MT8195, MT6789) do not writewdt_srcto offset0x0(PWRAP_INIT_DONE2) during probe.
- Patch 3 (was 2/3): add [PWRAP_INT_FLG] =0x458and [PWRAP_INT_CLR] =0x45Cto mt6789_regs[] matching PMIF-SPI bank 3 (INT_ENat0x450,int_en_all=0x180000) sopwrap_interrupt()does not clobber offset0x0and leave a level-high IRQ asserted.
- Patch 4 (was 3/3): renumbered to 4/4, unchanged.
All notes about addressing review in your patches should go below ---, otherwise they will be included in the git history. Alternatively, you can put them right here.
Best regards,
Roman
Quoted 23 lines
The v3 rebase and fixes were prepared with an AI coding assistant.
Base: torvalds/linux master
4dce97c6c265.Arseniy Velikanov (3):
dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789
soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789Ilia Snezhkov (1):
soc: mediatek: mtk-pmic-pwrap: Skip WDT source and init on arbiter SoCs.../bindings/soc/mediatek/mediatek,pwrap.yaml | 1 + .../bindings/spi/mediatek,spi-mt65xx.yaml | 4 +++ drivers/soc/mediatek/mtk-pmic-wrap.c | 44 ++++++++++++++++--- 3 files changed, 43 insertions(+), 6 deletions(-)--
2.54.0 (Apple Git-157)