Skip to content

Commit 9b23203

Browse files
geertudavem330
authored andcommitted
ravb: Mask PHY mode to avoid inserting delays twice
Until recently, the Micrel KSZ9031 PHY driver ignored any PHY mode ("RGMII-*ID") settings, but used the hardware defaults, augmented by explicit configuration of individual skew values using the "*-skew-ps" DT properties. The lack of PHY mode support was compensated by the EtherAVB MAC driver, which configures TX and/or RX internal delay itself, based on the PHY mode. However, now the KSZ9031 driver has gained PHY mode support, delays may be configured twice, causing regressions. E.g. on the Renesas Salvator-X board with R-Car M3-W ES1.0, TX performance dropped from ca. 400 Mbps to 0.1-0.3 Mbps, as measured by nuttcp. As internal delay configuration supported by the KSZ9031 PHY is too limited for some use cases, the ability to configure MAC internal delay is deemed useful and necessary. Hence a proper fix would involve splitting internal delay configuration in two parts, one for the PHY, and one for the MAC. However, this would require adding new DT properties, thus breaking DTB backwards-compatibility. Hence fix the regression in a backwards-compatibility way, by letting the EtherAVB driver mask the PHY mode when it has inserted a delay, to avoid the PHY driver adding a second delay. This also fixes messages like: Micrel KSZ9031 Gigabit PHY e6800000.ethernet-ffffffff:00: *-skew-ps values should be used only with phy-mode = "rgmii" as the PHY no longer sees the original RGMII-*ID mode. Solving the issue by splitting configuration in two parts can be handled in future patches, and would require retaining a backwards-compatibility mode anyway. Fixes: bcf3440 ("net: phy: micrel: add phy-mode support for the KSZ9031 PHY") Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e8c867c commit 9b23203

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ static int ravb_phy_init(struct net_device *ndev)
10141014
struct ravb_private *priv = netdev_priv(ndev);
10151015
struct phy_device *phydev;
10161016
struct device_node *pn;
1017+
phy_interface_t iface;
10171018
int err;
10181019

10191020
priv->link = 0;
@@ -1032,8 +1033,13 @@ static int ravb_phy_init(struct net_device *ndev)
10321033
}
10331034
pn = of_node_get(np);
10341035
}
1035-
phydev = of_phy_connect(ndev, pn, ravb_adjust_link, 0,
1036-
priv->phy_interface);
1036+
1037+
iface = priv->phy_interface;
1038+
if (priv->chip_id != RCAR_GEN2 && phy_interface_mode_is_rgmii(iface)) {
1039+
/* ravb_set_delay_mode() takes care of internal delay mode */
1040+
iface = PHY_INTERFACE_MODE_RGMII;
1041+
}
1042+
phydev = of_phy_connect(ndev, pn, ravb_adjust_link, 0, iface);
10371043
of_node_put(pn);
10381044
if (!phydev) {
10391045
netdev_err(ndev, "failed to connect PHY\n");

0 commit comments

Comments
 (0)