mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Andrew Davis <afd@ti.com>, Peter Rosin <peda@axentia.se>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mux: mmio: use reg property when parent device is not a syscon
Date: Tue, 16 May 2023 20:37:25 +0200	[thread overview]
Message-ID: <21429720-e27f-bf26-64e7-ace1186da31b@linaro.org> (raw)
In-Reply-To: <20230515191909.611241-1-afd@ti.com>

On 15/05/2023 21:19, Andrew Davis wrote:
> The DT binding for the reg-mux compatible states it can be used when the
> "parent device of mux controller is not syscon device". It also allows
> for a reg property. When the parent device is indeed not a syscon device,
> nor is it a regmap provider, we should fallback to using that reg
> property to identify the address space to use for this mux.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  drivers/mux/mmio.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
> index 44a7a0e885b8..42e00b9fd0a9 100644
> --- a/drivers/mux/mmio.c
> +++ b/drivers/mux/mmio.c
> @@ -44,10 +44,13 @@ static int mux_mmio_probe(struct platform_device *pdev)
>  	int ret;
>  	int i;
>  
> -	if (of_device_is_compatible(np, "mmio-mux"))
> +	if (of_device_is_compatible(np, "mmio-mux")) {
>  		regmap = syscon_node_to_regmap(np->parent);
> -	else
> -		regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV);
> +	} else {
> +		regmap = dev_get_regmap(dev->parent, NULL);
> +		if (!regmap)
> +			regmap = device_node_to_regmap(np) ?: ERR_PTR(-ENODEV);

Unless I miss something obvious, the original code is simply bogus and
wrong. I would like to give here Rb tag... but maybe I miss something
obvious. Why mux cannot be a device with MMIO itself? Binding allows it
which would be perfectly proper description of hardware.

Best regards,
Krzysztof


  parent reply	other threads:[~2023-05-16 18:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15 19:19 Andrew Davis
2023-05-15 21:14 ` Peter Rosin
2023-05-16 15:18   ` Andrew Davis
2023-05-16 16:19     ` Krzysztof Kozlowski
2023-05-16 16:29       ` Andrew Davis
2023-05-16 16:49         ` Krzysztof Kozlowski
2023-05-16 17:47           ` Andrew Davis
2023-05-16 18:33             ` Krzysztof Kozlowski
2023-05-16 18:59               ` Andrew Davis
2023-05-16 18:37 ` Krzysztof Kozlowski [this message]
2023-05-16 18:44   ` Krzysztof Kozlowski
2023-05-16 20:37     ` Andrew Davis

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=21429720-e27f-bf26-64e7-ace1186da31b@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=afd@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=peda@axentia.se \
    --cc=robh+dt@kernel.org \
    --cc=vigneshr@ti.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

all inboxes | Powered by JetHome®