[<prev] [next>] [day] [month] [year] [list]
Message-ID: <39f95db9-9d52-e64c-7444-ccd8d88cc522@collabora.com>
Date: Tue, 4 Jan 2022 09:43:24 +0100
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: "allen-kh.cheng" <allen-kh.cheng@...iatek.com>,
Ohad Ben-Cohen <ohad@...ery.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Tinghan Shen <tinghan.shen@...iatek.com>
Cc: Mark Brown <broonie@...nel.org>, linux-remoteproc@...r.kernel.org,
Project_Global_Chrome_Upstream_Group@...iatek.com,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 2/2] remoteproc: mediatek: Support mt8186 scp
Il 03/01/22 08:58, allen-kh.cheng ha scritto:
> Add SCP support for mt8186
>
> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@...iatek.com>
Hello! Thanks for the patch!
However, there's something to improve...
> ---
> drivers/remoteproc/mtk_scp.c | 39 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 36e48cf58ed6..38eab6b86fd7 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -365,6 +365,31 @@ static int mt8183_scp_before_load(struct mtk_scp *scp)
> return 0;
> }
>
> +static int mt8186_scp_before_load(struct mtk_scp *scp)
> +{
> + int i;
> +
> + /* Clear SCP to host interrupt */
> + writel(MT8183_SCP_IPC_INT_BIT, scp->reg_base + MT8183_SCP_TO_HOST);
> +
> + /* Reset clocks before loading FW */
> + writel(0x0, scp->reg_base + MT8183_SCP_CLK_SW_SEL);
> + writel(0x0, scp->reg_base + MT8183_SCP_CLK_DIV_SEL);
> +
.............
> + /* Turn on the power of SCP's SRAM before using it. Enable 1 block per time*/
> + for (i = 31; i >= 0; i--)
> + writel(GENMASK(i, 0), scp->reg_base + MT8183_SCP_SRAM_PDN);
> + writel(0, scp->reg_base + MT8183_SCP_SRAM_PDN);
> +
.............
This snippet corresponds exactly to the mt8192_power_on_sram() helper:
please avoid code duplication by simply calling that function instead.
Thanks,
- Angelo
Powered by blists - more mailing lists