[PATCH v1 1/3] net: dsa: add adjust_link support

Oleksij Rempel o.rempel at pengutronix.de
Thu Mar 16 06:42:07 PDT 2023


The required functionality is essential for cable hot plugging or
asynchronous link detection. In its current state, DSA will only operate
if the cable was connected prior to booting.

Signed-off-by: Oleksij Rempel <o.rempel at pengutronix.de>
---
 drivers/net/dsa.c | 4 ++--
 include/dsa.h     | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
index 793bbbb4f1..9c21564876 100644
--- a/drivers/net/dsa.c
+++ b/drivers/net/dsa.c
@@ -104,8 +104,8 @@ static int dsa_port_start(struct eth_device *edev)
 			return ret;
 	}
 
-	ret = phy_device_connect(edev, ds->slave_mii_bus, dp->index, NULL, 0,
-				 interface);
+	ret = phy_device_connect(edev, ds->slave_mii_bus, dp->index,
+				 ops->adjust_link, 0, interface);
 	if (ret)
 		return ret;
 
diff --git a/include/dsa.h b/include/dsa.h
index e823bac0a7..527941c269 100644
--- a/include/dsa.h
+++ b/include/dsa.h
@@ -55,6 +55,7 @@ struct dsa_switch_ops {
 
 	int (*phy_read)(struct dsa_switch *ds, int port, int regnum);
 	int (*phy_write)(struct dsa_switch *ds, int port, int regnum, u16 val);
+	void (*adjust_link)(struct eth_device *dev);
 };
 
 struct dsa_port {
-- 
2.30.2




More information about the barebox mailing list