Lines Matching full:pcs

51 	struct phylink_pcs *pcs;  member
680 struct phylink_pcs *pcs = NULL; in phylink_validate_mac_and_pcs() local
684 /* Get the PCS for this interface mode */ in phylink_validate_mac_and_pcs()
686 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_validate_mac_and_pcs()
687 if (IS_ERR(pcs)) in phylink_validate_mac_and_pcs()
688 return PTR_ERR(pcs); in phylink_validate_mac_and_pcs()
691 if (pcs) { in phylink_validate_mac_and_pcs()
692 /* The PCS, if present, must be setup before phylink_create() in phylink_validate_mac_and_pcs()
696 if (!pcs->ops) { in phylink_validate_mac_and_pcs()
697 phylink_err(pl, "interface %s: uninitialised PCS\n", in phylink_validate_mac_and_pcs()
703 /* Ensure that this PCS supports the interface which the MAC in phylink_validate_mac_and_pcs()
704 * returned it for. It is an error for the MAC to return a PCS in phylink_validate_mac_and_pcs()
707 if (!phy_interface_empty(pcs->supported_interfaces) && in phylink_validate_mac_and_pcs()
708 !test_bit(state->interface, pcs->supported_interfaces)) { in phylink_validate_mac_and_pcs()
709 phylink_err(pl, "MAC returned PCS which does not support %s\n", in phylink_validate_mac_and_pcs()
714 /* Validate the link parameters with the PCS */ in phylink_validate_mac_and_pcs()
715 if (pcs->ops->pcs_validate) { in phylink_validate_mac_and_pcs()
716 ret = pcs->ops->pcs_validate(pcs, supported, state); in phylink_validate_mac_and_pcs()
1014 static unsigned int phylink_pcs_inband_caps(struct phylink_pcs *pcs, in phylink_pcs_inband_caps() argument
1017 if (pcs && pcs->ops->pcs_inband_caps) in phylink_pcs_inband_caps()
1018 return pcs->ops->pcs_inband_caps(pcs, interface); in phylink_pcs_inband_caps()
1023 static void phylink_pcs_pre_config(struct phylink_pcs *pcs, in phylink_pcs_pre_config() argument
1026 if (pcs && pcs->ops->pcs_pre_config) in phylink_pcs_pre_config()
1027 pcs->ops->pcs_pre_config(pcs, interface); in phylink_pcs_pre_config()
1030 static int phylink_pcs_post_config(struct phylink_pcs *pcs, in phylink_pcs_post_config() argument
1035 if (pcs && pcs->ops->pcs_post_config) in phylink_pcs_post_config()
1036 err = pcs->ops->pcs_post_config(pcs, interface); in phylink_pcs_post_config()
1041 static void phylink_pcs_disable(struct phylink_pcs *pcs) in phylink_pcs_disable() argument
1043 if (pcs && pcs->ops->pcs_disable) in phylink_pcs_disable()
1044 pcs->ops->pcs_disable(pcs); in phylink_pcs_disable()
1047 static int phylink_pcs_enable(struct phylink_pcs *pcs) in phylink_pcs_enable() argument
1051 if (pcs && pcs->ops->pcs_enable) in phylink_pcs_enable()
1052 err = pcs->ops->pcs_enable(pcs); in phylink_pcs_enable()
1057 static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_config() argument
1061 if (!pcs) in phylink_pcs_config()
1064 return pcs->ops->pcs_config(pcs, neg_mode, state->interface, in phylink_pcs_config()
1068 static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_link_up() argument
1072 if (pcs && pcs->ops->pcs_link_up) in phylink_pcs_link_up()
1073 pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); in phylink_pcs_link_up()
1077 * PCS which will be used to handle the interface mode.
1082 struct phylink_pcs *pcs; in phylink_inband_caps() local
1087 pcs = pl->mac_ops->mac_select_pcs(pl->config, interface); in phylink_inband_caps()
1088 if (!pcs) in phylink_inband_caps()
1091 return phylink_pcs_inband_caps(pcs, interface); in phylink_inband_caps()
1102 if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) in phylink_pcs_poll_start()
1106 int phylink_pcs_pre_init(struct phylink *pl, struct phylink_pcs *pcs) in phylink_pcs_pre_init() argument
1110 /* Signal to PCS driver that MAC requires RX clock for init */ in phylink_pcs_pre_init()
1112 pcs->rxc_always_on = true; in phylink_pcs_pre_init()
1114 if (pcs->ops->pcs_pre_init) in phylink_pcs_pre_init()
1115 ret = pcs->ops->pcs_pre_init(pcs); in phylink_pcs_pre_init()
1146 if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, in phylink_pcs_an_restart()
1150 pl->pcs->ops->pcs_an_restart(pl->pcs); in phylink_pcs_an_restart()
1154 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
1156 * @pcs: a pointer to &struct phylink_pcs
1160 * Determines the negotiation mode to be used by the PCS, and returns
1170 * Note: this is for cases where the PCS itself is involved in negotiation
1173 static void phylink_pcs_neg_mode(struct phylink *pl, struct phylink_pcs *pcs, in phylink_pcs_neg_mode() argument
1220 if (pcs) in phylink_pcs_neg_mode()
1221 pcs_ib_caps = phylink_pcs_inband_caps(pcs, interface); in phylink_pcs_neg_mode()
1226 phylink_dbg(pl, "interface %s inband modes: pcs=%02x phy=%02x\n", in phylink_pcs_neg_mode()
1234 /* PCS supports reporting in-band capabilities, and in phylink_pcs_neg_mode()
1255 /* If either the PCS or PHY requires inband to be enabled, in phylink_pcs_neg_mode()
1263 pcs_ib_only ? "PCS" : "", in phylink_pcs_neg_mode()
1278 /* PCS PHY in phylink_pcs_neg_mode()
1281 * 1 0 0 0 pcs doesn't support outband in phylink_pcs_neg_mode()
1282 * 0 1 0 0 pcs required inband enabled in phylink_pcs_neg_mode()
1283 * 1 1 0 0 pcs optional inband enabled in phylink_pcs_neg_mode()
1285 * 1 0 1 0 pcs+phy doesn't support outband in phylink_pcs_neg_mode()
1286 * 0 1 1 0 pcs required, phy doesn't support, invalid in phylink_pcs_neg_mode()
1287 * 1 1 1 0 pcs optional, phy doesn't support, outband in phylink_pcs_neg_mode()
1289 * 1 0 0 1 pcs doesn't support, phy required, invalid in phylink_pcs_neg_mode()
1290 * 0 1 0 1 pcs+phy required inband enabled in phylink_pcs_neg_mode()
1291 * 1 1 0 1 pcs optional, phy required inband enabled in phylink_pcs_neg_mode()
1293 * 1 0 1 1 pcs doesn't support, phy optional, outband in phylink_pcs_neg_mode()
1294 * 0 1 1 1 pcs required, phy optional inband enabled in phylink_pcs_neg_mode()
1295 * 1 1 1 1 pcs+phy optional inband enabled in phylink_pcs_neg_mode()
1330 /* If the PCS doesn't support inband, then inband must in phylink_pcs_neg_mode()
1335 /* If the PCS requires inband, then inband must always in phylink_pcs_neg_mode()
1353 struct phylink_pcs *pcs = NULL; in phylink_major_config() local
1364 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_major_config()
1365 if (IS_ERR(pcs)) { in phylink_major_config()
1368 pcs); in phylink_major_config()
1372 pcs_changed = pl->pcs != pcs; in phylink_major_config()
1375 phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising); in phylink_major_config()
1394 /* If we have a new PCS, switch to the new PCS after preparing the MAC in phylink_major_config()
1398 phylink_pcs_disable(pl->pcs); in phylink_major_config()
1400 if (pl->pcs) in phylink_major_config()
1401 pl->pcs->phylink = NULL; in phylink_major_config()
1403 pcs->phylink = pl; in phylink_major_config()
1405 pl->pcs = pcs; in phylink_major_config()
1408 if (pl->pcs) in phylink_major_config()
1409 phylink_pcs_pre_config(pl->pcs, state->interface); in phylink_major_config()
1413 if (pl->pcs) in phylink_major_config()
1414 phylink_pcs_post_config(pl->pcs, state->interface); in phylink_major_config()
1417 phylink_pcs_enable(pl->pcs); in phylink_major_config()
1420 if (pl->pcs && pl->pcs->neg_mode) in phylink_major_config()
1423 err = phylink_pcs_config(pl->pcs, neg_mode, state, in phylink_major_config()
1460 * If we have a separate PCS, we only need to call its pcs_config() method,
1478 /* Recompute the PCS neg mode */ in phylink_change_inband_advert()
1479 phylink_pcs_neg_mode(pl, pl->pcs, pl->link_config.interface, in phylink_change_inband_advert()
1483 if (pl->pcs->neg_mode) in phylink_change_inband_advert()
1486 /* Modern PCS-based method; update the advert at the PCS, and in phylink_change_inband_advert()
1490 ret = phylink_pcs_config(pl->pcs, neg_mode, &pl->link_config, in phylink_change_inband_advert()
1504 struct phylink_pcs *pcs; in phylink_mac_pcs_get_state() local
1514 pcs = pl->pcs; in phylink_mac_pcs_get_state()
1515 if (!pcs || pcs->neg_mode) in phylink_mac_pcs_get_state()
1531 if (pcs) in phylink_mac_pcs_get_state()
1532 pcs->ops->pcs_get_state(pcs, pl->pcs_neg_mode, state); in phylink_mac_pcs_get_state()
1665 if (pl->pcs && pl->pcs->neg_mode) in phylink_link_up()
1668 phylink_pcs_link_up(pl->pcs, neg_mode, pl->cur_interface, speed, in phylink_link_up()
1733 /* The PCS may have a latching link-fail indicator. If the link in phylink_resolve()
1735 * Otherwise, re-read the PCS state to get the current status in phylink_resolve()
2469 * phylink_pcs_change() - notify phylink of a change to PCS link state
2470 * @pcs: pointer to &struct phylink_pcs
2473 * The PCS driver should call this when the state of its link changes
2479 void phylink_pcs_change(struct phylink_pcs *pcs, bool up) in phylink_pcs_change() argument
2481 struct phylink *pl = pcs->phylink; in phylink_pcs_change()
2484 phylink_link_changed(pl, up, "pcs"); in phylink_pcs_change()
2593 phylink_pcs_disable(pl->pcs); in phylink_stop()
2816 /* The MAC is reporting the link results from its own PCS in phylink_ethtool_ksettings_get()
2835 /* If the PCS doesn't implement inband support, be permissive. */ in phylink_validate_pcs_inband_autoneg()
2844 /* Check whether the PCS implements the required mode */ in phylink_validate_pcs_inband_autoneg()
2979 * situation, so the PCS is the media-facing entity. in phylink_ethtool_ksettings_set()
3651 /* Find the union of the supported interfaces by the PCS/MAC and in phylink_sfp_config_optical()
3690 phylink_err(pl, "autoneg setting not compatible with PCS"); in phylink_sfp_config_optical()
3918 * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
3922 * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
3961 * phylink_decode_usgmii_word() - decode the USGMII word from a MAC PCS
3965 * Helper for MAC PCS supporting the USGMII protocol and the auto-negotiation
3996 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
4002 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4060 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
4061 * @pcs: a pointer to a &struct mdio_device.
4065 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4068 * Read the MAC PCS state from the MII device configured in @config and
4074 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c22_pcs_get_state() argument
4080 bmsr = mdiodev_read(pcs, MII_BMSR); in phylink_mii_c22_pcs_get_state()
4081 lpa = mdiodev_read(pcs, MII_LPA); in phylink_mii_c22_pcs_get_state()
4092 * phylink_mii_c22_pcs_encode_advertisement() - configure the clause 37 PCS
4097 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4100 * Encode the clause 37 PCS advertisement as specified by @interface and
4132 * phylink_mii_c22_pcs_config() - configure clause 22 PCS
4133 * @pcs: a pointer to a &struct mdio_device.
4136 * @neg_mode: PCS negotiation mode
4138 * Configure a Clause 22 PCS PHY with the appropriate negotiation
4143 int phylink_mii_c22_pcs_config(struct mdio_device *pcs, in phylink_mii_c22_pcs_config() argument
4154 ret = mdiobus_modify_changed(pcs->bus, pcs->addr, in phylink_mii_c22_pcs_config()
4167 ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); in phylink_mii_c22_pcs_config()
4177 * @pcs: a pointer to a &struct mdio_device.
4179 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4186 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) in phylink_mii_c22_pcs_an_restart() argument
4188 int val = mdiodev_read(pcs, MII_BMCR); in phylink_mii_c22_pcs_an_restart()
4193 mdiodev_write(pcs, MII_BMCR, val); in phylink_mii_c22_pcs_an_restart()
4198 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c45_pcs_get_state() argument
4201 struct mii_bus *bus = pcs->bus; in phylink_mii_c45_pcs_get_state()
4202 int addr = pcs->addr; in phylink_mii_c45_pcs_get_state()