if (phydev->autoneg)
phy_get_pause(phydev, &tx_pause, &rx_pause);
if (!tx_pause)
cmd_bits |= CMD_TX_PAUSE_IGNORE; if (!rx_pause)
cmd_bits |= CMD_RX_PAUSE_IGNORE;
}
/* Manual override */ if (!priv->rx_pause)
cmd_bits |= CMD_RX_PAUSE_IGNORE; if (!priv->tx_pause)
cmd_bits |= CMD_TX_PAUSE_IGNORE;
}
/* Program UMAC and RGMII block based on established *linkspeed,duplex,andpause.Thespeedsetin *umac->cmdtellRGMIIblockwhichclocktousefor *transmit--25MHz(100Mbps)or125MHz(1Gbps). *ReceiveclockisprovidedbythePHY.
*/
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
reg |= RGMII_LINK;
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
/* setup netdev link state when PHY link status change and *updateUMACandRGMIIblockwhenlinkup
*/ void bcmgenet_mii_setup(struct net_device *dev)
{ struct bcmgenet_priv *priv = netdev_priv(dev); struct phy_device *phydev = dev->phydev;
u32 reg;
/* EXT_GPHY_CTRL is only valid for GENETv4 and onward */ if (GENET_IS_V4(priv) || bcmgenet_has_ephy_16nm(priv)) {
reg = bcmgenet_ext_readl(priv, EXT_GPHY_CTRL); if (enable) {
reg &= ~EXT_CK25_DIS;
bcmgenet_ext_writel(priv, reg, EXT_GPHY_CTRL);
mdelay(1);
case PHY_INTERFACE_MODE_REVMII:
phy_name = "external RvMII"; /* of_mdiobus_register took care of reading the 'max-speed' *PHYpropertyforus,effectivelylimitingthePHYsupported *capabilities,usethatknowledgetoalsoconfigurethe *ReverseMIIinterfacecorrectly.
*/ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
dev->phydev->supported))
port_ctrl = PORT_MODE_EXT_RVMII_50; else
port_ctrl = PORT_MODE_EXT_RVMII_25; break;
case PHY_INTERFACE_MODE_RGMII: /* RGMII_NO_ID: TXC transitions at the same time as TXD *(requiresPCBorreceiver-sidedelay) * *IDisimplicitlydisabledfor100Mbps(RG)MIIoperation.
*/
phy_name = "external RGMII (no delay)";
id_mode_dis = BIT(16);
port_ctrl = PORT_MODE_EXT_GPHY; break;
unimacbus = mdio_find_bus(mdio_bus_id); if (!unimacbus) {
pr_err("Unable to find mii\n"); return -ENODEV;
}
phydev = phy_find_first(unimacbus);
put_device(&unimacbus->dev); if (!phydev) {
pr_err("Unable to find PHY\n"); return -ENODEV;
}
} else {
phydev = dev->phydev;
}
phydev->dev_flags = phy_flags;
ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
phy_iface); if (ret) {
pr_err("could not attach to PHY\n"); return -ENODEV;
}
}
/* Configure port multiplexer based on what the probed PHY device since *readingthe'max-speed'propertydeterminesthemaximumsupported *PHYspeedwhichisneededforbcmgenet_mii_config()toconfigure *thingsappropriately.
*/
ret = bcmgenet_mii_config(dev, true); if (ret) {
phy_disconnect(dev->phydev); return ret;
}
/* The internal PHY has its link interrupts routed to the *EthernetMACISRs.OnGENETv5thereisahardwareissue *thatpreventsthesignalingoflinkUPinterruptswhen *thelinkoperatesat10Mbps,sofallbacktopollingfor *thoseversionsofGENET.
*/ if (priv->internal_phy && !GENET_IS_V5(priv))
dev->phydev->irq = PHY_MAC_INTERRUPT;
/* Indicate that the MAC is responsible for PHY PM */
dev->phydev->mac_managed_pm = true;
ppd.wait_func = bcmgenet_mii_wait;
ppd.wait_func_data = priv;
ppd.bus_name = "bcmgenet MII bus"; /* Pass a reference to our "main" clock which is used for MDIO *transfers
*/
ppd.clk = priv->clk;
/* We need to specifically look up whether this PHY interface is *internalornot*before*weeventrytoprobethePHYdriver *overMDIOaswemayhaveshutdowntheinternalPHYforpower *savingpurposes.
*/ if (priv->phy_interface == PHY_INTERFACE_MODE_INTERNAL)
priv->internal_phy = true;
/* In the case of a fixed PHY, the DT node associated *tothePHYistheEthernetMACDTnode.
*/ if (!priv->phy_dn && of_phy_is_fixed_link(dn)) {
ret = of_phy_register_fixed_link(dn); if (ret) return ret;
priv->phy_dn = of_node_get(dn);
}
/* Get the link mode */
ret = bcmgenet_phy_interface_init(priv); if (ret) return ret;
/* Make sure we initialize MoCA PHYs with a link down */ if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
phydev = of_phy_find_device(dn); if (phydev) {
phydev->link = 0;
put_device(&phydev->mdio.dev);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.