[PATCH net-next 2/6] net: phy: dp83869: Perform software restart after configuring op mode

Romain Gantois posted 6 patches 1 year, 5 months ago
[PATCH net-next 2/6] net: phy: dp83869: Perform software restart after configuring op mode
Posted by Romain Gantois 1 year, 5 months ago
The DP83869 PHY requires a software restart after OP_MODE is changed in the
OP_MODE_DECODE register.

Add this restart in dp83869_configure_mode().

Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 drivers/net/phy/dp83869.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
index f6b05e3a3173e..6bb9bb1c0e962 100644
--- a/drivers/net/phy/dp83869.c
+++ b/drivers/net/phy/dp83869.c
@@ -786,6 +786,10 @@ static int dp83869_configure_mode(struct phy_device *phydev,
 		return -EINVAL;
 	}
 
+	ret = phy_write(phydev, DP83869_CTRL, DP83869_SW_RESTART);
+
+	usleep_range(10, 20);
+
 	return ret;
 }
 

-- 
2.45.2
Re: [PATCH net-next 2/6] net: phy: dp83869: Perform software restart after configuring op mode
Posted by Andrew Lunn 1 year, 5 months ago
On Mon, Jul 01, 2024 at 10:51:04AM +0200, Romain Gantois wrote:
> The DP83869 PHY requires a software restart after OP_MODE is changed in the
> OP_MODE_DECODE register.
> 
> Add this restart in dp83869_configure_mode().
> 
> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
> ---
>  drivers/net/phy/dp83869.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
> index f6b05e3a3173e..6bb9bb1c0e962 100644
> --- a/drivers/net/phy/dp83869.c
> +++ b/drivers/net/phy/dp83869.c
> @@ -786,6 +786,10 @@ static int dp83869_configure_mode(struct phy_device *phydev,


Not directly this patch, but dp83869_configure_mode() has:

ret = phy_write(phydev, MII_BMCR, MII_DP83869_BMCR_DEFAULT);

where #define MII_DP83869_BMCR_DEFAULT	(BMCR_ANENABLE | \
					 BMCR_FULLDPLX | \
					 BMCR_SPEED1000)

When considering the previous patch, maybe BMCR_ANENABLE should be
conditional on the mode being selected?

	Andrew
Re: [PATCH net-next 2/6] net: phy: dp83869: Perform software restart after configuring op mode
Posted by Romain Gantois 1 year, 5 months ago
On lundi 1 juillet 2024 18:44:33 UTC+2 Andrew Lunn wrote:
> On Mon, Jul 01, 2024 at 10:51:04AM +0200, Romain Gantois wrote:
> > The DP83869 PHY requires a software restart after OP_MODE is changed in
> > the
> > OP_MODE_DECODE register.
> > 
> > Add this restart in dp83869_configure_mode().
> > 
> > Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
> > ---
> > 
> >  drivers/net/phy/dp83869.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
> > index f6b05e3a3173e..6bb9bb1c0e962 100644
> > --- a/drivers/net/phy/dp83869.c
> > +++ b/drivers/net/phy/dp83869.c
> > @@ -786,6 +786,10 @@ static int dp83869_configure_mode(struct phy_device
> > *phydev,
> Not directly this patch, but dp83869_configure_mode() has:
> 
> ret = phy_write(phydev, MII_BMCR, MII_DP83869_BMCR_DEFAULT);
> 
> where #define MII_DP83869_BMCR_DEFAULT	(BMCR_ANENABLE | \
> 					 BMCR_FULLDPLX | \
> 					 BMCR_SPEED1000)
> 
> When considering the previous patch, maybe BMCR_ANENABLE should be
> conditional on the mode being selected?

Indeed, this would definitely make sense.

Thanks,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com