@@ -566,14 +566,9 @@ static int sja1105_rgmii_clocking_setup(struct sja1105_private *priv, int port,
dev_err(dev, "Failed to configure Tx pad registers\n");
return rc;
}
+
if (!priv->info->setup_rgmii_delay)
return 0;
- /* The role has no hardware effect for RGMII. However we use it as
- * a proxy for this interface being a MAC-to-MAC connection, with
- * the RGMII internal delays needing to be applied by us.
- */
- if (role == XMII_MAC)
- return 0;
return priv->info->setup_rgmii_delay(priv, port);
}
@@ -218,8 +218,14 @@ static int sja1105_init_mii_settings(struct sja1105_private *priv,
/* Even though the SerDes port is able to drive SGMII autoneg
* like a PHY would, from the perspective of the XMII tables,
* the SGMII port should always be put in MAC mode.
+ * Similarly, RGMII is a symmetric protocol electrically
+ * speaking, and the 'RGMII PHY' role does not mean anything to
+ * hardware. Just keep the 'PHY role' notation relevant to the
+ * driver to mean 'the switch port should apply RGMII delays',
+ * but unconditionally put the port in the MAC role.
*/
- if (ports[i].phy_mode == PHY_INTERFACE_MODE_SGMII)
+ if (ports[i].phy_mode == PHY_INTERFACE_MODE_SGMII ||
+ phy_interface_mode_is_rgmii(ports[i].phy_mode))
mii->phy_mac[i] = XMII_MAC;
else
mii->phy_mac[i] = ports[i].role;