devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	robh+dt@kernel.org
Cc: krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	chun-jie.chen@mediatek.com, weiyi.lu@mediatek.com,
	mbrugger@suse.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, kernel@collabora.com,
	nfraprado@collabora.com
Subject: Re: [PATCH 3/3] soc: mediatek: pm-domains: Grab SCPSYS registers from phandle to syscon
Date: Tue, 12 Jul 2022 10:39:03 +0200	[thread overview]
Message-ID: <0eff0dd7-2d77-5341-5079-09d4a9309b1e@linaro.org> (raw)
In-Reply-To: <20220711122503.286743-4-angelogioacchino.delregno@collabora.com>

On 11/07/2022 14:25, AngeloGioacchino Del Regno wrote:
> Instead of requiring nesting of the power-controller inside of a
> "syscon", "simple-mfd" node, look for a phandle to SCPSYS in the
> "syscon" property of the power controller node.
> 
> Compatibility with older devicetrees is retained by falling back
> to looking for a parent node if no syscon phandle is found.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/soc/mediatek/mtk-pm-domains.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c
> index a3dae391a38a..c5a1c766cd50 100644
> --- a/drivers/soc/mediatek/mtk-pm-domains.c
> +++ b/drivers/soc/mediatek/mtk-pm-domains.c
> @@ -590,8 +590,7 @@ static int scpsys_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct device_node *np = dev->of_node;
>  	const struct scpsys_soc_data *soc;
> -	struct device_node *node;
> -	struct device *parent;
> +	struct device_node *node, *syscon;
>  	struct scpsys *scpsys;
>  	int ret;
>  
> @@ -611,13 +610,16 @@ static int scpsys_probe(struct platform_device *pdev)
>  	scpsys->pd_data.domains = scpsys->domains;
>  	scpsys->pd_data.num_domains = soc->num_domains;
>  
> -	parent = dev->parent;
> -	if (!parent) {
> -		dev_err(dev, "no parent for syscon devices\n");
> -		return -ENODEV;
> +	syscon = of_parse_phandle(dev->of_node, "syscon", 0);
> +	if (!syscon) {
> +		if (!dev->parent)
> +			return -ENODEV;
> +		scpsys->base = syscon_node_to_regmap(dev->parent->of_node);
> +	} else {
> +		scpsys->base = syscon_node_to_regmap(syscon);
> +		of_node_put(syscon);
>  	}

I responded in previous DTS thread. Technically code looks ok, but it
does not make really sense - either this is a child or a sibling. Not
both for the same hardware!

Best regards,
Krzysztof

      reply	other threads:[~2022-07-12  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 12:25 [PATCH 0/3] mtk-pm-domains: Use 'syscon' phandle for SCPSYS regmap AngeloGioacchino Del Regno
2022-07-11 12:25 ` [PATCH 1/3] dt-bindings: power: mediatek: Document phandle to SCPSYS syscon node AngeloGioacchino Del Regno
2022-07-12  8:31   ` Krzysztof Kozlowski
2022-07-11 12:25 ` [PATCH 2/3] dt-bindings: power: mediatek: Update example to use phandle to syscon AngeloGioacchino Del Regno
2022-07-18 18:06   ` Rob Herring
2022-07-19  7:57     ` AngeloGioacchino Del Regno
2022-07-11 12:25 ` [PATCH 3/3] soc: mediatek: pm-domains: Grab SCPSYS registers from " AngeloGioacchino Del Regno
2022-07-12  8:39   ` Krzysztof Kozlowski [this message]

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=0eff0dd7-2d77-5341-5079-09d4a9309b1e@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chun-jie.chen@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@collabora.com \
    --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=matthias.bgg@gmail.com \
    --cc=mbrugger@suse.com \
    --cc=nfraprado@collabora.com \
    --cc=robh+dt@kernel.org \
    --cc=weiyi.lu@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 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).