Netdev List
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Minda Chen <minda.chen@starfivetech.com>,
	Frank <Frank.Sae@motor-comm.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [net-next v3 1/3] net: phy: motorcomm: move mdio lock out from yt8531_set_ds()
Date: Tue, 12 May 2026 15:17:12 +0200	[thread overview]
Message-ID: <5680b248-81bd-4a8e-9682-9d6d133c6e1a@bootlin.com> (raw)
In-Reply-To: <20260508094522.3952-2-minda.chen@starfivetech.com>



On 5/8/26 11:45, Minda Chen wrote:
> yt8531_set_ds() default set register with mdio lock and only called
> with YT8531 PHY. But new type YT8531s support RGMII and has the same
> pin strength setting with YT8531, YT8531s need to call yt8531_set_ds()
> setting pin drive strength. But YT8531s config init function
> yt8521_config_init() already get the mdio lock with phy_select_page().
> If calling yt8521_config_init() with mdio lock will cause dead lock.
> 
> Need to get the lock before calling yt8531_get_ds() and move mdio
> lock out from it for YT8531s.
> 
> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
>   drivers/net/phy/motorcomm.c | 23 ++++++++++++++---------
>   1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index 4d62f7b36212..c66804537aa2 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c
> @@ -974,7 +974,8 @@ static u32 yt8531_get_ldo_vol(struct phy_device *phydev)
>   {
>   	u32 val;
>   
> -	val = ytphy_read_ext_with_lock(phydev, YT8521_CHIP_CONFIG_REG);
> +	val = ytphy_read_ext(phydev, YT8521_CHIP_CONFIG_REG);
> +
>   	val = FIELD_GET(YT8531_RGMII_LDO_VOL_MASK, val);
>   
>   	return val <= YT8531_LDO_VOL_1V8 ? val : YT8531_LDO_VOL_1V8;
> @@ -1010,10 +1011,11 @@ static int yt8531_set_ds(struct phy_device *phydev)
>   		ds = YT8531_RGMII_RX_DS_DEFAULT;
>   	}
>   
> -	ret = ytphy_modify_ext_with_lock(phydev,
> -					 YTPHY_PAD_DRIVE_STRENGTH_REG,
> -					 YT8531_RGMII_RXC_DS_MASK,
> -					 FIELD_PREP(YT8531_RGMII_RXC_DS_MASK, ds));
> +	ret = ytphy_modify_ext(phydev,
> +			       YTPHY_PAD_DRIVE_STRENGTH_REG,
> +			       YT8531_RGMII_RXC_DS_MASK,
> +			       FIELD_PREP(YT8531_RGMII_RXC_DS_MASK, ds));
> +
>   	if (ret < 0)
>   		return ret;
>   
> @@ -1033,10 +1035,11 @@ static int yt8531_set_ds(struct phy_device *phydev)
>   	ds_field_low = FIELD_GET(GENMASK(1, 0), ds);
>   	ds_field_low = FIELD_PREP(YT8531_RGMII_RXD_DS_LOW_MASK, ds_field_low);
>   
> -	ret = ytphy_modify_ext_with_lock(phydev,
> -					 YTPHY_PAD_DRIVE_STRENGTH_REG,
> -					 YT8531_RGMII_RXD_DS_LOW_MASK | YT8531_RGMII_RXD_DS_HI_MASK,
> -					 ds_field_low | ds_field_hi);
> +	ret = ytphy_modify_ext(phydev,
> +			       YTPHY_PAD_DRIVE_STRENGTH_REG,
> +			       YT8531_RGMII_RXD_DS_LOW_MASK | YT8531_RGMII_RXD_DS_HI_MASK,
> +			       ds_field_low | ds_field_hi);
> +
>   	if (ret < 0)
>   		return ret;
>   
> @@ -1826,7 +1829,9 @@ static int yt8531_config_init(struct phy_device *phydev)
>   			return ret;
>   	}
>   
> +	phy_lock_mdio_bus(phydev);
>   	ret = yt8531_set_ds(phydev);
> +	phy_unlock_mdio_bus(phydev);
>   	if (ret < 0)
>   		return ret;
>   


  reply	other threads:[~2026-05-12 13:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  9:45 [net-next v3 0/3] Add motorcomm 8531s set ds func and 8522 driver Minda Chen
2026-05-08  9:45 ` [net-next v3 1/3] net: phy: motorcomm: move mdio lock out from yt8531_set_ds() Minda Chen
2026-05-12 13:17   ` Maxime Chevallier [this message]
2026-05-08  9:45 ` [net-next v3 2/3] net: motorcomm: phy: set drive strength in YT8531s RGMII Minda Chen
2026-05-12 13:32   ` Maxime Chevallier
2026-05-08  9:45 ` [net-next v3 3/3] net: phy: motorcomm: Add YT8522 100M RMII PHY support Minda Chen
2026-05-12  9:16   ` Paolo Abeni

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=5680b248-81bd-4a8e-9682-9d6d133c6e1a@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=Frank.Sae@motor-comm.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minda.chen@starfivetech.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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