switch (eth_if) { case DPMAC_ETH_IF_RGMII:
*if_mode = PHY_INTERFACE_MODE_RGMII; break; case DPMAC_ETH_IF_USXGMII:
*if_mode = PHY_INTERFACE_MODE_USXGMII; break; case DPMAC_ETH_IF_QSGMII:
*if_mode = PHY_INTERFACE_MODE_QSGMII; break; case DPMAC_ETH_IF_SGMII:
*if_mode = PHY_INTERFACE_MODE_SGMII; break; case DPMAC_ETH_IF_XFI:
*if_mode = PHY_INTERFACE_MODE_10GBASER; break; case DPMAC_ETH_IF_CAUI:
*if_mode = PHY_INTERFACE_MODE_25GBASER; break; default: return -EINVAL;
}
return 0;
}
staticenum dpmac_eth_if dpmac_eth_if_mode(phy_interface_t if_mode)
{ switch (if_mode) { case PHY_INTERFACE_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_TXID: return DPMAC_ETH_IF_RGMII; case PHY_INTERFACE_MODE_USXGMII: return DPMAC_ETH_IF_USXGMII; case PHY_INTERFACE_MODE_QSGMII: return DPMAC_ETH_IF_QSGMII; case PHY_INTERFACE_MODE_SGMII: return DPMAC_ETH_IF_SGMII; case PHY_INTERFACE_MODE_10GBASER: return DPMAC_ETH_IF_XFI; case PHY_INTERFACE_MODE_1000BASEX: return DPMAC_ETH_IF_1000BASEX; case PHY_INTERFACE_MODE_25GBASER: return DPMAC_ETH_IF_CAUI; default: return DPMAC_ETH_IF_MII;
}
}
fwnode = dev_fwnode(dev->parent); if (is_of_node(fwnode)) {
dpmacs = of_find_node_by_name(NULL, "dpmacs"); if (!dpmacs) return NULL;
parent = of_fwnode_handle(dpmacs);
} elseif (is_acpi_node(fwnode)) {
parent = fwnode;
} else { /* The root dprc device didn't yet get to finalize it's probe, * thus the fwnode field is not yet set. Defer probe if we are * facing this situation.
*/
dev_dbg(dev, "dprc not finished probing\n"); return ERR_PTR(-EPROBE_DEFER);
}
/* This happens only if we support changing of protocol at runtime */
err = dpmac_set_protocol(mac->mc_io, 0, mac->mc_dev->mc_handle,
dpmac_eth_if_mode(state->interface)); if (err)
netdev_err(mac->net_dev, "dpmac_set_protocol() = %d\n", err);
node = fwnode_find_reference(dpmac_node, "pcs-handle", 0); if (IS_ERR(node)) { /* do not error out on old DTS files */
netdev_warn(mac->net_dev, "pcs-handle node not found\n"); return 0;
}
if (phylink_pcs) {
lynx_pcs_destroy(phylink_pcs);
mac->pcs = NULL;
}
}
staticvoid dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac)
{ int intf, err;
/* We support the current interface mode, and if we have a PCS * similar interface modes that do not require the SerDes lane to be * reconfigured.
*/
__set_bit(mac->if_mode, mac->phylink_config.supported_interfaces); if (mac->pcs) { switch (mac->if_mode) { case PHY_INTERFACE_MODE_1000BASEX: case PHY_INTERFACE_MODE_SGMII:
__set_bit(PHY_INTERFACE_MODE_1000BASEX,
mac->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_SGMII,
mac->phylink_config.supported_interfaces); break;
default: break;
}
}
if (!mac->serdes_phy) return;
/* In case we have access to the SerDes phy/lane, then ask the SerDes * driver what interfaces are supported based on the current PLL * configuration.
*/ for (intf = 0; intf < PHY_INTERFACE_MODE_MAX; intf++) { if (intf == PHY_INTERFACE_MODE_NA) continue;
err = phy_validate(mac->serdes_phy, PHY_MODE_ETHERNET, intf, NULL); if (err) continue;
/* The MAC does not have the capability to add RGMII delays so * error out if the interface mode requests them and there is no PHY * to act upon them
*/ if (of_phy_is_fixed_link(to_of_node(dpmac_node)) &&
(mac->if_mode == PHY_INTERFACE_MODE_RGMII_ID ||
mac->if_mode == PHY_INTERFACE_MODE_RGMII_RXID ||
mac->if_mode == PHY_INTERFACE_MODE_RGMII_TXID)) {
netdev_err(net_dev, "RGMII delay not supported\n"); return -EINVAL;
}
/* Find the device node representing the MAC device and link the device * behind the associated netdev to it.
*/
fw_node = dpaa2_mac_get_node(&mac->mc_dev->dev, mac->attr.id); if (IS_ERR(fw_node)) {
err = PTR_ERR(fw_node); goto err_close_dpmac;
}
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.