* [PATCH v3 0/6] soc: mediatek: Add devapc support
@ 2026-04-16 3:12 Xiaoshun Xu
2026-04-16 3:12 ` [PATCH v3 1/6] soc: mediatek: mtk-devapc: refine devapc interrupt handler Xiaoshun Xu
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Xiaoshun Xu @ 2026-04-16 3:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Xiaoshun Xu
Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group,
Xiaoshun Xu
From: Xiaoshun Xu <xiaoshun.xu@mediatek.corp-partner.google.com>
Based on tag: next-20260415, linux-next/master
This series of patches add support for Mediatek devapc of MT8189 and
MT8196 soc.
Xiaoshun Xu (6):
soc: mediatek: mtk-devapc: refine devapc interrupt handler
soc: mediatek: mtk-devapc: refine DEVAPC clock control
soc: mediatek: mtk-devapc: Add support for MT8189 DEVAPC
dt-bindings: soc: mediatek: devapc: Add bindings for MT8189
soc: mediatek: mtk-devapc: Add support for MT8196 DEVAPC
dt-bindings: soc: mediatek: devapc: Add bindings for MT8196
Changes in v3:
- Add support for MT8196 devapc
- Updated yaml for dt-bindings
Changes in v2:
- Updated cover letter subject
- Updated yaml for dt-bindings
- Add support for MT8189 devapc
- Refine devapc clock control flow
- Refine devapc interrupt handler
Changes in v1:
- Add support for MT8189 devapc
- Updated yaml for MT8189
.../bindings/soc/mediatek/devapc.yaml | 11 +-
drivers/soc/mediatek/mtk-devapc.c | 197 ++++++++++++++----
2 files changed, 168 insertions(+), 40 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v3 1/6] soc: mediatek: mtk-devapc: refine devapc interrupt handler 2026-04-16 3:12 [PATCH v3 0/6] soc: mediatek: Add devapc support Xiaoshun Xu @ 2026-04-16 3:12 ` Xiaoshun Xu 2026-04-16 3:45 ` CK Hu (胡俊光) 2026-04-16 3:12 ` [PATCH v3 2/6] soc: mediatek: mtk-devapc: refine DEVAPC clock control Xiaoshun Xu ` (4 subsequent siblings) 5 siblings, 1 reply; 10+ messages in thread From: Xiaoshun Xu @ 2026-04-16 3:12 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Xiaoshun Xu Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group Because the violation IRQ uses a while loop, it might cause the system to remain in the interrupt handler indefinitely. We are currently optimizing this part of the process to handle only 20 violations for debug violation issues, and then exit the loop Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> --- drivers/soc/mediatek/mtk-devapc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c index f54c966138b5..c9e1401315ad 100644 --- a/drivers/soc/mediatek/mtk-devapc.c +++ b/drivers/soc/mediatek/mtk-devapc.c @@ -12,6 +12,7 @@ #include <linux/of_irq.h> #include <linux/of_address.h> +#define MAX_VIO_NUM 20 #define VIO_MOD_TO_REG_IND(m) ((m) / 32) #define VIO_MOD_TO_REG_OFF(m) ((m) % 32) @@ -188,13 +189,18 @@ static void devapc_extract_vio_dbg(struct mtk_devapc_context *ctx) */ static irqreturn_t devapc_violation_irq(int irq_number, void *data) { + u32 vio_num = 0; struct mtk_devapc_context *ctx = data; - while (devapc_sync_vio_dbg(ctx)) + mask_module_irq(ctx, true); + + for (vio_num = 0; (vio_num < MAX_VIO_NUM) && (devapc_sync_vio_dbg(ctx)); ++vio_num) devapc_extract_vio_dbg(ctx); clear_vio_status(ctx); + mask_module_irq(ctx, false); + return IRQ_HANDLED; } -- 2.45.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/6] soc: mediatek: mtk-devapc: refine devapc interrupt handler 2026-04-16 3:12 ` [PATCH v3 1/6] soc: mediatek: mtk-devapc: refine devapc interrupt handler Xiaoshun Xu @ 2026-04-16 3:45 ` CK Hu (胡俊光) 0 siblings, 0 replies; 10+ messages in thread From: CK Hu (胡俊光) @ 2026-04-16 3:45 UTC (permalink / raw) To: robh@kernel.org, Xiaoshun Xu (徐晓顺), krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, AngeloGioacchino Del Regno Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sirius Wang (王皓昱), Project_Global_Chrome_Upstream_Group, Vince-WL Liu (劉文龍) On Thu, 2026-04-16 at 11:12 +0800, Xiaoshun Xu wrote: > Because the violation IRQ uses a while loop, it might cause the > system to remain in the interrupt handler indefinitely. We are > currently optimizing this part of the process to handle only 20 > violations for debug violation issues, and then exit the loop > > Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> > --- > drivers/soc/mediatek/mtk-devapc.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c > index f54c966138b5..c9e1401315ad 100644 > --- a/drivers/soc/mediatek/mtk-devapc.c > +++ b/drivers/soc/mediatek/mtk-devapc.c > @@ -12,6 +12,7 @@ > #include <linux/of_irq.h> > #include <linux/of_address.h> > > +#define MAX_VIO_NUM 20 > #define VIO_MOD_TO_REG_IND(m) ((m) / 32) > #define VIO_MOD_TO_REG_OFF(m) ((m) % 32) > > @@ -188,13 +189,18 @@ static void devapc_extract_vio_dbg(struct mtk_devapc_context *ctx) > */ > static irqreturn_t devapc_violation_irq(int irq_number, void *data) > { > + u32 vio_num = 0; > struct mtk_devapc_context *ctx = data; > > - while (devapc_sync_vio_dbg(ctx)) > + mask_module_irq(ctx, true); mask irq is not related to this patch. This patch care about the infinite loop. So separate mask irq part to an independent patch and describe why do this. Regards, CK > + > + for (vio_num = 0; (vio_num < MAX_VIO_NUM) && (devapc_sync_vio_dbg(ctx)); ++vio_num) > devapc_extract_vio_dbg(ctx); > > clear_vio_status(ctx); > > + mask_module_irq(ctx, false); > + > return IRQ_HANDLED; > } > ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 2/6] soc: mediatek: mtk-devapc: refine DEVAPC clock control 2026-04-16 3:12 [PATCH v3 0/6] soc: mediatek: Add devapc support Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 1/6] soc: mediatek: mtk-devapc: refine devapc interrupt handler Xiaoshun Xu @ 2026-04-16 3:12 ` Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 3/6] soc: mediatek: mtk-devapc: Add support for MT8189 DEVAPC Xiaoshun Xu ` (3 subsequent siblings) 5 siblings, 0 replies; 10+ messages in thread From: Xiaoshun Xu @ 2026-04-16 3:12 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Xiaoshun Xu Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group Because the new DEVAPC design, DEVAPC clock is controlled by HW power domains, the control flow of DEVAPC clock is not necessary, but to maintain compatibility with legacy ICs, keep this part of code. Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> --- drivers/soc/mediatek/mtk-devapc.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c index c9e1401315ad..f54e310791e5 100644 --- a/drivers/soc/mediatek/mtk-devapc.c +++ b/drivers/soc/mediatek/mtk-devapc.c @@ -284,16 +284,28 @@ static int mtk_devapc_probe(struct platform_device *pdev) goto err; } - ctx->infra_clk = devm_clk_get_enabled(&pdev->dev, "devapc-infra-clock"); + /* + * The new design of DAPC clock is controlled by HW power domains, + * making it unnecessary to provide the clock control driver. + */ + ctx->infra_clk = devm_clk_get_optional(&pdev->dev, "devapc-infra-clock"); if (IS_ERR(ctx->infra_clk)) { - ret = -EINVAL; - goto err; + dev_err(ctx->dev, "Cannot get devapc clock from CCF\n"); + ctx->infra_clk = NULL; + } else { + if (clk_prepare_enable(ctx->infra_clk)) { + ret = -EINVAL; + goto err; + } } ret = devm_request_irq(&pdev->dev, devapc_irq, devapc_violation_irq, - IRQF_TRIGGER_NONE, "devapc", ctx); - if (ret) + IRQF_TRIGGER_NONE | IRQF_SHARED, "devapc", ctx); + if (ret) { + if (ctx->infra_clk) + clk_disable_unprepare(ctx->infra_clk); goto err; + } platform_set_drvdata(pdev, ctx); @@ -311,6 +323,9 @@ static void mtk_devapc_remove(struct platform_device *pdev) struct mtk_devapc_context *ctx = platform_get_drvdata(pdev); stop_devapc(ctx); + + clk_disable_unprepare(ctx->infra_clk); + iounmap(ctx->infra_base); } -- 2.45.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 3/6] soc: mediatek: mtk-devapc: Add support for MT8189 DEVAPC 2026-04-16 3:12 [PATCH v3 0/6] soc: mediatek: Add devapc support Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 1/6] soc: mediatek: mtk-devapc: refine devapc interrupt handler Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 2/6] soc: mediatek: mtk-devapc: refine DEVAPC clock control Xiaoshun Xu @ 2026-04-16 3:12 ` Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 4/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8189 Xiaoshun Xu ` (2 subsequent siblings) 5 siblings, 0 replies; 10+ messages in thread From: Xiaoshun Xu @ 2026-04-16 3:12 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Xiaoshun Xu Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group Add support for MT8189 DEVAPC, DEVAPC debug registers have new version, so refine the structure of devapc_regs_ofs_xxxx to devapc_regs_ofs_verX, and rename the infra_base to base in mtk_devapc_context because devapc not only access the infra_base to dump debug information when violation happens Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> --- drivers/soc/mediatek/mtk-devapc.c | 171 +++++++++++++++++++++++------- 1 file changed, 134 insertions(+), 37 deletions(-) diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c index f54e310791e5..824b49613c5a 100644 --- a/drivers/soc/mediatek/mtk-devapc.c +++ b/drivers/soc/mediatek/mtk-devapc.c @@ -27,9 +27,19 @@ struct mtk_devapc_vio_dbgs { u32 addr_h:4; u32 resv:4; } dbg0_bits; + + struct { + u32 dmnid:6; + u32 vio_w:1; + u32 vio_r:1; + u32 addr_h:4; + u32 resv:20; + } dbg0_bits_ver2; }; u32 vio_dbg1; + u32 vio_dbg2; + u32 vio_dbg3; }; struct mtk_devapc_regs_ofs { @@ -38,6 +48,8 @@ struct mtk_devapc_regs_ofs { u32 vio_sta_offset; u32 vio_dbg0_offset; u32 vio_dbg1_offset; + u32 vio_dbg2_offset; + u32 vio_dbg3_offset; u32 apc_con_offset; u32 vio_shift_sta_offset; u32 vio_shift_sel_offset; @@ -45,16 +57,20 @@ struct mtk_devapc_regs_ofs { }; struct mtk_devapc_data { - /* numbers of violation index */ - u32 vio_idx_num; + u32 version; + /* Default numbers of violation index */ + u32 default_vio_idx_num; const struct mtk_devapc_regs_ofs *regs_ofs; }; struct mtk_devapc_context { struct device *dev; - void __iomem *infra_base; + void __iomem *base; struct clk *infra_clk; const struct mtk_devapc_data *data; + + /* numbers of violation index */ + u32 vio_idx_num; }; static void clear_vio_status(struct mtk_devapc_context *ctx) @@ -62,12 +78,12 @@ static void clear_vio_status(struct mtk_devapc_context *ctx) void __iomem *reg; int i; - reg = ctx->infra_base + ctx->data->regs_ofs->vio_sta_offset; + reg = ctx->base + ctx->data->regs_ofs->vio_sta_offset; - for (i = 0; i < VIO_MOD_TO_REG_IND(ctx->data->vio_idx_num) - 1; i++) + for (i = 0; i < VIO_MOD_TO_REG_IND(ctx->vio_idx_num - 1); i++) writel(GENMASK(31, 0), reg + 4 * i); - writel(GENMASK(VIO_MOD_TO_REG_OFF(ctx->data->vio_idx_num) - 1, 0), + writel(GENMASK(VIO_MOD_TO_REG_OFF(ctx->vio_idx_num - 1), 0), reg + 4 * i); } @@ -77,22 +93,22 @@ static void mask_module_irq(struct mtk_devapc_context *ctx, bool mask) u32 val; int i; - reg = ctx->infra_base + ctx->data->regs_ofs->vio_mask_offset; + reg = ctx->base + ctx->data->regs_ofs->vio_mask_offset; if (mask) val = GENMASK(31, 0); else val = 0; - for (i = 0; i < VIO_MOD_TO_REG_IND(ctx->data->vio_idx_num) - 1; i++) + for (i = 0; i < VIO_MOD_TO_REG_IND(ctx->vio_idx_num - 1); i++) writel(val, reg + 4 * i); val = readl(reg + 4 * i); if (mask) - val |= GENMASK(VIO_MOD_TO_REG_OFF(ctx->data->vio_idx_num) - 1, + val |= GENMASK(VIO_MOD_TO_REG_OFF(ctx->vio_idx_num - 1), 0); else - val &= ~GENMASK(VIO_MOD_TO_REG_OFF(ctx->data->vio_idx_num) - 1, + val &= ~GENMASK(VIO_MOD_TO_REG_OFF(ctx->vio_idx_num - 1), 0); writel(val, reg + 4 * i); @@ -119,11 +135,11 @@ static int devapc_sync_vio_dbg(struct mtk_devapc_context *ctx) int ret; u32 val; - pd_vio_shift_sta_reg = ctx->infra_base + + pd_vio_shift_sta_reg = ctx->base + ctx->data->regs_ofs->vio_shift_sta_offset; - pd_vio_shift_sel_reg = ctx->infra_base + + pd_vio_shift_sel_reg = ctx->base + ctx->data->regs_ofs->vio_shift_sel_offset; - pd_vio_shift_con_reg = ctx->infra_base + + pd_vio_shift_con_reg = ctx->base + ctx->data->regs_ofs->vio_shift_con_offset; /* Find the minimum shift group which has violation */ @@ -134,7 +150,7 @@ static int devapc_sync_vio_dbg(struct mtk_devapc_context *ctx) min_shift_group = __ffs(val); /* Assign the group to sync */ - writel(0x1 << min_shift_group, pd_vio_shift_sel_reg); + writel(BIT(min_shift_group), pd_vio_shift_sel_reg); /* Start syncing */ writel(0x1, pd_vio_shift_con_reg); @@ -150,7 +166,7 @@ static int devapc_sync_vio_dbg(struct mtk_devapc_context *ctx) writel(0x0, pd_vio_shift_con_reg); /* Write clear */ - writel(0x1 << min_shift_group, pd_vio_shift_sta_reg); + writel(BIT(min_shift_group), pd_vio_shift_sta_reg); return true; } @@ -164,22 +180,52 @@ static void devapc_extract_vio_dbg(struct mtk_devapc_context *ctx) struct mtk_devapc_vio_dbgs vio_dbgs; void __iomem *vio_dbg0_reg; void __iomem *vio_dbg1_reg; + void __iomem *vio_dbg2_reg; + void __iomem *vio_dbg3_reg; + u32 vio_addr_l, vio_addr_h, bus_id, domain_id; + u32 vio_w, vio_r; + u64 vio_addr; - vio_dbg0_reg = ctx->infra_base + ctx->data->regs_ofs->vio_dbg0_offset; - vio_dbg1_reg = ctx->infra_base + ctx->data->regs_ofs->vio_dbg1_offset; + vio_dbg0_reg = ctx->base + ctx->data->regs_ofs->vio_dbg0_offset; + vio_dbg1_reg = ctx->base + ctx->data->regs_ofs->vio_dbg1_offset; + vio_dbg2_reg = ctx->base + ctx->data->regs_ofs->vio_dbg2_offset; + vio_dbg3_reg = ctx->base + ctx->data->regs_ofs->vio_dbg3_offset; vio_dbgs.vio_dbg0 = readl(vio_dbg0_reg); vio_dbgs.vio_dbg1 = readl(vio_dbg1_reg); + if (ctx->data->version >= 2U) + vio_dbgs.vio_dbg2 = readl(vio_dbg2_reg); + if (ctx->data->version == 3U) + vio_dbgs.vio_dbg3 = readl(vio_dbg3_reg); + + if (ctx->data->version == 1U) { + /* arch version 1 */ + bus_id = vio_dbgs.dbg0_bits.mstid; + vio_addr = vio_dbgs.vio_dbg1; + domain_id = vio_dbgs.dbg0_bits.dmnid; + vio_w = vio_dbgs.dbg0_bits.vio_w; + vio_r = vio_dbgs.dbg0_bits.vio_r; + } else { + /* arch version 2 & 3 */ + bus_id = vio_dbgs.vio_dbg1; + + vio_addr_l = vio_dbgs.vio_dbg2; + vio_addr_h = ctx->data->version == 2U ? vio_dbgs.dbg0_bits_ver2.addr_h : + vio_dbgs.vio_dbg3; + vio_addr = ((u64)vio_addr_h << 32) + vio_addr_l; + domain_id = vio_dbgs.dbg0_bits_ver2.dmnid; + vio_w = vio_dbgs.dbg0_bits_ver2.vio_w; + vio_r = vio_dbgs.dbg0_bits_ver2.vio_r; + } /* Print violation information */ - if (vio_dbgs.dbg0_bits.vio_w) + if (vio_w) dev_info(ctx->dev, "Write Violation\n"); - else if (vio_dbgs.dbg0_bits.vio_r) + else if (vio_r) dev_info(ctx->dev, "Read Violation\n"); - dev_info(ctx->dev, "Bus ID:0x%x, Dom ID:0x%x, Vio Addr:0x%x\n", - vio_dbgs.dbg0_bits.mstid, vio_dbgs.dbg0_bits.dmnid, - vio_dbgs.vio_dbg1); + dev_info(ctx->dev, "Bus ID:0x%x, Dom ID:0x%x, Vio Addr:0x%llx\n", + bus_id, domain_id, vio_addr); } /* @@ -209,7 +255,8 @@ static irqreturn_t devapc_violation_irq(int irq_number, void *data) */ static void start_devapc(struct mtk_devapc_context *ctx) { - writel(BIT(31), ctx->infra_base + ctx->data->regs_ofs->apc_con_offset); + + writel(BIT(31), ctx->base + ctx->data->regs_ofs->apc_con_offset); mask_module_irq(ctx, false); } @@ -221,28 +268,60 @@ static void stop_devapc(struct mtk_devapc_context *ctx) { mask_module_irq(ctx, true); - writel(BIT(2), ctx->infra_base + ctx->data->regs_ofs->apc_con_offset); + writel(BIT(2), ctx->base + ctx->data->regs_ofs->apc_con_offset); } -static const struct mtk_devapc_regs_ofs devapc_regs_ofs_mt6779 = { +static const struct mtk_devapc_regs_ofs devapc_regs_ofs_ver1 = { + .vio_mask_offset = 0x0, + .vio_sta_offset = 0x400, + .vio_dbg0_offset = 0x900, + .vio_dbg1_offset = 0x904, + .apc_con_offset = 0xf00, + .vio_shift_sta_offset = 0xf10, + .vio_shift_sel_offset = 0xf14, + .vio_shift_con_offset = 0xf20, +}; + +static const struct mtk_devapc_regs_ofs devapc_regs_ofs_ver2 = { .vio_mask_offset = 0x0, .vio_sta_offset = 0x400, .vio_dbg0_offset = 0x900, .vio_dbg1_offset = 0x904, - .apc_con_offset = 0xF00, - .vio_shift_sta_offset = 0xF10, - .vio_shift_sel_offset = 0xF14, - .vio_shift_con_offset = 0xF20, + .vio_dbg2_offset = 0x908, + .apc_con_offset = 0xf00, + .vio_shift_sta_offset = 0xf20, + .vio_shift_sel_offset = 0xf30, + .vio_shift_con_offset = 0xf10, +}; + +static const struct mtk_devapc_regs_ofs devapc_regs_ofs_ver3 = { + .vio_mask_offset = 0x0, + .vio_sta_offset = 0x400, + .vio_dbg0_offset = 0x900, + .vio_dbg1_offset = 0x904, + .vio_dbg2_offset = 0x908, + .vio_dbg3_offset = 0x90c, + .apc_con_offset = 0xf00, + .vio_shift_sta_offset = 0xf20, + .vio_shift_sel_offset = 0xf30, + .vio_shift_con_offset = 0xf10, }; static const struct mtk_devapc_data devapc_mt6779 = { - .vio_idx_num = 511, - .regs_ofs = &devapc_regs_ofs_mt6779, + .version = 1, + .default_vio_idx_num = 511, + .regs_ofs = &devapc_regs_ofs_ver1, }; static const struct mtk_devapc_data devapc_mt8186 = { - .vio_idx_num = 519, - .regs_ofs = &devapc_regs_ofs_mt6779, + .version = 1, + .default_vio_idx_num = 519, + .regs_ofs = &devapc_regs_ofs_ver1, +}; + +static const struct mtk_devapc_data devapc_mt8189 = { + .version = 3, + .regs_ofs = &devapc_regs_ofs_ver3, }; static const struct of_device_id mtk_devapc_dt_match[] = { @@ -252,6 +331,9 @@ static const struct of_device_id mtk_devapc_dt_match[] = { }, { .compatible = "mediatek,mt8186-devapc", .data = &devapc_mt8186, + }, { + .compatible = "mediatek,mt8189-devapc", + .data = &devapc_mt8189, }, { }, }; @@ -274,9 +356,24 @@ static int mtk_devapc_probe(struct platform_device *pdev) ctx->data = of_device_get_match_data(&pdev->dev); ctx->dev = &pdev->dev; - ctx->infra_base = of_iomap(node, 0); - if (!ctx->infra_base) + ctx->base = of_iomap(node, 0); + if (!ctx->base) { + dev_err(ctx->dev, "Failed to map devapc registers\n"); return -EINVAL; + } + + /* + * Set effective vio_idx_num from default value. + * If vio_idx_num is 0, get the info from DT. + */ + ctx->vio_idx_num = ctx->data->default_vio_idx_num; + if (ctx->vio_idx_num == 0) + if (of_property_read_u32(node, + "vio-idx-num", + &ctx->vio_idx_num)) { + ret = -EINVAL; + goto err; + } devapc_irq = irq_of_parse_and_map(node, 0); if (!devapc_irq) { @@ -314,7 +411,7 @@ static int mtk_devapc_probe(struct platform_device *pdev) return 0; err: - iounmap(ctx->infra_base); + iounmap(ctx->base); return ret; } @@ -326,7 +423,7 @@ static void mtk_devapc_remove(struct platform_device *pdev) clk_disable_unprepare(ctx->infra_clk); - iounmap(ctx->infra_base); + iounmap(ctx->base); } static struct platform_driver mtk_devapc_driver = { -- 2.45.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 4/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8189 2026-04-16 3:12 [PATCH v3 0/6] soc: mediatek: Add devapc support Xiaoshun Xu ` (2 preceding siblings ...) 2026-04-16 3:12 ` [PATCH v3 3/6] soc: mediatek: mtk-devapc: Add support for MT8189 DEVAPC Xiaoshun Xu @ 2026-04-16 3:12 ` Xiaoshun Xu 2026-04-16 8:56 ` Krzysztof Kozlowski 2026-04-16 3:12 ` [PATCH v3 5/6] soc: mediatek: mtk-devapc: Add support for MT8196 DEVAPC Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 6/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8196 Xiaoshun Xu 5 siblings, 1 reply; 10+ messages in thread From: Xiaoshun Xu @ 2026-04-16 3:12 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Xiaoshun Xu Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group Extend the devapc device tree bindings to support the MediaTek MT8189 SoC. This includes: - Adding "mediatek,mt8189-devapc" to the list of compatible strings. - Introducing the "vio-idx-num" property to specify the number of bus slaves managed by devapc. These changes enable proper configuration and integration of devapc on MT8189 platforms, ensuring accurate device matching and resource allocation in the device tree. Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> --- .../devicetree/bindings/soc/mediatek/devapc.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml b/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml index 99e2caafeadf..06a096440331 100644 --- a/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml +++ b/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml @@ -14,13 +14,14 @@ description: | analysis and countermeasures. maintainers: - - Neal Liu <neal.liu@mediatek.com> + - Xiaoshun Xu <xiaoshun.xu@mediatek.com> properties: compatible: enum: - mediatek,mt6779-devapc - mediatek,mt8186-devapc + - mediatek,mt8189-devapc reg: description: The base address of devapc register bank @@ -30,6 +31,10 @@ properties: description: A single interrupt specifier maxItems: 1 + vio-idx-num: + description: Describe the number of bus slaves controlled by devapc + $ref: /schemas/types.yaml#/definitions/uint32 + clocks: description: Contains module clock source and clock names maxItems: 1 @@ -42,8 +47,6 @@ required: - compatible - reg - interrupts - - clocks - - clock-names additionalProperties: false @@ -55,6 +58,7 @@ examples: devapc: devapc@10207000 { compatible = "mediatek,mt6779-devapc"; reg = <0x10207000 0x1000>; + vio-idx-num = <132>; interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_LOW>; clocks = <&infracfg_ao CLK_INFRA_DEVICE_APC>; clock-names = "devapc-infra-clock"; -- 2.45.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 4/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8189 2026-04-16 3:12 ` [PATCH v3 4/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8189 Xiaoshun Xu @ 2026-04-16 8:56 ` Krzysztof Kozlowski 0 siblings, 0 replies; 10+ messages in thread From: Krzysztof Kozlowski @ 2026-04-16 8:56 UTC (permalink / raw) To: Xiaoshun Xu Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group On Thu, Apr 16, 2026 at 11:12:07AM +0800, Xiaoshun Xu wrote: > Extend the devapc device tree bindings to support the MediaTek MT8189 > SoC. This includes: > > - Adding "mediatek,mt8189-devapc" to the list of compatible strings. > - Introducing the "vio-idx-num" property to specify the number of bus > slaves managed by devapc. > > These changes enable proper configuration and integration of devapc on > MT8189 platforms, ensuring accurate device matching and resource > allocation in the device tree. Pointless paragraph. Would you write a commit which does not enable proper configuration? > > Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> > --- > .../devicetree/bindings/soc/mediatek/devapc.yaml | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml b/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml > index 99e2caafeadf..06a096440331 100644 > --- a/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml > +++ b/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml > @@ -14,13 +14,14 @@ description: | > analysis and countermeasures. > > maintainers: > - - Neal Liu <neal.liu@mediatek.com> Your commit said what the change is doing. It's pointless because we see it in the diff. Except that we don't... > + - Xiaoshun Xu <xiaoshun.xu@mediatek.com> > > properties: > compatible: > enum: > - mediatek,mt6779-devapc > - mediatek,mt8186-devapc > + - mediatek,mt8189-devapc > > reg: > description: The base address of devapc register bank > @@ -30,6 +31,10 @@ properties: > description: A single interrupt specifier > maxItems: 1 > > + vio-idx-num: Nah, compatible defines it. Please follow standard rules for bindings, see writing-bindings doc. > + description: Describe the number of bus slaves controlled by devapc > + $ref: /schemas/types.yaml#/definitions/uint32 > + > clocks: > description: Contains module clock source and clock names > maxItems: 1 > @@ -42,8 +47,6 @@ required: > - compatible > - reg > - interrupts > - - clocks > - - clock-names Why? This commit explains nothing and makes some random-looking code changes. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 5/6] soc: mediatek: mtk-devapc: Add support for MT8196 DEVAPC 2026-04-16 3:12 [PATCH v3 0/6] soc: mediatek: Add devapc support Xiaoshun Xu ` (3 preceding siblings ...) 2026-04-16 3:12 ` [PATCH v3 4/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8189 Xiaoshun Xu @ 2026-04-16 3:12 ` Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 6/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8196 Xiaoshun Xu 5 siblings, 0 replies; 10+ messages in thread From: Xiaoshun Xu @ 2026-04-16 3:12 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Xiaoshun Xu Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group Add support for MT8196 DEVAPC, MT8196 DEVAPC debug registers are version 3 and add compatible for MT8196 Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> --- drivers/soc/mediatek/mtk-devapc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c index 824b49613c5a..0f828028bdb4 100644 --- a/drivers/soc/mediatek/mtk-devapc.c +++ b/drivers/soc/mediatek/mtk-devapc.c @@ -324,6 +324,11 @@ static const struct mtk_devapc_data devapc_mt8189 = { .regs_ofs = &devapc_regs_ofs_ver3, }; +static const struct mtk_devapc_data devapc_mt8196 = { + .version = 3, + .regs_ofs = &devapc_regs_ofs_ver3, +}; + static const struct of_device_id mtk_devapc_dt_match[] = { { .compatible = "mediatek,mt6779-devapc", @@ -334,6 +339,9 @@ static const struct of_device_id mtk_devapc_dt_match[] = { }, { .compatible = "mediatek,mt8189-devapc", .data = &devapc_mt8189, + }, { + .compatible = "mediatek,mt8196-devapc", + .data = &devapc_mt8196, }, { }, }; -- 2.45.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 6/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8196 2026-04-16 3:12 [PATCH v3 0/6] soc: mediatek: Add devapc support Xiaoshun Xu ` (4 preceding siblings ...) 2026-04-16 3:12 ` [PATCH v3 5/6] soc: mediatek: mtk-devapc: Add support for MT8196 DEVAPC Xiaoshun Xu @ 2026-04-16 3:12 ` Xiaoshun Xu 2026-04-16 8:58 ` Krzysztof Kozlowski 5 siblings, 1 reply; 10+ messages in thread From: Xiaoshun Xu @ 2026-04-16 3:12 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Xiaoshun Xu Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group Extend the devapc device tree bindings to support the MediaTek MT8196 SoC. This includes: - Adding "mediatek,mt8196-devapc" to the list of compatible strings. These changes enable proper configuration and integration of devapc on MT8196 platforms, ensuring accurate device matching and resource allocation in the device tree. Signed-off-by: Xiaoshun Xu <xiaoshun.xu@mediatek.com> --- Documentation/devicetree/bindings/soc/mediatek/devapc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml b/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml index 06a096440331..5eb260bf3dde 100644 --- a/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml +++ b/Documentation/devicetree/bindings/soc/mediatek/devapc.yaml @@ -22,6 +22,7 @@ properties: - mediatek,mt6779-devapc - mediatek,mt8186-devapc - mediatek,mt8189-devapc + - mediatek,mt8196-devapc reg: description: The base address of devapc register bank -- 2.45.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 6/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8196 2026-04-16 3:12 ` [PATCH v3 6/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8196 Xiaoshun Xu @ 2026-04-16 8:58 ` Krzysztof Kozlowski 0 siblings, 0 replies; 10+ messages in thread From: Krzysztof Kozlowski @ 2026-04-16 8:58 UTC (permalink / raw) To: Xiaoshun Xu Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, Sirius Wang, Vince-wl Liu, Project_Global_Chrome_Upstream_Group On Thu, Apr 16, 2026 at 11:12:09AM +0800, Xiaoshun Xu wrote: > Extend the devapc device tree bindings to support the MediaTek MT8196 > SoC. This includes: > > - Adding "mediatek,mt8196-devapc" to the list of compatible strings. > > These changes enable proper configuration and integration of devapc on > MT8196 platforms, ensuring accurate device matching and resource > allocation in the device tree. Same comments. It's really poor commit msg. Also, subject wrong. Drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings. See also: https://elixir.bootlin.com/linux/v6.17-rc3/source/Documentation/devicetree/bindings/submitting-patches.rst#L18 Best regards, Krzysztof ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-04-16 8:58 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-16 3:12 [PATCH v3 0/6] soc: mediatek: Add devapc support Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 1/6] soc: mediatek: mtk-devapc: refine devapc interrupt handler Xiaoshun Xu 2026-04-16 3:45 ` CK Hu (胡俊光) 2026-04-16 3:12 ` [PATCH v3 2/6] soc: mediatek: mtk-devapc: refine DEVAPC clock control Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 3/6] soc: mediatek: mtk-devapc: Add support for MT8189 DEVAPC Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 4/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8189 Xiaoshun Xu 2026-04-16 8:56 ` Krzysztof Kozlowski 2026-04-16 3:12 ` [PATCH v3 5/6] soc: mediatek: mtk-devapc: Add support for MT8196 DEVAPC Xiaoshun Xu 2026-04-16 3:12 ` [PATCH v3 6/6] dt-bindings: soc: mediatek: devapc: Add bindings for MT8196 Xiaoshun Xu 2026-04-16 8:58 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox