mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC net 1/1] net: stmmac: skip PHY scanning when PHY already attached in DT mode
@ 2023-04-04  9:14 Michael Sit Wei Hong
       [not found] ` <CGME20230404165447eucas1p114076509978a487acfe8312e2e58ecca@eucas1p1.samsung.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Sit Wei Hong @ 2023-04-04  9:14 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, linux, hkallweit1, andrew,
	Martin Blumenstingl
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann,
	Zulkifli Muhammad Husaini, Tan Tee Min, hock.leong.kweh

If PHY is successfully attached during phylink_fwnode_phy_connect()
in DT mode. MAC should not need to scan for PHY again.

Adding a logic to check if ovr_an_inband is set before scanning for
a PHY, since phylink_fwnode_phy_connect() returns 0 when

	phy_fwnode = fwnode_get_phy_node(fwnode);
	if (IS_ERR(phy_fwnode)) {
		if (pl->cfg_link_an_mode == MLO_AN_PHY)
			return -ENODEV;
		return 0;
	}

Fixes: fe2cfbc96803 ("net: stmmac: check if MAC needs to attach to a PHY")
Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d41a5f92aee7..4b8d3d975678 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1149,7 +1149,7 @@ static int stmmac_init_phy(struct net_device *dev)
 	/* Some DT bindings do not set-up the PHY handle. Let's try to
 	 * manually parse it
 	 */
-	if (!fwnode || phy_needed || ret) {
+	if (!fwnode || (phy_needed && priv->phylink_config.ovr_an_inband) || ret) {
 		int addr = priv->plat->phy_addr;
 		struct phy_device *phydev;
 
-- 
2.34.1


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

end of thread, other threads:[~2023-04-04 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04  9:14 [RFC net 1/1] net: stmmac: skip PHY scanning when PHY already attached in DT mode Michael Sit Wei Hong
     [not found] ` <CGME20230404165447eucas1p114076509978a487acfe8312e2e58ecca@eucas1p1.samsung.com>
2023-04-04 16:54   ` Marek Szyprowski
2023-04-04 17:21 ` Russell King (Oracle)
2023-04-04 21:18 ` Martin Blumenstingl

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®