[PATCH 6/9] net: dsa: always call port_pre_enable before port_enable

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jan 16 05:44:58 PST 2023


The barebox DSA support differentiates between a port_pre_enable, that's
called before connecting the PHY to drive a clock if nedeed and the
actual port_enable. For user ports, port_enable of the CPU port is
called, but not port_pre_enable. Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/net/dsa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
index c1430a93615b..793bbbb4f18f 100644
--- a/drivers/net/dsa.c
+++ b/drivers/net/dsa.c
@@ -122,6 +122,16 @@ static int dsa_port_start(struct eth_device *edev)
 	if (!ds->cpu_port_users) {
 		struct dsa_port *dpc = ds->dp[ds->cpu_port];
 
+		if (ops->port_pre_enable) {
+			/* In case of RMII interface we need to enable RMII clock
+			 * before talking to the PHY.
+			 */
+			ret = ops->port_pre_enable(dpc, ds->cpu_port,
+						   ds->cpu_port_fixed_phy->interface);
+			if (ret)
+				return ret;
+		}
+
 		if (ops->port_enable) {
 			ret = ops->port_enable(dpc, ds->cpu_port,
 					       ds->cpu_port_fixed_phy);
-- 
2.30.2




More information about the barebox mailing list