Since commit d99b408ed8e5 ("net: phy: fixed_phy: remove not needed initialization of phy_device members"), fixed_phy_register() no longer copies the fixed-link state into the new phy_device, phylib fills it in once the PHY state machine runs. EMAC never attaches or starts the fixed PHY. emac_init_phy() copies phydev->speed and phydev->duplex right after registering it, so it now gets SPEED_UNKNOWN and DUPLEX_UNKNOWN and emac_configure() programs the MAC and RGMII bridge for 10 Mbps half duplex. On the Meraki MX60, whose EMAC has a 1000 Mbps RGMII fixed-link to a QCA8327 switch, every transmitted frame reports carrier loss, the switch CPU port counts FCS errors and nothing is received. Take the fixed-link parameters from the device tree, in both the "fixed-link" subnode and the legacy property form. Fixes: d99b408ed8e5 ("net: phy: fixed_phy: remove not needed initialization of phy_device members") Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 36 +++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 9fa18ad99f4d..f097b6e49eeb 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -2696,6 +2696,40 @@ static int emac_dt_phy_probe(struct emac_instance *dev) return res; } +/* The fixed PHY is never started, so phylib never fills in its link state. + * Take the link parameters straight from the device tree. + */ +static void emac_fixed_link_state(struct emac_instance *dev, + struct device_node *np) +{ + struct device_node *fixed_link; + u32 prop[5]; + + dev->phy.autoneg = AUTONEG_DISABLE; + dev->phy.advertising = 0; + + fixed_link = of_get_child_by_name(np, "fixed-link"); + if (fixed_link) { + u32 speed = SPEED_UNKNOWN; + + of_property_read_u32(fixed_link, "speed", &speed); + dev->phy.speed = speed; + dev->phy.duplex = of_property_read_bool(fixed_link, "full-duplex") ? + DUPLEX_FULL : DUPLEX_HALF; + dev->phy.pause = of_property_read_bool(fixed_link, "pause"); + dev->phy.asym_pause = of_property_read_bool(fixed_link, + "asym-pause"); + of_node_put(fixed_link); + } else if (!of_property_read_u32_array(np, "fixed-link", prop, + ARRAY_SIZE(prop))) { + /* legacy */ + dev->phy.duplex = prop[1] ? DUPLEX_FULL : DUPLEX_HALF; + dev->phy.speed = prop[2]; + dev->phy.pause = prop[3]; + dev->phy.asym_pause = prop[4]; + } +} + static int emac_init_phy(struct emac_instance *dev) { struct device_node *np = dev->ofdev->dev.of_node; @@ -2730,7 +2764,7 @@ static int emac_init_phy(struct emac_instance *dev) ndev->phydev = of_phy_find_device(np); if (res || !ndev->phydev) return res ? res : -EINVAL; - emac_adjust_link(dev->ndev); + emac_fixed_link_state(dev, np); put_device(&ndev->phydev->mdio.dev); } return 0; -- 2.56.0