mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@kernel.org>
To: Andrew Davis <afd@ti.com>, Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>,
	Siddharth Vadapalli <s-vadapalli@ti.com>
Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] phy: ti: gmii-sel: Fix register offset when parent is not a syscon node
Date: Thu, 26 Oct 2023 14:56:14 +0300	[thread overview]
Message-ID: <f09e7aab-f446-478f-b52e-0bb71b9fe2b3@kernel.org> (raw)
In-Reply-To: <20231025143302.1265633-1-afd@ti.com>



On 25/10/2023 17:33, Andrew Davis wrote:
> When the node for this phy selector is a child node of a syscon node then the
> property 'reg' is used as an offset into the parent regmap. When the node
> is standalone and gets its own regmap this offset is pre-applied. So we need
> to track which method was used to get the regmap and not apply the offset
> in the standalone case.
> 
> Fixes: 1fdfa7cccd35 ("phy: ti: gmii-sel: Allow parent to not be syscon node")
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  drivers/phy/ti/phy-gmii-sel.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c
> index 555b323f45da1..bc847d3879f79 100644
> --- a/drivers/phy/ti/phy-gmii-sel.c
> +++ b/drivers/phy/ti/phy-gmii-sel.c
> @@ -64,6 +64,7 @@ struct phy_gmii_sel_priv {
>  	u32 num_ports;
>  	u32 reg_offset;
>  	u32 qsgmii_main_ports;
> +	bool no_offset;
>  };
>  
>  static int phy_gmii_sel_mode(struct phy *phy, enum phy_mode mode, int submode)
> @@ -402,7 +403,8 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv)
>  		priv->num_ports = size / sizeof(u32);
>  		if (!priv->num_ports)
>  			return -EINVAL;
> -		priv->reg_offset = __be32_to_cpu(*offset);

nit: new line before new 'if' block please.

> +		if (!priv->no_offset)
> +			priv->reg_offset = __be32_to_cpu(*offset);
>  	}
>  
>  	if_phys = devm_kcalloc(dev, priv->num_ports,
> @@ -471,6 +473,7 @@ static int phy_gmii_sel_probe(struct platform_device *pdev)
>  			dev_err(dev, "Failed to get syscon %d\n", ret);
>  			return ret;
>  		}
> +		priv->no_offset = true;
>  	}
>  
>  	ret = phy_gmii_sel_init_ports(priv);


Reviewed-by: Roger Quadros <rogerq@kernel.org>

  reply	other threads:[~2023-10-26 11:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 14:33 Andrew Davis
2023-10-26 11:56 ` Roger Quadros [this message]
2023-11-16 15:00 ` Vinod Koul

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=f09e7aab-f446-478f-b52e-0bb71b9fe2b3@kernel.org \
    --to=rogerq@kernel.org \
    --cc=afd@ti.com \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=s-vadapalli@ti.com \
    --cc=vkoul@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

all inboxes | Powered by JetHome®