mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: phy: microchip_t1: LAN887X: Fix device init issues.
@ 2025-09-25 20:52 Josef Raschen
  2025-09-25 22:00 ` Andrew Lunn
  0 siblings, 1 reply; 8+ messages in thread
From: Josef Raschen @ 2025-09-25 20:52 UTC (permalink / raw)
  Cc: josef, Arun Ramadoss, UNGLinuxDriver, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

Currently, for a LAN8870 phy, before link up, a call to ethtool to set
master-slave fails with 'operation not supported'. Reason: speed, duplex
and master/slave are not properly initialized.

This change sets proper initial states for speed and duplex and publishes
master-slave states. A default link up for speed 1000, full duplex and
slave mode then works without having to call ethtool.

Signed-off-by: Josef Raschen <josef@raschen.org>
---
 drivers/net/phy/microchip_t1.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 62b36a318100..5fcbfa730910 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -1319,7 +1319,12 @@ static int lan887x_phy_init(struct phy_device *phydev)
 		return ret;
 
 	/* PHY interface setup */
-	return lan887x_config_phy_interface(phydev);
+	ret = lan887x_config_phy_interface(phydev);
+	if (ret < 0)
+		return ret;
+
+	/* Make configuration visible for ethtool. */
+	return genphy_c45_pma_baset1_read_master_slave(phydev);
 }
 
 static int lan887x_phy_config(struct phy_device *phydev,
@@ -1489,7 +1494,12 @@ static int lan887x_config_aneg(struct phy_device *phydev)
 	if (ret < 0)
 		return ret;
 
-	return lan887x_phy_reconfig(phydev);
+	ret = lan887x_phy_reconfig(phydev);
+	if (ret < 0)
+		return ret;
+
+	/* Make configuration changes visible for ethtool. */
+	return genphy_c45_pma_baset1_read_master_slave(phydev);
 }
 
 static int lan887x_probe(struct phy_device *phydev)
@@ -1503,6 +1513,10 @@ static int lan887x_probe(struct phy_device *phydev)
 	priv->init_done = false;
 	phydev->priv = priv;
 
+	/* Set default link parameters. */
+	phydev->duplex = DUPLEX_FULL;
+	phydev->speed = SPEED_1000;
+
 	return lan887x_phy_setup(phydev);
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-10-07  6:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-25 20:52 [PATCH] net: phy: microchip_t1: LAN887X: Fix device init issues Josef Raschen
2025-09-25 22:00 ` Andrew Lunn
2025-09-26 21:24   ` Josef Raschen
2025-09-26 21:46     ` Andrew Lunn
2025-09-29 19:30       ` Josef Raschen
2025-10-03 12:59         ` Divya.Koppera
2025-10-06 18:44           ` Andrew Lunn
2025-10-07  6:01             ` Divya.Koppera

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®