public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add support for MT8189 SCP and device tree bindings
@ 2025-09-24  8:44 Huayu Zong
  2025-09-24  8:44 ` [PATCH v2 1/2] dt-bindings: remoteproc: mediatek: Add binding for mt8189 scp Huayu Zong
  2025-09-24  8:44 ` [PATCH v2 2/2] remoteproc: mediatek: Support MT8189 SCP Huayu Zong
  0 siblings, 2 replies; 6+ messages in thread
From: Huayu Zong @ 2025-09-24  8:44 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Tinghan Shen
  Cc: linux-remoteproc, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Project_Global_Chrome_Upstream_Group, Huayu Zong

  This patch series adds support for the System Companion
Processor (SCP) on MediaTek MT8189, including device tree
bindings and driver support.

Huayu Zong (2):
  dt-bindings: remoteproc: mediatek: Add binding for mt8189 scp
  remoteproc: mediatek: Support MT8189 SCP

 .../bindings/remoteproc/mtk,scp.yaml          |  2 ++
 drivers/remoteproc/mtk_common.h               | 10 +++++++
 drivers/remoteproc/mtk_scp.c                  | 29 +++++++++++++++++--
 3 files changed, 39 insertions(+), 2 deletions(-)

-- 
2.45.2



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

* [PATCH v2 1/2] dt-bindings: remoteproc: mediatek: Add binding for mt8189 scp
  2025-09-24  8:44 [PATCH v2 0/2] Add support for MT8189 SCP and device tree bindings Huayu Zong
@ 2025-09-24  8:44 ` Huayu Zong
  2025-09-24 10:15   ` AngeloGioacchino Del Regno
  2025-09-24  8:44 ` [PATCH v2 2/2] remoteproc: mediatek: Support MT8189 SCP Huayu Zong
  1 sibling, 1 reply; 6+ messages in thread
From: Huayu Zong @ 2025-09-24  8:44 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Tinghan Shen
  Cc: linux-remoteproc, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Project_Global_Chrome_Upstream_Group, Huayu Zong

Add the compatible for mt8189 SCP to the binding.

Signed-off-by: Huayu Zong <huayu.zong@mediatek.com>
---
 Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
index 179c98b33b4d..407be544b404 100644
--- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
+++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
@@ -20,6 +20,7 @@ properties:
       - mediatek,mt8186-scp
       - mediatek,mt8188-scp
       - mediatek,mt8188-scp-dual
+      - mediatek,mt8189-scp
       - mediatek,mt8192-scp
       - mediatek,mt8195-scp
       - mediatek,mt8195-scp-dual
@@ -168,6 +169,7 @@ allOf:
             - mediatek,mt8183-scp
             - mediatek,mt8186-scp
             - mediatek,mt8188-scp
+            - mediatek,mt8189-scp
     then:
       properties:
         reg:
-- 
2.45.2



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

* [PATCH v2 2/2] remoteproc: mediatek: Support MT8189 SCP
  2025-09-24  8:44 [PATCH v2 0/2] Add support for MT8189 SCP and device tree bindings Huayu Zong
  2025-09-24  8:44 ` [PATCH v2 1/2] dt-bindings: remoteproc: mediatek: Add binding for mt8189 scp Huayu Zong
@ 2025-09-24  8:44 ` Huayu Zong
  2025-09-24 10:12   ` AngeloGioacchino Del Regno
  1 sibling, 1 reply; 6+ messages in thread
From: Huayu Zong @ 2025-09-24  8:44 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Tinghan Shen
  Cc: linux-remoteproc, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Project_Global_Chrome_Upstream_Group, Huayu Zong

Add SCP support for mt8189.

Signed-off-by: Huayu Zong <huayu.zong@mediatek.com>
---
 drivers/remoteproc/mtk_common.h | 10 ++++++++++
 drivers/remoteproc/mtk_scp.c    | 29 +++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
index fd5c539ab2ac..abf0dbd9978c 100644
--- a/drivers/remoteproc/mtk_common.h
+++ b/drivers/remoteproc/mtk_common.h
@@ -35,6 +35,11 @@
 #define MT8186_SCP_L1_SRAM_PD_P1	0x40B0
 #define MT8186_SCP_L1_SRAM_PD_p2	0x40B4
 
+#define MT8189_SCP2APMCU_IPC_CLR	0x30010
+#define MT8189_SCP2SPM_IPC_CLR		0x30018
+#define MT8189_SCP_SECURE_DOMAIN	0xA080
+#define MT8189_SCP_DOMAIN_VAL		0x3303003
+
 #define MT8192_L2TCM_SRAM_PD_0		0x10C0
 #define MT8192_L2TCM_SRAM_PD_1		0x10C4
 #define MT8192_L2TCM_SRAM_PD_2		0x10C8
@@ -112,6 +117,11 @@ struct mtk_scp_of_data {
 
 	u32 host_to_scp_reg;
 	u32 host_to_scp_int_bit;
+	u32 scp_to_host_ipc_clr_reg;
+	u32 scp_to_spm_ipc_clr_reg;
+
+	u32 scp_secure_domain_reg;
+	u32 scp_domain_value;
 
 	size_t ipi_buf_offset;
 	const struct mtk_scp_sizes_data *scp_sizes;
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 8206a1766481..57d9883defeb 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -235,7 +235,7 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp)
 		 * MT8192_SCP2APMCU_IPC.
 		 */
 		writel(MT8192_SCP_IPC_INT_BIT,
-		       scp->cluster->reg_base + MT8192_SCP2APMCU_IPC_CLR);
+		       scp->cluster->reg_base + scp->data->scp_to_host_ipc_clr_reg);
 	} else {
 		scp_wdt_handler(scp, scp_to_host);
 		writel(1, scp->cluster->reg_base + MT8192_CORE0_WDT_IRQ);
@@ -560,7 +560,7 @@ static int mt8188_scp_c1_before_load(struct mtk_scp *scp)
 static int mt8192_scp_before_load(struct mtk_scp *scp)
 {
 	/* clear SPM interrupt, SCP2SPM_IPC_CLR */
-	writel(0xff, scp->cluster->reg_base + MT8192_SCP2SPM_IPC_CLR);
+	writel(0xff, scp->cluster->reg_base + scp->data->scp_to_spm_ipc_clr_reg);
 
 	writel(1, scp->cluster->reg_base + MT8192_CORE0_SW_RSTN_SET);
 
@@ -574,6 +574,11 @@ static int mt8192_scp_before_load(struct mtk_scp *scp)
 	/* enable MPU for all memory regions */
 	writel(0xff, scp->cluster->reg_base + MT8192_CORE0_MEM_ATT_PREDEF);
 
+	/* set the domain of master in SCP */
+	if (scp->data->scp_secure_domain_reg)
+		writel(scp->data->scp_domain_value,
+		       scp->cluster->reg_base + scp->data->scp_secure_domain_reg);
+
 	return 0;
 }
 
@@ -1464,6 +1469,23 @@ static const struct mtk_scp_of_data mt8188_of_data_c1 = {
 	.scp_sizes = &mt8188_scp_c1_sizes,
 };
 
+static const struct mtk_scp_of_data mt8189_of_data = {
+	.scp_clk_get = mt8195_scp_clk_get,
+	.scp_before_load = mt8192_scp_before_load,
+	.scp_irq_handler = mt8192_scp_irq_handler,
+	.scp_reset_assert = mt8192_scp_reset_assert,
+	.scp_reset_deassert = mt8192_scp_reset_deassert,
+	.scp_stop = mt8192_scp_stop,
+	.scp_da_to_va = mt8192_scp_da_to_va,
+	.host_to_scp_reg = MT8192_GIPC_IN_SET,
+	.host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT,
+	.scp_to_host_ipc_clr_reg = MT8189_SCP2APMCU_IPC_CLR,
+	.scp_to_spm_ipc_clr_reg = MT8189_SCP2SPM_IPC_CLR,
+	.scp_secure_domain_reg = MT8189_SCP_SECURE_DOMAIN,
+	.scp_domain_value = MT8189_SCP_DOMAIN_VAL,
+	.scp_sizes = &default_scp_sizes,
+};
+
 static const struct mtk_scp_of_data mt8192_of_data = {
 	.scp_clk_get = mt8192_scp_clk_get,
 	.scp_before_load = mt8192_scp_before_load,
@@ -1474,6 +1496,8 @@ static const struct mtk_scp_of_data mt8192_of_data = {
 	.scp_da_to_va = mt8192_scp_da_to_va,
 	.host_to_scp_reg = MT8192_GIPC_IN_SET,
 	.host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT,
+	.scp_to_host_ipc_clr_reg = MT8192_SCP2APMCU_IPC_CLR,
+	.scp_to_spm_ipc_clr_reg = MT8192_SCP2SPM_IPC_CLR,
 	.scp_sizes = &default_scp_sizes,
 };
 
@@ -1520,6 +1544,7 @@ static const struct of_device_id mtk_scp_of_match[] = {
 	{ .compatible = "mediatek,mt8186-scp", .data = &mt8186_of_data },
 	{ .compatible = "mediatek,mt8188-scp", .data = &mt8188_of_data },
 	{ .compatible = "mediatek,mt8188-scp-dual", .data = &mt8188_of_data_cores },
+	{ .compatible = "mediatek,mt8189-scp", .data = &mt8189_of_data },
 	{ .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data },
 	{ .compatible = "mediatek,mt8195-scp", .data = &mt8195_of_data },
 	{ .compatible = "mediatek,mt8195-scp-dual", .data = &mt8195_of_data_cores },
-- 
2.45.2



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

* Re: [PATCH v2 2/2] remoteproc: mediatek: Support MT8189 SCP
  2025-09-24  8:44 ` [PATCH v2 2/2] remoteproc: mediatek: Support MT8189 SCP Huayu Zong
@ 2025-09-24 10:12   ` AngeloGioacchino Del Regno
  2025-09-25  6:23     ` Huayu Zong (纵华宇)
  0 siblings, 1 reply; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-09-24 10:12 UTC (permalink / raw)
  To: Huayu Zong, Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, Tinghan Shen
  Cc: linux-remoteproc, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Il 24/09/25 10:44, Huayu Zong ha scritto:
> Add SCP support for mt8189.
> 

Please split this in at least two commits, with the last one adding only the
MT8189 platform data and compatible.

Also, please clearly describe the new scp_secure_domain_reg write, as the current
comment is not clear at all.

Anyway - the code looks good overall.

Cheers,
Angelo

> Signed-off-by: Huayu Zong <huayu.zong@mediatek.com>


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

* Re: [PATCH v2 1/2] dt-bindings: remoteproc: mediatek: Add binding for mt8189 scp
  2025-09-24  8:44 ` [PATCH v2 1/2] dt-bindings: remoteproc: mediatek: Add binding for mt8189 scp Huayu Zong
@ 2025-09-24 10:15   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-09-24 10:15 UTC (permalink / raw)
  To: Huayu Zong, Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, Tinghan Shen
  Cc: linux-remoteproc, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Il 24/09/25 10:44, Huayu Zong ha scritto:
> Add the compatible for mt8189 SCP to the binding.
> 
> Signed-off-by: Huayu Zong <huayu.zong@mediatek.com>

Please fix the commit description.

Example:

Add a new compatible for MT8189's SCP: even though this is partially
compatible with the SCP found in MT8192, the register layout has some
slight differences.

...after which:

Reviewed-by: AngeloGioacchino Del Regno <angelogiaocchino.delregno@collabora.com>

> ---
>   Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> index 179c98b33b4d..407be544b404 100644
> --- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> +++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> @@ -20,6 +20,7 @@ properties:
>         - mediatek,mt8186-scp
>         - mediatek,mt8188-scp
>         - mediatek,mt8188-scp-dual
> +      - mediatek,mt8189-scp
>         - mediatek,mt8192-scp
>         - mediatek,mt8195-scp
>         - mediatek,mt8195-scp-dual
> @@ -168,6 +169,7 @@ allOf:
>               - mediatek,mt8183-scp
>               - mediatek,mt8186-scp
>               - mediatek,mt8188-scp
> +            - mediatek,mt8189-scp
>       then:
>         properties:
>           reg:




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

* Re: [PATCH v2 2/2] remoteproc: mediatek: Support MT8189 SCP
  2025-09-24 10:12   ` AngeloGioacchino Del Regno
@ 2025-09-25  6:23     ` Huayu Zong (纵华宇)
  0 siblings, 0 replies; 6+ messages in thread
From: Huayu Zong (纵华宇) @ 2025-09-25  6:23 UTC (permalink / raw)
  To: TingHan Shen (沈廷翰), conor+dt@kernel.org,
	robh@kernel.org, matthias.bgg@gmail.com, krzk+dt@kernel.org,
	andersson@kernel.org, AngeloGioacchino Del Regno,
	mathieu.poirier@linaro.org
  Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	Project_Global_Chrome_Upstream_Group

On Wed, 2025-09-24 at 12:12 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 24/09/25 10:44, Huayu Zong ha scritto:
> > Add SCP support for mt8189.
> > 
> 
> Please split this in at least two commits, with the last one adding
> only the
> MT8189 platform data and compatible.
> 
> Also, please clearly describe the new scp_secure_domain_reg write, as
> the current
> comment is not clear at all.
> 
> Anyway - the code looks good overall.
> 
> Cheers,
> Angelo
> 

Thanks.

I will split this commit in 2 commits, one is platform data  (mtk_scp.c
& mtk_common.h file) and the other commit include strcut element
define, function modification.

I will add more about scp_secure_domain comment.

> > Signed-off-by: Huayu Zong <huayu.zong@mediatek.com>

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

end of thread, other threads:[~2025-09-25  6:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-24  8:44 [PATCH v2 0/2] Add support for MT8189 SCP and device tree bindings Huayu Zong
2025-09-24  8:44 ` [PATCH v2 1/2] dt-bindings: remoteproc: mediatek: Add binding for mt8189 scp Huayu Zong
2025-09-24 10:15   ` AngeloGioacchino Del Regno
2025-09-24  8:44 ` [PATCH v2 2/2] remoteproc: mediatek: Support MT8189 SCP Huayu Zong
2025-09-24 10:12   ` AngeloGioacchino Del Regno
2025-09-25  6:23     ` Huayu Zong (纵华宇)

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