Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "TingHan Shen (沈廷翰)" <TingHan.Shen@mediatek.com>
To: "mathieu.poirier@linaro.org" <mathieu.poirier@linaro.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"andersson@kernel.org" <andersson@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>
Cc: "linux-remoteproc@vger.kernel.org"
	<linux-remoteproc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [PATCH v13 05/11] remoteproc: mediatek: Introduce cluster on single-core SCP
Date: Wed, 7 Jun 2023 08:00:14 +0000	[thread overview]
Message-ID: <9c710fca38ba53da3ba1aaf32a2221676eb584be.camel@mediatek.com> (raw)
In-Reply-To: <d8053fc1-cace-b14b-57c6-387c0d664837@collabora.com>

Hi Angelo,

On Wed, 2023-06-07 at 09:43 +0200, AngeloGioacchino Del Regno wrote:
> Il 07/06/23 09:22, Tinghan Shen ha scritto:
> > This is the preliminary step for probing multi-core SCP.
> > The initialization procedure for remoteproc is similar for both
> > single-core and multi-core architectures and is reusing to avoid
> > redundant code.
> > 
> > Rewrite the probing flow of single-core SCP to adapt with the 'cluster'
> > concept needed by probing the multi-core SCP. The main differences
> > are,
> > - the SCP core object(s) is maintained at the cluster list instead of at
> >    the platofmr device driver data property.
> 
> s/platofmr/platform/g
> 
> > - save the cluster information at the platofmr device driver data property.
> > - In order to keep the compatibility of exported SCP APIs which getting
> >    the SCP core object by SCP node phandle, move the SCP core object
> >    pointers to the platform device platform data property.
> > 
> > The registers of config and l1tcm are shared for multi-core
> > SCP. Reuse the mapped addresses for all cores.
> > 
> > Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
> > ---
> >   drivers/remoteproc/mtk_common.h |   2 +
> >   drivers/remoteproc/mtk_scp.c    | 151 +++++++++++++++++++++++---------
> >   2 files changed, 112 insertions(+), 41 deletions(-)
> > 
> > diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
> > index c0905aec3b4b..56395e8664cb 100644
> > --- a/drivers/remoteproc/mtk_common.h
> > +++ b/drivers/remoteproc/mtk_common.h
> > @@ -128,6 +128,8 @@ struct mtk_scp {
> >   	size_t dram_size;
> >   
> >   	struct rproc_subdev *rpmsg_subdev;
> > +
> > +	struct list_head elem;
> >   };
> >   
> >   /**
> > diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> > index d66822dad943..c8fc6b46f82b 100644
> > --- a/drivers/remoteproc/mtk_scp.c
> > +++ b/drivers/remoteproc/mtk_scp.c
> > @@ -23,6 +23,14 @@
> >   #define MAX_CODE_SIZE 0x500000
> >   #define SECTION_NAME_IPI_BUFFER ".ipi_buffer"
> >   
> > +struct mtk_scp_of_cluster {
> > +	void __iomem *reg_base;
> > +	void __iomem *l1tcm_base;
> > +	size_t l1tcm_size;
> > +	phys_addr_t l1tcm_phys;
> > +	struct list_head mtk_scp_list;
> > +};
> > +
> >   /**
> >    * scp_get() - get a reference to SCP.
> >    *
> > @@ -51,7 +59,7 @@ struct mtk_scp *scp_get(struct platform_device *pdev)
> >   		return NULL;
> >   	}
> >   
> > -	return platform_get_drvdata(scp_pdev);
> > +	return *(struct mtk_scp **)dev_get_platdata(&scp_pdev->dev);
> >   }
> >   EXPORT_SYMBOL_GPL(scp_get);
> >   
> > @@ -810,14 +818,14 @@ static void scp_unmap_memory_region(struct mtk_scp *scp)
> >   static int scp_register_ipi(struct platform_device *pdev, u32 id,
> >   			    ipi_handler_t handler, void *priv)
> >   {
> > -	struct mtk_scp *scp = platform_get_drvdata(pdev);
> > +	struct mtk_scp *scp = *(struct mtk_scp **)dev_get_platdata(&pdev->dev);
> >   
> >   	return scp_ipi_register(scp, id, handler, priv);
> >   }
> >   
> >   static void scp_unregister_ipi(struct platform_device *pdev, u32 id)
> >   {
> > -	struct mtk_scp *scp = platform_get_drvdata(pdev);
> > +	struct mtk_scp *scp = *(struct mtk_scp **)dev_get_platdata(&pdev->dev);
> >   
> >   	scp_ipi_unregister(scp, id);
> >   }
> > @@ -825,7 +833,7 @@ static void scp_unregister_ipi(struct platform_device *pdev, u32 id)
> >   static int scp_send_ipi(struct platform_device *pdev, u32 id, void *buf,
> >   			unsigned int len, unsigned int wait)
> >   {
> > -	struct mtk_scp *scp = platform_get_drvdata(pdev);
> > +	struct mtk_scp *scp = *(struct mtk_scp **)dev_get_platdata(&pdev->dev);
> >   
> >   	return scp_ipi_send(scp, id, buf, len, wait);
> >   }
> > @@ -855,7 +863,8 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp)
> >   	}
> >   }
> >   
> > -static int scp_probe(struct platform_device *pdev)
> > +static struct mtk_scp *scp_rproc_init(struct platform_device *pdev,
> > +				      struct mtk_scp_of_cluster *scp_cluster)
> >   {
> >   	struct device *dev = &pdev->dev;
> >   	struct device_node *np = dev->of_node;
> > @@ -867,52 +876,42 @@ static int scp_probe(struct platform_device *pdev)
> >   
> >   	ret = rproc_of_parse_firmware(dev, 0, &fw_name);
> >   	if (ret < 0 && ret != -EINVAL)
> > -		return ret;
> > +		return ERR_PTR(ret);
> >   
> >   	rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> > -	if (!rproc)
> > -		return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
> > +	if (!rproc) {
> > +		dev_err(dev, "unable to allocate remoteproc\n");
> > +		return ERR_PTR(-ENOMEM);
> 
> Why are you converting those dev_err_probe to dev_err->return?!
> 
> Regards,
> Angelo

It's because the return type of this function changed from "int" to "struct mtk_scp *".
Maybe I should change them to "ERR_PTR(dev_err_probe(...))" ?

-- 
Best regards,
TingHan

  reply	other threads:[~2023-06-07  8:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  7:22 [PATCH v13 00/11] Add support for MT8195 SCP 2nd core Tinghan Shen
2023-06-07  7:22 ` [PATCH v13 01/11] dt-bindings: remoteproc: mediatek: Improve the rpmsg subnode definition Tinghan Shen
2023-06-07  7:39   ` AngeloGioacchino Del Regno
2023-06-07  7:22 ` [PATCH v13 02/11] arm64: dts: mediatek: Update the node name of SCP rpmsg subnode Tinghan Shen
2023-06-07  7:22 ` [PATCH v13 03/11] dt-bindings: remoteproc: mediatek: Support MT8195 dual-core SCP Tinghan Shen
2023-06-07  7:22 ` [PATCH v13 04/11] remoteproc: mediatek: Add MT8195 SCP core 1 operations Tinghan Shen
2023-06-07  7:22 ` [PATCH v13 05/11] remoteproc: mediatek: Introduce cluster on single-core SCP Tinghan Shen
2023-06-07  7:43   ` AngeloGioacchino Del Regno
2023-06-07  8:00     ` TingHan Shen (沈廷翰) [this message]
2023-06-07  8:01       ` AngeloGioacchino Del Regno
2023-06-07  7:22 ` [PATCH v13 06/11] remoteproc: mediatek: Probe multi-core SCP Tinghan Shen
2023-06-07  7:44   ` AngeloGioacchino Del Regno
2023-06-07  7:22 ` [PATCH v13 07/11] remoteproc: mediatek: Add scp_boot_peers and scp_shutdown_peers operations Tinghan Shen
2023-06-07  7:49   ` AngeloGioacchino Del Regno
2023-06-07  7:22 ` [PATCH v13 08/11] remoteproc: mediatek: Setup MT8195 SCP core 1 SRAM offset Tinghan Shen
2023-06-07  7:22 ` [PATCH v13 09/11] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Tinghan Shen
2023-06-07  7:22 ` [PATCH v13 10/11] remoteproc: mediatek: Refine ipi handler error message Tinghan Shen
2023-06-07  7:22 ` [PATCH v13 11/11] arm64: dts: mediatek: mt8195: Add SCP 2nd core Tinghan Shen

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=9c710fca38ba53da3ba1aaf32a2221676eb584be.camel@mediatek.com \
    --to=tinghan.shen@mediatek.com \
    --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=krzysztof.kozlowski+dt@linaro.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=robh+dt@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