diff mbox series

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

Message ID 20240701-b4-dp83869-sfp-v1-2-a71d6d0ad5f8@bootlin.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: phy: dp83869: Add support for downstream SFP cages | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 839 this patch: 839
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 846 this patch: 846
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 846 this patch: 846
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-01--15-00 (tests: 664)

Commit Message

Romain Gantois July 1, 2024, 8:51 a.m. UTC
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(+)

Comments

Andrew Lunn July 1, 2024, 4:44 p.m. UTC | #1
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
Romain Gantois July 2, 2024, 8:45 a.m. UTC | #2
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,
diff mbox series

Patch

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;
 }