Lines Matching +full:10 +full:g +full:- +full:usgmii

1 // SPDX-License-Identifier: GPL-2.0
4 * technologies such as SFP cages where the PHY is hot-pluggable.
44 * struct phylink - internal data type for phylink
61 u8 link_port; /* The current non-phy ethtool port */
103 if ((pl)->config->type == PHYLINK_NETDEV) \
104 netdev_printk(level, (pl)->netdev, fmt, ##__VA_ARGS__); \
105 else if ((pl)->config->type == PHYLINK_DEV) \
106 dev_printk(level, (pl)->dev, fmt, ##__VA_ARGS__); \
118 if ((pl)->config->type == PHYLINK_NETDEV) \
119 netdev_dbg((pl)->netdev, fmt, ##__VA_ARGS__); \
120 else if ((pl)->config->type == PHYLINK_DEV) \
121 dev_dbg((pl)->dev, fmt, ##__VA_ARGS__); \
148 * phylink_set_port_modes() - set the port type modes in the ethtool mask
198 return "inband,an-enabled";
200 return "inband,an-disabled";
224 * phylink_interface_max_speed() - get the maximum speed of a phy interface
295 * phylink_caps_to_linkmodes() - Convert capabilities to ethtool link modes
472 * phylink_limit_mac_speed - limit the phylink_config to a maximum speed
485 config->mac_capabilities &= ~phylink_caps_params[i].mask;
490 * phylink_cap_from_speed_duplex - Get mac capability from speed/duplex
514 * phylink_get_capabilities() - get capabilities for a given MAC
650 * phylink_validate_mask_caps() - Restrict link modes based on caps
668 caps = phylink_get_capabilities(state->interface, mac_capabilities,
669 state->rate_matching);
673 linkmode_and(state->advertising, state->advertising, mask);
685 if (pl->mac_ops->mac_select_pcs) {
686 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
696 if (!pcs->ops) {
698 phy_modes(state->interface));
700 return -EINVAL;
707 if (!phy_interface_empty(pcs->supported_interfaces) &&
708 !test_bit(state->interface, pcs->supported_interfaces)) {
710 phy_modes(state->interface));
711 return -EINVAL;
715 if (pcs->ops->pcs_validate) {
716 ret = pcs->ops->pcs_validate(pcs, supported, state);
718 return -EINVAL;
723 linkmode_and(state->advertising, state->advertising,
729 if (pl->mac_ops->mac_get_caps)
730 capabilities = pl->mac_ops->mac_get_caps(pl->config,
731 state->interface);
733 capabilities = pl->config->mac_capabilities;
737 return phylink_is_empty_linkmode(supported) ? -EINVAL : 0;
784 linkmode_copy(state->advertising, all_adv);
786 return phylink_is_empty_linkmode(supported) ? -EINVAL : 0;
792 const unsigned long *interfaces = pl->config->supported_interfaces;
794 if (state->interface == PHY_INTERFACE_MODE_NA)
798 if (!test_bit(state->interface, interfaces))
799 return -EINVAL;
814 fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
818 pl->link_config.speed = speed;
819 pl->link_config.duplex = DUPLEX_HALF;
821 if (fwnode_property_read_bool(fixed_node, "full-duplex"))
822 pl->link_config.duplex = DUPLEX_FULL;
824 /* We treat the "pause" and "asym-pause" terminology as
829 pl->link_config.lp_advertising);
830 if (fwnode_property_read_bool(fixed_node, "asym-pause"))
832 pl->link_config.lp_advertising);
839 pl->link_gpio = desc;
840 else if (desc == ERR_PTR(-EPROBE_DEFER))
841 ret = -EPROBE_DEFER;
850 ret = fwnode_property_read_u32_array(fwnode, "fixed-link",
853 phylink_err(pl, "broken fixed-link?\n");
854 return -EINVAL;
857 ret = fwnode_property_read_u32_array(fwnode, "fixed-link",
860 pl->link_config.duplex = prop[1] ?
862 pl->link_config.speed = prop[2];
865 pl->link_config.lp_advertising);
868 pl->link_config.lp_advertising);
872 if (pl->link_config.speed > SPEED_1000 &&
873 pl->link_config.duplex != DUPLEX_FULL)
875 pl->link_config.speed);
877 linkmode_fill(pl->supported);
878 linkmode_copy(pl->link_config.advertising, pl->supported);
879 phylink_validate(pl, pl->supported, &pl->link_config);
881 s = phy_lookup_setting(pl->link_config.speed, pl->link_config.duplex,
882 pl->supported, true);
887 linkmode_and(pl->supported, pl->supported, mask);
889 phylink_set(pl->supported, MII);
892 __set_bit(s->bit, pl->supported);
893 __set_bit(s->bit, pl->link_config.lp_advertising);
896 pl->link_config.duplex == DUPLEX_FULL ? "full" : "half",
897 pl->link_config.speed);
900 linkmode_and(pl->link_config.advertising, pl->link_config.advertising,
901 pl->supported);
903 pl->link_config.link = 1;
904 pl->link_config.an_complete = 1;
916 if (pl->config->default_an_inband)
917 pl->cfg_link_an_mode = MLO_AN_INBAND;
919 dn = fwnode_get_named_child_node(fwnode, "fixed-link");
920 if (dn || fwnode_property_present(fwnode, "fixed-link"))
921 pl->cfg_link_an_mode = MLO_AN_FIXED;
925 strcmp(managed, "in-band-status") == 0)) {
926 if (pl->cfg_link_an_mode == MLO_AN_FIXED) {
928 "can't use both fixed-link and in-band-status\n");
929 return -EINVAL;
932 pl->cfg_link_an_mode = MLO_AN_INBAND;
935 if (pl->cfg_link_an_mode == MLO_AN_INBAND) {
936 linkmode_zero(pl->supported);
937 phylink_set(pl->supported, MII);
938 phylink_set(pl->supported, Autoneg);
939 phylink_set(pl->supported, Asym_Pause);
940 phylink_set(pl->supported, Pause);
942 switch (pl->link_config.interface) {
962 caps = phylink_get_capabilities(pl->link_config.interface, caps,
964 phylink_caps_to_linkmodes(pl->supported, caps);
969 "incorrect link mode %s for in-band status\n",
970 phy_modes(pl->link_config.interface));
971 return -EINVAL;
974 linkmode_copy(pl->link_config.advertising, pl->supported);
976 if (phylink_validate(pl, pl->supported, &pl->link_config)) {
978 "failed to validate link configuration for in-band status\n");
979 return -EINVAL;
991 state->advertising))
992 state->pause &= ~MLO_PAUSE_AN;
995 if (!(pl->link_config.pause & MLO_PAUSE_AN))
996 state->pause = pl->link_config.pause;
1003 if (state->duplex == DUPLEX_FULL) {
1004 linkmode_resolve_pause(state->advertising,
1005 state->lp_advertising,
1008 state->pause |= MLO_PAUSE_TX;
1010 state->pause |= MLO_PAUSE_RX;
1017 if (pcs && pcs->ops->pcs_inband_caps)
1018 return pcs->ops->pcs_inband_caps(pcs, interface);
1026 if (pcs && pcs->ops->pcs_pre_config)
1027 pcs->ops->pcs_pre_config(pcs, interface);
1035 if (pcs && pcs->ops->pcs_post_config)
1036 err = pcs->ops->pcs_post_config(pcs, interface);
1043 if (pcs && pcs->ops->pcs_disable)
1044 pcs->ops->pcs_disable(pcs);
1051 if (pcs && pcs->ops->pcs_enable)
1052 err = pcs->ops->pcs_enable(pcs);
1064 return pcs->ops->pcs_config(pcs, neg_mode, state->interface,
1065 state->advertising, permit_pause_to_mac);
1072 if (pcs && pcs->ops->pcs_link_up)
1073 pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex);
1084 if (!pl->mac_ops->mac_select_pcs)
1087 pcs = pl->mac_ops->mac_select_pcs(pl->config, interface);
1096 if (pl->cfg_link_an_mode == MLO_AN_INBAND)
1097 del_timer(&pl->link_poll);
1102 if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND)
1103 mod_timer(&pl->link_poll, jiffies + HZ);
1111 if (pl->config->mac_requires_rxc)
1112 pcs->rxc_always_on = true;
1114 if (pcs->ops->pcs_pre_init)
1115 ret = pcs->ops->pcs_pre_init(pcs);
1135 __func__, phylink_an_mode_str(pl->act_link_an_mode),
1141 pl->mac_ops->mac_config(pl->config, pl->act_link_an_mode, &st);
1146 if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
1147 pl->link_config.advertising) &&
1148 phy_interface_mode_is_8023z(pl->link_config.interface) &&
1149 phylink_autoneg_inband(pl->act_link_an_mode))
1150 pl->pcs->ops->pcs_an_restart(pl->pcs);
1154 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
1163 * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
1164 * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
1166 * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
1168 * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
1171 * (e.g. Clause 37, SGMII and similar) not Clause 73.
1185 mode = pl->req_link_an_mode;
1187 pl->phy_ib_mode = 0;
1205 /* 1000base-X is designed for use media-side for Fibre
1207 * taken into account. We also do this for 2500base-X
1215 pl->pcs_neg_mode = PHYLINK_PCS_NEG_NONE;
1216 pl->act_link_an_mode = mode;
1223 if (pl->phydev)
1224 phy_ib_caps = phy_inband_caps(pl->phydev, interface);
1234 /* PCS supports reporting in-band capabilities, and
1244 /* PHY supports in-band capabilities, and supports
1248 pl->phy_ib_mode = LINK_INBAND_DISABLE;
1250 pl->phy_ib_mode = LINK_INBAND_BYPASS;
1268 } else if (type == INBAND_CISCO_SGMII || pl->phydev) {
1270 * Base-X with a PHY, we try to use in-band mode where-ever
1271 * possible. However, there are some PHYs e.g. BCM84881 which
1272 * do not support in-band.
1299 /* In-band supported or unknown at both ends. Enable
1300 * in-band mode with or without bypass at the PHY.
1303 pl->phy_ib_mode = LINK_INBAND_ENABLE;
1305 pl->phy_ib_mode = LINK_INBAND_BYPASS;
1310 /* Either in-band not supported at at least one end.
1311 * In-band bypass at the other end is possible.
1314 pl->phy_ib_mode = LINK_INBAND_DISABLE;
1316 pl->phy_ib_mode = LINK_INBAND_BYPASS;
1319 if (pl->phydev)
1323 phylink_warn(pl, "%s: incompatible in-band capabilities, trying in-band",
1328 /* For Base-X without a PHY */
1346 pl->pcs_neg_mode = neg_mode;
1347 pl->act_link_an_mode = mode;
1360 phylink_an_mode_str(pl->req_link_an_mode),
1361 phy_modes(state->interface));
1363 if (pl->mac_ops->mac_select_pcs) {
1364 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
1372 pcs_changed = pl->pcs != pcs;
1375 phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising);
1378 phylink_an_mode_str(pl->act_link_an_mode),
1379 phylink_pcs_mode_str(pl->pcs_neg_mode),
1380 phy_modes(state->interface));
1384 if (pl->mac_ops->mac_prepare) {
1385 err = pl->mac_ops->mac_prepare(pl->config, pl->act_link_an_mode,
1386 state->interface);
1398 phylink_pcs_disable(pl->pcs);
1400 if (pl->pcs)
1401 pl->pcs->phylink = NULL;
1403 pcs->phylink = pl;
1405 pl->pcs = pcs;
1408 if (pl->pcs)
1409 phylink_pcs_pre_config(pl->pcs, state->interface);
1413 if (pl->pcs)
1414 phylink_pcs_post_config(pl->pcs, state->interface);
1416 if (pl->pcs_state == PCS_STATE_STARTING || pcs_changed)
1417 phylink_pcs_enable(pl->pcs);
1419 neg_mode = pl->act_link_an_mode;
1420 if (pl->pcs && pl->pcs->neg_mode)
1421 neg_mode = pl->pcs_neg_mode;
1423 err = phylink_pcs_config(pl->pcs, neg_mode, state,
1424 !!(pl->link_config.pause & MLO_PAUSE_AN));
1434 if (pl->mac_ops->mac_finish) {
1435 err = pl->mac_ops->mac_finish(pl->config, pl->act_link_an_mode,
1436 state->interface);
1442 if (pl->phydev && pl->phy_ib_mode) {
1443 err = phy_config_inband(pl->phydev, pl->phy_ib_mode);
1449 if (pl->sfp_bus) {
1450 rate_kbd = phylink_interface_signal_rate(state->interface);
1452 sfp_upstream_set_signal_rate(pl->sfp_bus, rate_kbd);
1469 if (test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state))
1473 phylink_an_mode_str(pl->req_link_an_mode),
1474 phy_modes(pl->link_config.interface),
1475 __ETHTOOL_LINK_MODE_MASK_NBITS, pl->link_config.advertising,
1476 pl->link_config.pause);
1479 phylink_pcs_neg_mode(pl, pl->pcs, pl->link_config.interface,
1480 pl->link_config.advertising);
1482 neg_mode = pl->act_link_an_mode;
1483 if (pl->pcs->neg_mode)
1484 neg_mode = pl->pcs_neg_mode;
1486 /* Modern PCS-based method; update the advert at the PCS, and
1490 ret = phylink_pcs_config(pl->pcs, neg_mode, &pl->link_config,
1491 !!(pl->link_config.pause & MLO_PAUSE_AN));
1507 linkmode_copy(state->advertising, pl->link_config.advertising);
1508 linkmode_zero(state->lp_advertising);
1509 state->interface = pl->link_config.interface;
1510 state->rate_matching = pl->link_config.rate_matching;
1511 state->an_complete = 0;
1512 state->link = 1;
1514 pcs = pl->pcs;
1515 if (!pcs || pcs->neg_mode)
1516 autoneg = pl->pcs_neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
1519 state->advertising);
1522 state->speed = SPEED_UNKNOWN;
1523 state->duplex = DUPLEX_UNKNOWN;
1524 state->pause = MLO_PAUSE_NONE;
1526 state->speed = pl->link_config.speed;
1527 state->duplex = pl->link_config.duplex;
1528 state->pause = pl->link_config.pause;
1532 pcs->ops->pcs_get_state(pcs, pl->pcs_neg_mode, state);
1534 state->link = 0;
1543 *state = pl->link_config;
1544 if (pl->config->get_fixed_state)
1545 pl->config->get_fixed_state(pl->config, state);
1546 else if (pl->link_gpio)
1547 state->link = !!gpiod_get_value_cansleep(pl->link_gpio);
1549 state->pause = MLO_PAUSE_NONE;
1557 switch (pl->req_link_an_mode) {
1559 link_state = pl->phy_state;
1567 link_state = pl->link_config;
1598 if (pl->mac_enable_tx_lpi) {
1599 pl->mac_enable_tx_lpi = false;
1603 pl->mac_ops->mac_disable_tx_lpi(pl->config);
1611 if (!test_bit(pl->cur_interface, pl->config->lpi_interfaces)) {
1613 phy_modes(pl->cur_interface));
1618 pl->mac_tx_lpi_timer, pl->mac_tx_clk_stop);
1620 err = pl->mac_ops->mac_enable_tx_lpi(pl->config, pl->mac_tx_lpi_timer,
1621 pl->mac_tx_clk_stop);
1623 pl->mac_enable_tx_lpi = true;
1626 pl->mac_ops->mac_enable_tx_lpi, ERR_PTR(err));
1632 struct net_device *ndev = pl->netdev;
1662 pl->cur_interface = link_state.interface;
1664 neg_mode = pl->act_link_an_mode;
1665 if (pl->pcs && pl->pcs->neg_mode)
1666 neg_mode = pl->pcs_neg_mode;
1668 phylink_pcs_link_up(pl->pcs, neg_mode, pl->cur_interface, speed,
1671 pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->act_link_an_mode,
1672 pl->cur_interface, speed, duplex,
1675 if (pl->mac_supports_eee && pl->phy_enable_tx_lpi)
1682 "Link is Up - %s/%s - flow control %s\n",
1690 struct net_device *ndev = pl->netdev;
1697 pl->mac_ops->mac_link_down(pl->config, pl->act_link_an_mode,
1698 pl->cur_interface);
1704 return pl->netdev ? netif_carrier_ok(pl->netdev) : pl->old_link_state;
1715 mutex_lock(&pl->state_mutex);
1718 if (pl->phylink_disable_state) {
1719 pl->link_failed = false;
1721 } else if (pl->link_failed) {
1724 } else if (pl->act_link_an_mode == MLO_AN_FIXED) {
1727 } else if (pl->act_link_an_mode == MLO_AN_PHY) {
1728 link_state = pl->phy_state;
1733 /* The PCS may have a latching link-fail indicator. If the link
1734 * was up, bring the link down and re-trigger the resolve.
1735 * Otherwise, re-read the PCS state to get the current status
1748 if (pl->phydev)
1749 link_state.link &= pl->phy_state.link;
1752 if (pl->phydev && pl->phy_state.link) {
1754 * event if the link isn't already down, and re-resolve.
1756 if (link_state.interface != pl->phy_state.interface) {
1761 link_state.interface = pl->phy_state.interface;
1766 if (pl->phy_state.rate_matching) {
1768 pl->phy_state.rate_matching;
1769 link_state.speed = pl->phy_state.speed;
1770 link_state.duplex = pl->phy_state.duplex;
1776 link_state.pause = pl->phy_state.pause;
1781 if (pl->act_link_an_mode != MLO_AN_FIXED)
1785 if (link_state.interface != pl->link_config.interface) {
1794 pl->link_config.interface = link_state.interface;
1799 pl->old_link_state = link_state.link;
1806 pl->link_failed = false;
1807 queue_work(system_power_efficient_wq, &pl->resolve);
1809 mutex_unlock(&pl->state_mutex);
1814 if (!pl->phylink_disable_state)
1815 queue_work(system_power_efficient_wq, &pl->resolve);
1820 unsigned long state = pl->phylink_disable_state;
1822 set_bit(bit, &pl->phylink_disable_state);
1824 queue_work(system_power_efficient_wq, &pl->resolve);
1825 flush_work(&pl->resolve);
1831 clear_bit(bit, &pl->phylink_disable_state);
1861 pl->sfp_bus = bus;
1870 * phylink_set_fixed_link() - set the fixed link
1885 if (pl->cfg_link_an_mode != MLO_AN_PHY || !state ||
1886 !test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state))
1887 return -EINVAL;
1889 s = phy_lookup_setting(state->speed, state->duplex,
1890 pl->supported, true);
1892 return -EINVAL;
1894 adv = pl->link_config.advertising;
1896 linkmode_set_bit(s->bit, adv);
1899 pl->link_config.speed = state->speed;
1900 pl->link_config.duplex = state->duplex;
1901 pl->link_config.link = 1;
1902 pl->link_config.an_complete = 1;
1904 pl->cfg_link_an_mode = MLO_AN_FIXED;
1905 pl->req_link_an_mode = pl->cfg_link_an_mode;
1912 * phylink_create() - create a phylink instance
1920 * This will parse in-band modes, fixed-link or SFP configuration.
1924 * Returns a pointer to a &struct phylink, or an error-pointer value. Users
1936 if (phy_interface_empty(config->supported_interfaces)) {
1937 dev_err(config->dev,
1939 return ERR_PTR(-EINVAL);
1944 return ERR_PTR(-ENOMEM);
1946 mutex_init(&pl->state_mutex);
1947 INIT_WORK(&pl->resolve, phylink_resolve);
1949 pl->config = config;
1950 if (config->type == PHYLINK_NETDEV) {
1951 pl->netdev = to_net_dev(config->dev);
1952 netif_carrier_off(pl->netdev);
1953 } else if (config->type == PHYLINK_DEV) {
1954 pl->dev = config->dev;
1957 return ERR_PTR(-EINVAL);
1960 pl->mac_supports_eee_ops = mac_ops->mac_disable_tx_lpi &&
1961 mac_ops->mac_enable_tx_lpi;
1962 pl->mac_supports_eee = pl->mac_supports_eee_ops &&
1963 pl->config->lpi_capabilities &&
1964 !phy_interface_empty(pl->config->lpi_interfaces);
1967 pl->eee_cfg.eee_enabled = pl->config->eee_enabled_default;
1968 pl->eee_cfg.tx_lpi_enabled = pl->eee_cfg.eee_enabled;
1969 pl->eee_cfg.tx_lpi_timer = pl->config->lpi_timer_default;
1971 pl->phy_state.interface = iface;
1972 pl->link_interface = iface;
1974 pl->link_port = PORT_BNC;
1976 pl->link_port = PORT_MII;
1977 pl->link_config.interface = iface;
1978 pl->link_config.pause = MLO_PAUSE_AN;
1979 pl->link_config.speed = SPEED_UNKNOWN;
1980 pl->link_config.duplex = DUPLEX_UNKNOWN;
1981 pl->pcs_state = PCS_STATE_DOWN;
1982 pl->mac_ops = mac_ops;
1983 __set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
1984 timer_setup(&pl->link_poll, phylink_fixed_poll, 0);
1986 linkmode_fill(pl->supported);
1987 linkmode_copy(pl->link_config.advertising, pl->supported);
1988 phylink_validate(pl, pl->supported, &pl->link_config);
1996 if (pl->cfg_link_an_mode == MLO_AN_FIXED) {
2004 pl->req_link_an_mode = pl->cfg_link_an_mode;
2017 * phylink_destroy() - cleanup and destroy the phylink instance
2027 sfp_bus_del_upstream(pl->sfp_bus);
2028 if (pl->link_gpio)
2029 gpiod_put(pl->link_gpio);
2031 cancel_work_sync(&pl->resolve);
2037 * phylink_expects_phy() - Determine if phylink expects a phy to be attached
2040 * When using fixed-link mode, or in-band mode with 1000base-X or 2500base-X,
2047 if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
2048 (pl->cfg_link_an_mode == MLO_AN_INBAND &&
2049 phy_interface_mode_is_8023z(pl->link_config.interface)))
2057 struct phylink *pl = phydev->phylink;
2062 mutex_lock(&pl->state_mutex);
2063 pl->phy_state.speed = phydev->speed;
2064 pl->phy_state.duplex = phydev->duplex;
2065 pl->phy_state.rate_matching = phydev->rate_matching;
2066 pl->phy_state.pause = MLO_PAUSE_NONE;
2068 pl->phy_state.pause |= MLO_PAUSE_TX;
2070 pl->phy_state.pause |= MLO_PAUSE_RX;
2071 pl->phy_state.interface = phydev->interface;
2072 pl->phy_state.link = up;
2074 pl->link_failed = true;
2077 pl->phy_enable_tx_lpi = phydev->enable_tx_lpi;
2078 pl->mac_tx_lpi_timer = phydev->eee_cfg.tx_lpi_timer;
2079 mutex_unlock(&pl->state_mutex);
2085 phy_modes(phydev->interface),
2086 phy_speed_to_str(phydev->speed),
2087 phy_duplex_to_str(phydev->duplex),
2088 phy_rate_matching_to_str(phydev->rate_matching),
2089 phylink_pause_to_str(pl->phy_state.pause),
2090 phydev->enable_tx_lpi ? "" : "no");
2103 if (!phy_interface_empty(phy->possible_interfaces)) {
2107 phy_interface_and(interfaces, phy->possible_interfaces,
2108 pl->config->supported_interfaces);
2112 return -EINVAL;
2124 return -EINVAL;
2131 phy->possible_interfaces,
2144 state->rate_matching = phy_get_rate_matching(phy, state->interface);
2146 /* Clause 45 PHYs may switch their Serdes lane between, e.g. 10GBASE-R,
2147 * 5GBASE-R, 2500BASE-X and SGMII if they are not using rate matching.
2148 * For some interface modes (e.g. RXAUI, XAUI and USXGMII) switching
2153 * linkmodes can be supported. For now, as a work-around, we validate
2157 if (phy->is_c45 && state->rate_matching == RATE_MATCH_NONE &&
2158 state->interface != PHY_INTERFACE_MODE_RXAUI &&
2159 state->interface != PHY_INTERFACE_MODE_XAUI &&
2160 state->interface != PHY_INTERFACE_MODE_USXGMII)
2161 state->interface = PHY_INTERFACE_MODE_NA;
2184 linkmode_copy(supported, phy->supported);
2185 linkmode_copy(config.advertising, phy->advertising);
2192 __ETHTOOL_LINK_MODE_MASK_NBITS, phy->supported,
2198 phy->phylink = pl;
2199 phy->phy_link_change = phylink_phy_change;
2204 dev_name(&phy->mdio.dev), phy->drv->name, irq_str);
2207 mutex_lock(&phy->lock);
2208 mutex_lock(&pl->state_mutex);
2209 pl->phydev = phy;
2210 pl->phy_state.interface = interface;
2211 pl->phy_state.pause = MLO_PAUSE_NONE;
2212 pl->phy_state.speed = SPEED_UNKNOWN;
2213 pl->phy_state.duplex = DUPLEX_UNKNOWN;
2214 pl->phy_state.rate_matching = RATE_MATCH_NONE;
2215 linkmode_copy(pl->supported, supported);
2216 linkmode_copy(pl->link_config.advertising, config.advertising);
2219 linkmode_copy(phy->advertising, config.advertising);
2224 if (pl->mac_supports_eee) {
2229 if (pl->eee_cfg.eee_enabled)
2232 phy->eee_cfg.tx_lpi_enabled = pl->eee_cfg.tx_lpi_enabled;
2233 phy->eee_cfg.tx_lpi_timer = pl->eee_cfg.tx_lpi_timer;
2236 linkmode_zero(pl->supported_lpi);
2237 phylink_caps_to_linkmodes(pl->supported_lpi,
2238 pl->config->lpi_capabilities);
2243 linkmode_and(phy->advertising_eee, phy->advertising_eee,
2244 pl->supported_lpi);
2245 } else if (pl->mac_supports_eee_ops) {
2250 mutex_unlock(&pl->state_mutex);
2251 mutex_unlock(&phy->lock);
2256 __ETHTOOL_LINK_MODE_MASK_NBITS, pl->supported,
2257 __ETHTOOL_LINK_MODE_MASK_NBITS, phy->advertising);
2262 if (pl->config->mac_managed_pm)
2263 phy->mac_managed_pm = true;
2266 pl->mac_tx_clk_stop = phy_eee_tx_clock_stop_capable(phy) > 0;
2271 ret = phy_eee_rx_clock_stop(phy, pl->config->eee_rx_clk_stop_enable);
2272 if (ret == -EOPNOTSUPP)
2283 if (WARN_ON(pl->cfg_link_an_mode == MLO_AN_FIXED ||
2284 (pl->cfg_link_an_mode == MLO_AN_INBAND &&
2285 phy_interface_mode_is_8023z(interface) && !pl->sfp_bus)))
2286 return -EINVAL;
2288 if (pl->phydev)
2289 return -EBUSY;
2291 if (pl->config->mac_requires_rxc)
2294 return phy_attach_direct(pl->netdev, phy, flags, interface);
2298 * phylink_connect_phy() - connect a PHY to the phylink instance
2317 if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
2318 pl->link_interface = phy->interface;
2319 pl->link_config.interface = pl->link_interface;
2322 ret = phylink_attach_phy(pl, phy, pl->link_interface);
2326 ret = phylink_bringup_phy(pl, phy, pl->link_config.interface);
2335 * phylink_of_phy_connect() - connect the PHY specified in the DT mode.
2338 * @flags: PHY-specific flags to communicate to the PHY device driver
2354 * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode.
2357 * @flags: PHY-specific flags to communicate to the PHY device driver
2373 if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
2374 (pl->cfg_link_an_mode == MLO_AN_INBAND &&
2375 phy_interface_mode_is_8023z(pl->link_interface)))
2380 if (pl->cfg_link_an_mode == MLO_AN_PHY)
2381 return -ENODEV;
2389 return -ENODEV;
2392 if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
2393 pl->link_interface = phy_dev->interface;
2394 pl->link_config.interface = pl->link_interface;
2397 if (pl->config->mac_requires_rxc)
2400 ret = phy_attach_direct(pl->netdev, phy_dev, flags,
2401 pl->link_interface);
2406 ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface);
2415 * phylink_disconnect_phy() - disconnect any PHY attached to the phylink
2427 phy = pl->phydev;
2429 mutex_lock(&phy->lock);
2430 mutex_lock(&pl->state_mutex);
2431 pl->phydev = NULL;
2432 pl->phy_enable_tx_lpi = false;
2433 pl->mac_tx_clk_stop = false;
2434 mutex_unlock(&pl->state_mutex);
2435 mutex_unlock(&phy->lock);
2436 flush_work(&pl->resolve);
2446 pl->link_failed = true;
2452 * phylink_mac_change() - notify phylink of a change in MAC state
2466 * phylink_pcs_change() - notify phylink of a change to PCS link state
2471 * (e.g. link failure, new negotiation results, etc.) Note: it should
2474 * the latched link-down state, otherwise pass false.
2478 struct phylink *pl = pcs->phylink;
2495 * phylink_start() - start a phylink instance
2509 phylink_an_mode_str(pl->req_link_an_mode),
2510 phy_modes(pl->link_config.interface));
2513 if (pl->netdev)
2514 netif_carrier_off(pl->netdev);
2516 pl->pcs_state = PCS_STATE_STARTING;
2519 * a fixed-link to start with the correct parameters, and also
2528 pl->pcs_state = PCS_STATE_STARTED;
2532 if (pl->cfg_link_an_mode == MLO_AN_FIXED && pl->link_gpio) {
2533 int irq = gpiod_to_irq(pl->link_gpio);
2540 pl->link_irq = irq;
2548 if (pl->cfg_link_an_mode == MLO_AN_FIXED)
2549 poll |= pl->config->poll_fixed_state;
2552 mod_timer(&pl->link_poll, jiffies + HZ);
2553 if (pl->phydev)
2554 phy_start(pl->phydev);
2555 if (pl->sfp_bus)
2556 sfp_upstream_start(pl->sfp_bus);
2561 * phylink_stop() - stop a phylink instance
2576 if (pl->sfp_bus)
2577 sfp_upstream_stop(pl->sfp_bus);
2578 if (pl->phydev)
2579 phy_stop(pl->phydev);
2580 del_timer_sync(&pl->link_poll);
2581 if (pl->link_irq) {
2582 free_irq(pl->link_irq, pl);
2583 pl->link_irq = 0;
2588 pl->pcs_state = PCS_STATE_DOWN;
2590 phylink_pcs_disable(pl->pcs);
2595 * phylink_suspend() - handle a network device suspend event
2597 * @mac_wol: true if the MAC needs to receive packets for Wake-on-Lan
2601 * - If Wake-on-Lan is not active, we can bring down the link between
2603 * - If Wake-on-Lan is active, and being handled only by the PHY, we
2605 * - If Wake-on-Lan is active, but being handled by the MAC, the MAC
2612 if (mac_wol && (!pl->netdev || pl->netdev->ethtool->wol_enabled)) {
2613 /* Wake-on-Lan enabled, MAC handling */
2614 mutex_lock(&pl->state_mutex);
2617 __set_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state);
2623 if (pl->netdev)
2624 netif_carrier_off(pl->netdev);
2626 pl->old_link_state = false;
2631 mutex_unlock(&pl->state_mutex);
2639 * phylink_resume() - handle a network device resume event
2649 if (test_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state)) {
2650 /* Wake-on-Lan enabled, MAC handling */
2655 * resume, which is harmless - the true link state will be
2658 mutex_lock(&pl->state_mutex);
2660 mutex_unlock(&pl->state_mutex);
2662 /* Re-apply the link parameters so that all the settings get
2667 /* Re-enable and re-resolve the link parameters */
2676 * phylink_ethtool_get_wol() - get the wake on lan parameters for the PHY
2688 wol->supported = 0;
2689 wol->wolopts = 0;
2691 if (pl->phydev)
2692 phy_ethtool_get_wol(pl->phydev, wol);
2697 * phylink_ethtool_set_wol() - set wake on lan parameters
2709 int ret = -EOPNOTSUPP;
2713 if (pl->phydev)
2714 ret = phy_ethtool_set_wol(pl->phydev, wol);
2725 interface = sfp_select_interface(pl->sfp_bus, link_modes);
2734 if (!test_bit(interface, pl->config->supported_interfaces)) {
2739 pl->config->supported_interfaces);
2760 phylink_merge_link_mode(kset->link_modes.advertising, state->advertising);
2761 linkmode_copy(kset->link_modes.lp_advertising, state->lp_advertising);
2762 if (kset->base.rate_matching == RATE_MATCH_NONE) {
2763 kset->base.speed = state->speed;
2764 kset->base.duplex = state->duplex;
2766 kset->base.autoneg = linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
2767 state->advertising) ?
2772 * phylink_ethtool_ksettings_get() - get the current link settings
2787 if (pl->phydev)
2788 phy_ethtool_ksettings_get(pl->phydev, kset);
2790 kset->base.port = pl->link_port;
2792 linkmode_copy(kset->link_modes.supported, pl->supported);
2794 switch (pl->act_link_an_mode) {
2797 * current link settings - and note that these also
2808 if (pl->phydev)
2814 * layer via in-band status. Report these as the current
2846 * phylink_ethtool_ksettings_set() - set the link settings
2859 if (pl->phydev) {
2864 pl->supported);
2867 * to update the pl->link_config settings:
2868 * - the configuration returned via ksettings_get() will come
2870 * - link_config.interface will be updated by the PHY calling
2872 * - initial link configuration for PHY mode comes from the
2874 * - other configuration changes (e.g. pause modes) are
2876 * - if in in-band mode with a PHY, the link configuration
2879 * - the only possible use would be link_config.advertising
2880 * pause modes when in 1000base-X mode with a PHY, but in
2884 return phy_ethtool_ksettings_set(pl->phydev, &phy_kset);
2887 config = pl->link_config;
2889 linkmode_and(config.advertising, kset->link_modes.advertising,
2890 pl->supported);
2893 switch (kset->base.autoneg) {
2898 s = phy_lookup_setting(kset->base.speed, kset->base.duplex,
2899 pl->supported, false);
2901 return -EINVAL;
2906 if (pl->req_link_an_mode == MLO_AN_FIXED) {
2907 if (s->speed != pl->link_config.speed ||
2908 s->duplex != pl->link_config.duplex)
2909 return -EINVAL;
2913 config.speed = s->speed;
2914 config.duplex = s->duplex;
2922 if (pl->req_link_an_mode == MLO_AN_FIXED) {
2924 pl->link_config.advertising))
2925 return -EINVAL;
2934 return -EINVAL;
2938 * fixed-link cases. All that is left are in-band links.
2941 kset->base.autoneg == AUTONEG_ENABLE);
2947 if (pl->sfp_bus) {
2951 return -EINVAL;
2954 linkmode_copy(support, pl->supported);
2957 phylink_an_mode_str(pl->req_link_an_mode),
2960 return -EINVAL;
2964 linkmode_copy(support, pl->supported);
2966 return -EINVAL;
2973 return -EINVAL;
2976 * situation, so the PCS is the media-facing entity.
2980 return -EINVAL;
2982 mutex_lock(&pl->state_mutex);
2983 pl->link_config.speed = config.speed;
2984 pl->link_config.duplex = config.duplex;
2986 if (pl->link_config.interface != config.interface) {
2987 /* The interface changed, e.g. 1000base-X <-> 2500base-X */
2989 if (pl->old_link_state) {
2991 pl->old_link_state = false;
2994 &pl->phylink_disable_state))
2996 pl->link_config.interface = config.interface;
2997 linkmode_copy(pl->link_config.advertising, config.advertising);
2998 } else if (!linkmode_equal(pl->link_config.advertising,
3000 linkmode_copy(pl->link_config.advertising, config.advertising);
3003 mutex_unlock(&pl->state_mutex);
3010 * phylink_ethtool_nway_reset() - restart negotiation
3026 if (pl->phydev)
3027 ret = phy_restart_aneg(pl->phydev);
3035 * phylink_ethtool_get_pauseparam() - get the current pause parameters
3044 pause->autoneg = !!(pl->link_config.pause & MLO_PAUSE_AN);
3045 pause->rx_pause = !!(pl->link_config.pause & MLO_PAUSE_RX);
3046 pause->tx_pause = !!(pl->link_config.pause & MLO_PAUSE_TX);
3051 * phylink_ethtool_set_pauseparam() - set the current pause parameters
3058 struct phylink_link_state *config = &pl->link_config;
3064 if (pl->req_link_an_mode == MLO_AN_FIXED)
3065 return -EOPNOTSUPP;
3067 if (!phylink_test(pl->supported, Pause) &&
3068 !phylink_test(pl->supported, Asym_Pause))
3069 return -EOPNOTSUPP;
3071 if (!phylink_test(pl->supported, Asym_Pause) &&
3072 pause->rx_pause != pause->tx_pause)
3073 return -EINVAL;
3076 if (pause->autoneg)
3078 if (pause->rx_pause)
3080 if (pause->tx_pause)
3083 mutex_lock(&pl->state_mutex);
3097 linkmode_set_pause(config->advertising, pause->tx_pause,
3098 pause->rx_pause);
3100 manual_changed = (config->pause ^ pause_state) & MLO_PAUSE_AN ||
3102 (config->pause ^ pause_state) & MLO_PAUSE_TXRX_MASK);
3104 config->pause = pause_state;
3106 /* Update our in-band advertisement, triggering a renegotiation if
3109 if (!pl->phydev)
3112 mutex_unlock(&pl->state_mutex);
3119 if (pl->phydev)
3120 phy_set_asym_pause(pl->phydev, pause->rx_pause,
3121 pause->tx_pause);
3128 pl->link_failed = true;
3137 * phylink_get_eee_err() - read the energy efficient ethernet error
3152 if (pl->phydev)
3153 ret = phy_get_eee_err(pl->phydev);
3160 * phylink_init_eee() - init and check the EEE features
3168 int ret = -EOPNOTSUPP;
3170 if (pl->phydev)
3171 ret = phy_init_eee(pl->phydev, clk_stop_enable);
3178 * phylink_ethtool_get_eee() - read the energy efficient ethernet parameters
3184 int ret = -EOPNOTSUPP;
3188 if (pl->mac_supports_eee_ops && !pl->mac_supports_eee)
3191 if (pl->phydev) {
3192 ret = phy_ethtool_get_eee(pl->phydev, eee);
3194 if (ret == 0 && pl->mac_supports_eee_ops)
3195 linkmode_and(eee->supported, eee->supported,
3196 pl->supported_lpi);
3204 * phylink_ethtool_set_eee() - set the energy efficient ethernet parameters
3210 bool mac_eee = pl->mac_supports_eee;
3211 int ret = -EOPNOTSUPP;
3217 eee->eee_enabled ? ", enabled" : "",
3218 __ETHTOOL_LINK_MODE_MASK_NBITS, eee->advertised,
3219 eee->tx_lpi_enabled ? " enabled" : "", eee->tx_lpi_timer);
3221 if (pl->mac_supports_eee_ops && !mac_eee)
3224 if (pl->phydev) {
3226 if (pl->mac_supports_eee_ops)
3227 linkmode_and(eee->advertised, eee->advertised,
3228 pl->supported_lpi);
3229 ret = phy_ethtool_set_eee(pl->phydev, eee);
3231 eee_to_eeecfg(&pl->eee_cfg, eee);
3238 /* This emulates MII registers for a fixed-mode phy operating as per the
3247 unsigned long *lpa = state->lp_advertising;
3250 fs.link = state->link;
3251 fs.speed = state->speed;
3252 fs.duplex = state->duplex;
3258 if (!state->an_complete)
3267 struct phy_device *phydev = pl->phydev;
3273 return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad,
3277 if (phydev->is_c45) {
3283 devad = __ffs(phydev->c45_ids.mmds_present);
3287 if (!(phydev->c45_ids.mmds_present & MDIO_DEVS_AN))
3288 return -EINVAL;
3296 return -EINVAL;
3299 return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad,
3303 return mdiobus_read(pl->phydev->mdio.bus, phy_id, reg);
3309 struct phy_device *phydev = pl->phydev;
3315 return mdiobus_c45_write(pl->phydev->mdio.bus, prtad, devad,
3319 if (phydev->is_c45) {
3325 devad = __ffs(phydev->c45_ids.mmds_present);
3329 if (!(phydev->c45_ids.mmds_present & MDIO_DEVS_AN))
3330 return -EINVAL;
3338 return -EINVAL;
3340 return mdiobus_c45_write(pl->phydev->mdio.bus, phy_id, devad,
3344 return mdiobus_write(phydev->mdio.bus, phy_id, reg, val);
3353 switch (pl->act_link_an_mode) {
3362 return -EOPNOTSUPP;
3378 switch (pl->act_link_an_mode) {
3383 return -EOPNOTSUPP;
3393 * phylink_mii_ioctl() - generic mii ioctl interface
3417 if (pl->phydev) {
3421 mii->phy_id = pl->phydev->mdio.addr;
3425 ret = phylink_phy_read(pl, mii->phy_id, mii->reg_num);
3427 mii->val_out = ret;
3433 ret = phylink_phy_write(pl, mii->phy_id, mii->reg_num,
3434 mii->val_in);
3438 ret = phy_mii_ioctl(pl->phydev, ifr, cmd);
3444 mii->phy_id = 0;
3448 ret = phylink_mii_read(pl, mii->phy_id, mii->reg_num);
3450 mii->val_out = ret;
3456 ret = phylink_mii_write(pl, mii->phy_id, mii->reg_num,
3457 mii->val_in);
3461 ret = -EOPNOTSUPP;
3471 * phylink_speed_down() - set the non-SFP PHY to lowest speed supported by both
3488 if (!pl->sfp_bus && pl->phydev)
3489 ret = phy_speed_down(pl->phydev, sync);
3496 * phylink_speed_up() - restore the advertised speeds prior to the call to
3511 if (!pl->sfp_bus && pl->phydev)
3512 ret = phy_speed_up(pl->phydev);
3522 pl->netdev->sfp_bus = bus;
3529 pl->netdev->sfp_bus = NULL;
3555 phylink_an_mode_str(mode), phy_modes(state->interface),
3558 if (!linkmode_equal(pl->supported, supported)) {
3559 linkmode_copy(pl->supported, supported);
3563 if (!linkmode_equal(pl->link_config.advertising, state->advertising)) {
3564 linkmode_copy(pl->link_config.advertising, state->advertising);
3568 if (pl->req_link_an_mode != mode ||
3569 pl->link_config.interface != state->interface) {
3570 pl->req_link_an_mode = mode;
3571 pl->link_config.interface = state->interface;
3577 phy_modes(state->interface));
3581 &pl->phylink_disable_state))
3591 linkmode_copy(support, phy->supported);
3594 linkmode_copy(config.advertising, phy->advertising);
3611 return -EINVAL;
3627 pl->link_port = pl->sfp_port;
3644 pl->config->supported_interfaces,
3646 pl->sfp_interfaces);
3651 phy_interface_and(interfaces, pl->config->supported_interfaces,
3652 pl->sfp_interfaces);
3655 return -EINVAL;
3659 linkmode_copy(support, pl->sfp_support);
3660 linkmode_copy(config.advertising, pl->sfp_support);
3668 ret = phylink_validate_mask(pl, NULL, pl->sfp_support, &config,
3679 return -EINVAL;
3688 return -EINVAL;
3702 pl->link_port = pl->sfp_port;
3704 phylink_sfp_set_config(pl, pl->sfp_support, &config, false);
3716 linkmode_zero(pl->sfp_support);
3717 phy_interface_zero(pl->sfp_interfaces);
3718 sfp_parse_support(pl->sfp_bus, id, pl->sfp_support, pl->sfp_interfaces);
3719 pl->sfp_port = sfp_parse_port(pl->sfp_bus, id, pl->sfp_support);
3722 pl->sfp_may_have_phy = sfp_may_have_phy(pl->sfp_bus, id);
3723 if (pl->sfp_may_have_phy)
3734 if (pl->phydev) {
3735 phy_start(pl->phydev);
3742 if (!pl->sfp_may_have_phy)
3753 if (pl->phydev)
3754 phy_stop(pl->phydev);
3779 if (!phy->drv) {
3781 phydev_name(phy), (unsigned long)phy->phy_id);
3783 return -EINVAL;
3796 phy_interface_and(phy->host_interfaces, phylink_sfp_interfaces,
3797 pl->config->supported_interfaces);
3829 /* 100GBASE-KP4 and 100GBASE-CR10 not supported */
3834 /* 5GBASE-KR not supported */
3845 if (linkmode_test_bit(bit, state->advertising) &&
3846 linkmode_test_bit(bit, state->lp_advertising))
3851 state->speed = phylink_c73_priority_resolution[i].speed;
3852 state->duplex = DUPLEX_FULL;
3855 state->link = false;
3872 mii_lpa_mod_linkmode_x(state->lp_advertising, config_reg, fd_bit);
3874 if (linkmode_test_bit(fd_bit, state->advertising) &&
3875 linkmode_test_bit(fd_bit, state->lp_advertising)) {
3876 state->speed = speed;
3877 state->duplex = DUPLEX_FULL;
3880 state->link = false;
3890 state->link = false;
3896 state->speed = SPEED_10;
3899 state->speed = SPEED_100;
3902 state->speed = SPEED_1000;
3905 state->link = false;
3909 state->duplex = DUPLEX_FULL;
3911 state->duplex = DUPLEX_HALF;
3915 * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
3917 * @lpa: a 16 bit value which stores the USXGMII auto-negotiation word
3919 * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
3928 state->speed = SPEED_10;
3931 state->speed = SPEED_100;
3934 state->speed = SPEED_1000;
3937 state->speed = SPEED_2500;
3940 state->speed = SPEED_5000;
3943 state->speed = SPEED_10000;
3946 state->link = false;
3951 state->duplex = DUPLEX_FULL;
3953 state->duplex = DUPLEX_HALF;
3958 * phylink_decode_usgmii_word() - decode the USGMII word from a MAC PCS
3960 * @lpa: a 16 bit value which stores the USGMII auto-negotiation word
3962 * Helper for MAC PCS supporting the USGMII protocol and the auto-negotiation
3963 * code word. Decode the USGMII code word and populate the corresponding fields
3973 state->speed = SPEED_10;
3976 state->speed = SPEED_100;
3979 state->speed = SPEED_1000;
3982 state->link = false;
3987 state->duplex = DUPLEX_FULL;
3989 state->duplex = DUPLEX_HALF;
3993 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
4010 state->link = !!(bmsr & BMSR_LSTATUS);
4011 state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);
4014 if (!state->link)
4017 switch (state->interface) {
4022 state->speed = SPEED_1000;
4023 state->duplex = DUPLEX_FULL;
4024 state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
4032 state->speed = SPEED_2500;
4033 state->duplex = DUPLEX_FULL;
4034 state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
4050 state->link = false;
4057 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
4080 state->link = false;
4089 * phylink_mii_c22_pcs_encode_advertisement() - configure the clause 37 PCS
4100 * Return: The new value for @adv, or ``-EINVAL`` if it should not be changed.
4123 return -EINVAL;
4129 * phylink_mii_c22_pcs_config() - configure clause 22 PCS
4151 ret = mdiobus_modify_changed(pcs->bus, pcs->addr,
4173 * phylink_mii_c22_pcs_an_restart() - restart 802.3z autonegotiation
4198 struct mii_bus *bus = pcs->bus;
4199 int addr = pcs->addr;
4204 state->link = false;
4208 state->link = !!(stat & MDIO_STAT1_LSTATUS);
4209 if (!state->link)
4212 switch (state->interface) {
4214 state->speed = SPEED_10000;
4215 state->duplex = DUPLEX_FULL;