From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Huayu Zong <huayu.zong@mediatek.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [PATCH v3 1/3] remoteproc: mediatek: Support platform reg offsets in mtk_scp_of_data
Date: Mon, 17 Nov 2025 09:47:56 -0700 [thread overview]
Message-ID: <aRtRvBZ1zaxW0N20@p14s> (raw)
In-Reply-To: <20251110101342.24261-2-huayu.zong@mediatek.com>
Good day,
On Mon, Nov 10, 2025 at 06:13:29PM +0800, Huayu Zong wrote:
> Some platforms only differ in HW register offsets, but can share
> the same API. Refine struct mtk_scp_of_data to allow setting HW
> register offsets via platform data, enabling better code reuse
> and easier support for new platforms.
>
> Signed-off-by: Huayu Zong <huayu.zong@mediatek.com>
> ---
> drivers/remoteproc/mtk_common.h | 5 +++++
> drivers/remoteproc/mtk_scp.c | 18 ++++++++++++++++--
> 2 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
> index fd5c539ab2ac..d45480ad332e 100644
> --- a/drivers/remoteproc/mtk_common.h
> +++ b/drivers/remoteproc/mtk_common.h
> @@ -112,6 +112,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 10e3f9eb8cd2..c3c37cae933a 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -236,7 +236,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);
> @@ -561,7 +561,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);
>
> @@ -575,6 +575,18 @@ 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.
> + *
> + * In the SCP, cores, DMA, and SPI are masters. When these masters
> + * access memory or devices, they need to carry a domain ID. This
> + * domain ID is used to determine whether they have permission to
> + * access the target device or memory.
> + */
> +
> + if (scp->data->scp_secure_domain_reg)
> + writel(scp->data->scp_domain_value,
> + scp->cluster->reg_base + scp->data->scp_secure_domain_reg);
> +
This change is not related to the description in the changelog, nor the other
changes in this patch. Please do another patch.
> return 0;
> }
>
> @@ -1527,6 +1539,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,
> };
>
> --
> 2.45.2
>
next prev parent reply other threads:[~2025-11-17 16:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 10:13 [PATCH v3 0/3] Add support for MT8189 SCP and device tree bindings Huayu Zong
2025-11-10 10:13 ` [PATCH v3 1/3] remoteproc: mediatek: Support platform reg offsets in mtk_scp_of_data Huayu Zong
2025-11-17 16:47 ` Mathieu Poirier [this message]
2025-11-10 10:13 ` [PATCH v3 2/3] remoteproc: mediatek: Add MT8189 SCP platform data Huayu Zong
2025-11-17 16:52 ` Mathieu Poirier
2025-11-10 10:13 ` [PATCH v3 3/3] dt-bindings: remoteproc: mediatek: Add MT8189 SCP binding Huayu Zong
2025-11-10 18:44 ` Conor Dooley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aRtRvBZ1zaxW0N20@p14s \
--to=mathieu.poirier@linaro.org \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=andersson@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=huayu.zong@mediatek.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).