Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/3] soc/spi: mediatek: Add MT6789 PMIC wrapper and SPI support
@ 2026-11-26  0:07 Ilia Snezhkov via B4 Relay
  2026-11-26  0:07 ` [PATCH v2 1/3] dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ilia Snezhkov via B4 Relay @ 2026-11-26  0:07 UTC (permalink / raw)
  To: matthias.bgg, angelogioacchino.delregno, robh, krzk+dt, conor+dt,
	broonie
  Cc: flora.fu, amergnat, leilk.liu, me, devicetree, linux-spi,
	linux-mediatek, linux-arm-kernel, linux-kernel

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/20250715225746.1321-1-me@adomerle.pw/
- spi v1:   https://lore.kernel.org/linux-mediatek/20250715231921.4527-1-me@adomerle.pw/

Original authorship and Signed-off-by are preserved on all three patches.
If Arseniy prefers to continue maintaining this series directly, we are
happy to step aside or coordinate on the remaining MT6789 bring-up pieces
(clocks v3, pinctrl, LVTS thermal, scpsys, and DT).

Changes since v1:
- Patch 1 (pwrap binding): rebased onto v7.4-rc4; carried forward
  Acked-by: Rob Herring (Arm) <robh@kernel.org>.
- Patch 2 (mtk-pmic-wrap): rebased onto v7.4-rc4; marked mt6789_regs[]
  and pwrap_mt6789 const to match surrounding SoC tables; register table
  verified on live MT6789 hardware (iKKO MindOne, MT6366 PMIC).
- Patch 3 (spi-mt65xx binding): added mediatek,mt6893-spi fallback
  compatible as requested by Rob Herring in v1 review.

The v2 rebase and binding audit 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

 .../bindings/soc/mediatek/mediatek,pwrap.yaml |  1 +
 .../bindings/spi/mediatek,spi-mt65xx.yaml     |  4 +++
 drivers/soc/mediatek/mtk-pmic-wrap.c          | 27 +++++++++++++++++++
 3 files changed, 32 insertions(+)

-- 
2.54.0 (Apple Git-157)




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789
  2026-11-26  0:07 [PATCH v2 0/3] soc/spi: mediatek: Add MT6789 PMIC wrapper and SPI support Ilia Snezhkov via B4 Relay
@ 2026-11-26  0:07 ` Ilia Snezhkov via B4 Relay
  2026-11-26  0:07 ` [PATCH v2 2/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support Ilia Snezhkov via B4 Relay
  2026-11-26  0:07 ` [PATCH v2 3/3] dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
  2 siblings, 0 replies; 6+ messages in thread
From: Ilia Snezhkov via B4 Relay @ 2026-11-26  0:07 UTC (permalink / raw)
  To: matthias.bgg, angelogioacchino.delregno, robh, krzk+dt, conor+dt,
	broonie
  Cc: flora.fu, amergnat, leilk.liu, me, devicetree, linux-spi,
	linux-mediatek, linux-arm-kernel, linux-kernel

From: Arseniy Velikanov <me@adomerle.pw>

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.

Signed-off-by: Arseniy Velikanov <me@adomerle.pw>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Ilia Snezhkov <iasnezhkov@gmail.com>
---
 .../devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml         | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
index 79b7558..0c5ebf6 100644
--- a/Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
+++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
@@ -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
-- 
2.54.0 (Apple Git-157)




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
  2026-11-26  0:07 [PATCH v2 0/3] soc/spi: mediatek: Add MT6789 PMIC wrapper and SPI support Ilia Snezhkov via B4 Relay
  2026-11-26  0:07 ` [PATCH v2 1/3] dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
@ 2026-11-26  0:07 ` Ilia Snezhkov via B4 Relay
  2026-11-26  0:21   ` sashiko-bot
  2026-11-26  0:07 ` [PATCH v2 3/3] dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
  2 siblings, 1 reply; 6+ messages in thread
From: Ilia Snezhkov via B4 Relay @ 2026-11-26  0:07 UTC (permalink / raw)
  To: matthias.bgg, angelogioacchino.delregno, robh, krzk+dt, conor+dt,
	broonie
  Cc: flora.fu, amergnat, leilk.liu, me, devicetree, linux-spi,
	linux-mediatek, linux-arm-kernel, linux-kernel

From: Arseniy Velikanov <me@adomerle.pw>

Add PMIC-Wrapper support for the MediaTek MT6789 (Helio G99) SoC.

Register offsets (0x0, 0x3E4, 0x450, 0x880, 0x884, 0x894, 0x8A4, 0x8A8)
and wrapper parameters are verified on MT6789 hardware (iKKO MindOne,
MT6366 PMIC). Updated from v1 to mark mt6789_regs[] and pwrap_mt6789
const matching the surrounding SoC definitions.

Signed-off-by: Arseniy Velikanov <me@adomerle.pw>
Signed-off-by: Ilia Snezhkov <iasnezhkov@gmail.com>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 9067718..c74e916 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -640,6 +640,17 @@ 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_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 +1327,7 @@ enum pwrap_type {
 	PWRAP_MT2701,
 	PWRAP_MT6765,
 	PWRAP_MT6779,
+	PWRAP_MT6789,
 	PWRAP_MT6795,
 	PWRAP_MT6797,
 	PWRAP_MT6873,
@@ -1852,6 +1864,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 +2315,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 +2474,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 },
-- 
2.54.0 (Apple Git-157)




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789
  2026-11-26  0:07 [PATCH v2 0/3] soc/spi: mediatek: Add MT6789 PMIC wrapper and SPI support Ilia Snezhkov via B4 Relay
  2026-11-26  0:07 ` [PATCH v2 1/3] dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
  2026-11-26  0:07 ` [PATCH v2 2/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support Ilia Snezhkov via B4 Relay
@ 2026-11-26  0:07 ` Ilia Snezhkov via B4 Relay
  2026-11-26 11:44   ` Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Ilia Snezhkov via B4 Relay @ 2026-11-26  0:07 UTC (permalink / raw)
  To: matthias.bgg, angelogioacchino.delregno, robh, krzk+dt, conor+dt,
	broonie
  Cc: flora.fu, amergnat, leilk.liu, me, devicetree, linux-spi,
	linux-mediatek, linux-arm-kernel, linux-kernel

From: Arseniy Velikanov <me@adomerle.pw>

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.

Signed-off-by: Arseniy Velikanov <me@adomerle.pw>
Signed-off-by: Ilia Snezhkov <iasnezhkov@gmail.com>
---
 .../devicetree/bindings/spi/mediatek,spi-mt65xx.yaml          | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
index 3bf3eb1..7d82369 100644
--- a/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
+++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
@@ -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
-- 
2.54.0 (Apple Git-157)




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support
  2026-11-26  0:07 ` [PATCH v2 2/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support Ilia Snezhkov via B4 Relay
@ 2026-11-26  0:21   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-26  0:21 UTC (permalink / raw)
  To: Ilia Snezhkov; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] soc: mediatek: pwrap: missing INT_FLG and INT_CLR offsets in
  mt6789_regs
- [Medium] soc: mediatek: pwrap: unmapped WDT_SRC_EN and init writes to
  0x0 on MT6789
--

commit f63c0f3d9c9912d15ad03c4814d1837bc4e482d8
Author: Arseniy Velikanov <me@adomerle.pw>

soc: mediatek: mtk-pmic-pwrap: Add MT6789 support

This commit adds PMIC wrapper register definitions, cipher handling, wrapper
parameters, and device tree match table entry for the MediaTek MT6789 SoC.

> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index 90677187c3b56..c74e9164f3343 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -640,6 +640,17 @@ 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_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,
> +};

[Severity: High]
Should mt6789_regs[] also define PWRAP_INT_FLG and PWRAP_INT_CLR?

Because both are omitted here, their offsets default to 0x0
(PWRAP_INIT_DONE2).  pwrap_probe() enables interrupts in PWRAP_INT_EN with
int_en_all = 0x180000 and registers pwrap_interrupt() with IRQF_TRIGGER_HIGH:

drivers/soc/mediatek/mtk-pmic-wrap.c:pwrap_interrupt() {
	rdata = pwrap_readl(wrp, PWRAP_INT_FLG);
	dev_err(wrp->dev, "unexpected interrupt int=0x%x\n", rdata);
	pwrap_writel(wrp, 0xffffffff, PWRAP_INT_CLR);

	return IRQ_HANDLED;
}

When an enabled interrupt fires, pwrap_interrupt() reads and writes
0xffffffff to offset 0x0 instead of clearing the interrupt status register,
leaving the level-high IRQ asserted and causing an interrupt storm.  (Comparing
with mt8195_regs[], which shares these register offsets and int_en_all =
0x180000, 0x450 is bank 1 INT1_EN with flag and clear at 0x458 and 0x45c,
while bank 0 INT_EN/FLG/CLR are at 0x420/0x428/0x42c.)

[ ... ]

> @@ -1852,6 +1864,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 +2315,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,
> +};

[Severity: Medium]
Does probing pwrap_mt6789 overwrite PWRAP_INIT_DONE2 at offset 0x0 with
wdt_src (0xffffffff)?

In pwrap_probe(), the PWRAP_CAP_ARB check added by 9d498d0b4043 ("soc:
mediatek: pwrap: add arbiter capability") only guards PWRAP_WDT_UNIT, while
PWRAP_WDT_SRC_EN is written unconditionally:

drivers/soc/mediatek/mtk-pmic-wrap.c:pwrap_probe() {
	...
	if (!HAS_CAP(wrp->master->caps, PWRAP_CAP_ARB))
		pwrap_writel(wrp, 0xf, PWRAP_WDT_UNIT);

	pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN);
	...
}

Since PWRAP_WDT_SRC_EN is not in mt6789_regs[], its offset is 0x0, so every
probe writes 0xffffffff to PWRAP_INIT_DONE2.  In addition, this patch adds
PWRAP_MT6789 to pwrap_init_cipher(), but mt6789_regs[] omits all cipher and
initialization registers used by pwrap_init() and pwrap_init_cipher(), so
if PWRAP_INIT_DONE2 is not already set by the bootloader, those writes will
also hit offset 0x0.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126000711.16163-1-iasnezhkov@gmail.com?part=2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 3/3] dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789
  2026-11-26  0:07 ` [PATCH v2 3/3] dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
@ 2026-11-26 11:44   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2026-11-26 11:44 UTC (permalink / raw)
  To: iasnezhkov
  Cc: matthias.bgg, angelogioacchino.delregno, robh, krzk+dt, conor+dt,
	flora.fu, amergnat, leilk.liu, me, devicetree, linux-spi,
	linux-mediatek, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

On Thu, Nov 26, 2026 at 12:07:14AM +0000, Ilia Snezhkov via B4 Relay wrote:
> From: Arseniy Velikanov <me@adomerle.pw>
> 
> 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.

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-26 11:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  0:07 [PATCH v2 0/3] soc/spi: mediatek: Add MT6789 PMIC wrapper and SPI support Ilia Snezhkov via B4 Relay
2026-11-26  0:07 ` [PATCH v2 1/3] dt-bindings: soc: mediatek: pwrap: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
2026-11-26  0:07 ` [PATCH v2 2/3] soc: mediatek: mtk-pmic-pwrap: Add MT6789 support Ilia Snezhkov via B4 Relay
2026-11-26  0:21   ` sashiko-bot
2026-11-26  0:07 ` [PATCH v2 3/3] dt-bindings: spi: mediatek,spi-mt65xx: Add compatible for MT6789 Ilia Snezhkov via B4 Relay
2026-11-26 11:44   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox