All of lore.kernel.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: "allen-kh.cheng" <allen-kh.cheng@mediatek.com>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tinghan Shen <tinghan.shen@mediatek.com>
Cc: Mark Brown <broonie@kernel.org>,
	linux-remoteproc@vger.kernel.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/2] remoteproc: mediatek: Support mt8186 scp
Date: Tue, 4 Jan 2022 09:43:24 +0100	[thread overview]
Message-ID: <39f95db9-9d52-e64c-7444-ccd8d88cc522@collabora.com> (raw)
In-Reply-To: <20220103075854.10438-2-allen-kh.cheng@mediatek.com>

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@mediatek.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

WARNING: multiple messages have this Message-ID (diff)
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: "allen-kh.cheng" <allen-kh.cheng@mediatek.com>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tinghan Shen <tinghan.shen@mediatek.com>
Cc: Mark Brown <broonie@kernel.org>,
	linux-remoteproc@vger.kernel.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/2] remoteproc: mediatek: Support mt8186 scp
Date: Tue, 4 Jan 2022 09:43:24 +0100	[thread overview]
Message-ID: <39f95db9-9d52-e64c-7444-ccd8d88cc522@collabora.com> (raw)
In-Reply-To: <20220103075854.10438-2-allen-kh.cheng@mediatek.com>

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@mediatek.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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: "allen-kh.cheng" <allen-kh.cheng@mediatek.com>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tinghan Shen <tinghan.shen@mediatek.com>
Cc: Mark Brown <broonie@kernel.org>,
	linux-remoteproc@vger.kernel.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/2] remoteproc: mediatek: Support mt8186 scp
Date: Tue, 4 Jan 2022 09:43:24 +0100	[thread overview]
Message-ID: <39f95db9-9d52-e64c-7444-ccd8d88cc522@collabora.com> (raw)
In-Reply-To: <20220103075854.10438-2-allen-kh.cheng@mediatek.com>

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@mediatek.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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2022-01-04  8:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03  7:58 [PATCH 1/2] dt-bindings: remoteproc: mediatek: Add binding for mt8186 scp allen-kh.cheng
2022-01-03  7:58 ` allen-kh.cheng
2022-01-03  7:58 ` [PATCH 2/2] remoteproc: mediatek: Support " allen-kh.cheng
2022-01-03  7:58   ` allen-kh.cheng
2022-01-04  8:43   ` AngeloGioacchino Del Regno [this message]
2022-01-04  8:43     ` AngeloGioacchino Del Regno
2022-01-04  8:43     ` AngeloGioacchino Del Regno
2022-01-04  8:43 ` [PATCH 1/2] dt-bindings: remoteproc: mediatek: Add binding for " AngeloGioacchino Del Regno
2022-01-04  8:43   ` AngeloGioacchino Del Regno
2022-01-04  8:43   ` AngeloGioacchino Del Regno
2022-01-04 11:47 [PATCH 0/2] Add SCP support for mt8186 allen-kh.cheng
2022-01-04 11:47 ` [PATCH 2/2] remoteproc: mediatek: Support mt8186 scp allen-kh.cheng
2022-01-04 11:47   ` allen-kh.cheng
2022-01-05  9:19   ` AngeloGioacchino Del Regno
2022-01-05  9:19     ` AngeloGioacchino Del Regno
2022-01-05  9:19     ` AngeloGioacchino Del Regno

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=39f95db9-9d52-e64c-7444-ccd8d88cc522@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=allen-kh.cheng@mediatek.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.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=mathieu.poirier@linaro.org \
    --cc=matthias.bgg@gmail.com \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=tinghan.shen@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.