diff mbox series

[v2,05/10] net: dsa: felix: configure the in-band autoneg property based on OF node info

Message ID 20210929150445.1593364-6-vladimir.oltean@nxp.com
State Accepted
Commit e3789a726269ce6c6e78277930cd1c2633e959a5
Delegated to: Ramon Fried
Headers show
Series Support the SJA1105 DSA switch on the NXP LS1021A-TSN board | expand

Commit Message

Vladimir Oltean Sept. 29, 2021, 3:04 p.m. UTC
Instead of trying to guess which operating modes need in-band
negotiation to be active and which ones don't, parse the available
information from the device tree. That will be correct in the cases we
can already guess, and more.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
---
v1->v2: none

 drivers/net/mscc_eswitch/felix_switch.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/mscc_eswitch/felix_switch.c b/drivers/net/mscc_eswitch/felix_switch.c
index 551fc2c9f969..2df8dde55fb9 100644
--- a/drivers/net/mscc_eswitch/felix_switch.c
+++ b/drivers/net/mscc_eswitch/felix_switch.c
@@ -16,6 +16,7 @@ 
  */
 
 #include <dm/device_compat.h>
+#include <dm/of_extra.h>
 #include <linux/delay.h>
 #include <net/dsa.h>
 #include <asm/io.h>
@@ -210,17 +211,14 @@  static int felix_init_sxgmii(struct mii_dev *imdio, int pidx)
 static void felix_start_pcs(struct udevice *dev, int port,
 			    struct phy_device *phy, struct mii_dev *imdio)
 {
-	bool autoneg = true;
-
-	if (phy->phy_id == PHY_FIXED_ID ||
-	    phy->interface == PHY_INTERFACE_MODE_2500BASEX)
-		autoneg = false;
+	ofnode node = dsa_port_get_ofnode(dev, port);
+	bool inband_an = ofnode_eth_uses_inband_aneg(node);
 
 	switch (phy->interface) {
 	case PHY_INTERFACE_MODE_SGMII:
 	case PHY_INTERFACE_MODE_2500BASEX:
 	case PHY_INTERFACE_MODE_QSGMII:
-		felix_init_sgmii(imdio, port, autoneg);
+		felix_init_sgmii(imdio, port, inband_an);
 		break;
 	case PHY_INTERFACE_MODE_10GBASER:
 	case PHY_INTERFACE_MODE_USXGMII: