Lines Matching full:pcs

52 	struct phylink_pcs *pcs;  member
508 struct phylink_pcs *pcs = NULL; in phylink_validate_mac_and_pcs() local
512 /* Get the PCS for this interface mode */ in phylink_validate_mac_and_pcs()
514 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_validate_mac_and_pcs()
515 if (IS_ERR(pcs)) in phylink_validate_mac_and_pcs()
516 return PTR_ERR(pcs); in phylink_validate_mac_and_pcs()
519 if (pcs) { in phylink_validate_mac_and_pcs()
520 /* The PCS, if present, must be setup before phylink_create() in phylink_validate_mac_and_pcs()
524 if (!pcs->ops) { in phylink_validate_mac_and_pcs()
525 phylink_err(pl, "interface %s: uninitialised PCS\n", in phylink_validate_mac_and_pcs()
531 /* Ensure that this PCS supports the interface which the MAC in phylink_validate_mac_and_pcs()
532 * returned it for. It is an error for the MAC to return a PCS in phylink_validate_mac_and_pcs()
535 if (!phy_interface_empty(pcs->supported_interfaces) && in phylink_validate_mac_and_pcs()
536 !test_bit(state->interface, pcs->supported_interfaces)) { in phylink_validate_mac_and_pcs()
537 phylink_err(pl, "MAC returned PCS which does not support %s\n", in phylink_validate_mac_and_pcs()
542 /* Validate the link parameters with the PCS */ in phylink_validate_mac_and_pcs()
543 if (pcs->ops->pcs_validate) { in phylink_validate_mac_and_pcs()
544 ret = pcs->ops->pcs_validate(pcs, supported, state); in phylink_validate_mac_and_pcs()
861 static unsigned int phylink_pcs_inband_caps(struct phylink_pcs *pcs, in phylink_pcs_inband_caps() argument
864 if (pcs && pcs->ops->pcs_inband_caps) in phylink_pcs_inband_caps()
865 return pcs->ops->pcs_inband_caps(pcs, interface); in phylink_pcs_inband_caps()
870 static void phylink_pcs_pre_config(struct phylink_pcs *pcs, in phylink_pcs_pre_config() argument
873 if (pcs && pcs->ops->pcs_pre_config) in phylink_pcs_pre_config()
874 pcs->ops->pcs_pre_config(pcs, interface); in phylink_pcs_pre_config()
877 static int phylink_pcs_post_config(struct phylink_pcs *pcs, in phylink_pcs_post_config() argument
882 if (pcs && pcs->ops->pcs_post_config) in phylink_pcs_post_config()
883 err = pcs->ops->pcs_post_config(pcs, interface); in phylink_pcs_post_config()
888 static void phylink_pcs_disable(struct phylink_pcs *pcs) in phylink_pcs_disable() argument
890 if (pcs && pcs->ops->pcs_disable) in phylink_pcs_disable()
891 pcs->ops->pcs_disable(pcs); in phylink_pcs_disable()
894 static int phylink_pcs_enable(struct phylink_pcs *pcs) in phylink_pcs_enable() argument
898 if (pcs && pcs->ops->pcs_enable) in phylink_pcs_enable()
899 err = pcs->ops->pcs_enable(pcs); in phylink_pcs_enable()
904 static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_config() argument
908 if (!pcs) in phylink_pcs_config()
911 return pcs->ops->pcs_config(pcs, neg_mode, state->interface, in phylink_pcs_config()
915 static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_link_up() argument
919 if (pcs && pcs->ops->pcs_link_up) in phylink_pcs_link_up()
920 pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); in phylink_pcs_link_up()
923 static void phylink_pcs_disable_eee(struct phylink_pcs *pcs) in phylink_pcs_disable_eee() argument
925 if (pcs && pcs->ops->pcs_disable_eee) in phylink_pcs_disable_eee()
926 pcs->ops->pcs_disable_eee(pcs); in phylink_pcs_disable_eee()
929 static void phylink_pcs_enable_eee(struct phylink_pcs *pcs) in phylink_pcs_enable_eee() argument
931 if (pcs && pcs->ops->pcs_enable_eee) in phylink_pcs_enable_eee()
932 pcs->ops->pcs_enable_eee(pcs); in phylink_pcs_enable_eee()
936 * PCS which will be used to handle the interface mode.
941 struct phylink_pcs *pcs; in phylink_inband_caps() local
946 pcs = pl->mac_ops->mac_select_pcs(pl->config, interface); in phylink_inband_caps()
947 if (!pcs) in phylink_inband_caps()
950 return phylink_pcs_inband_caps(pcs, interface); in phylink_inband_caps()
961 if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) in phylink_pcs_poll_start()
965 int phylink_pcs_pre_init(struct phylink *pl, struct phylink_pcs *pcs) in phylink_pcs_pre_init() argument
969 /* Signal to PCS driver that MAC requires RX clock for init */ in phylink_pcs_pre_init()
971 pcs->rxc_always_on = true; in phylink_pcs_pre_init()
973 if (pcs->ops->pcs_pre_init) in phylink_pcs_pre_init()
974 ret = pcs->ops->pcs_pre_init(pcs); in phylink_pcs_pre_init()
1005 if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, in phylink_pcs_an_restart()
1009 pl->pcs->ops->pcs_an_restart(pl->pcs); in phylink_pcs_an_restart()
1013 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
1015 * @pcs: a pointer to &struct phylink_pcs
1019 * Determines the negotiation mode to be used by the PCS, and returns
1029 * Note: this is for cases where the PCS itself is involved in negotiation
1032 static void phylink_pcs_neg_mode(struct phylink *pl, struct phylink_pcs *pcs, in phylink_pcs_neg_mode() argument
1079 if (pcs) in phylink_pcs_neg_mode()
1080 pcs_ib_caps = phylink_pcs_inband_caps(pcs, interface); in phylink_pcs_neg_mode()
1085 phylink_dbg(pl, "interface %s inband modes: pcs=%02x phy=%02x\n", in phylink_pcs_neg_mode()
1093 /* PCS supports reporting in-band capabilities, and in phylink_pcs_neg_mode()
1114 /* If either the PCS or PHY requires inband to be enabled, in phylink_pcs_neg_mode()
1122 pcs_ib_only ? "PCS" : "", in phylink_pcs_neg_mode()
1137 /* PCS PHY in phylink_pcs_neg_mode()
1140 * 1 0 0 0 pcs doesn't support outband in phylink_pcs_neg_mode()
1141 * 0 1 0 0 pcs required inband enabled in phylink_pcs_neg_mode()
1142 * 1 1 0 0 pcs optional inband enabled in phylink_pcs_neg_mode()
1144 * 1 0 1 0 pcs+phy doesn't support outband in phylink_pcs_neg_mode()
1145 * 0 1 1 0 pcs required, phy doesn't support, invalid in phylink_pcs_neg_mode()
1146 * 1 1 1 0 pcs optional, phy doesn't support, outband in phylink_pcs_neg_mode()
1148 * 1 0 0 1 pcs doesn't support, phy required, invalid in phylink_pcs_neg_mode()
1149 * 0 1 0 1 pcs+phy required inband enabled in phylink_pcs_neg_mode()
1150 * 1 1 0 1 pcs optional, phy required inband enabled in phylink_pcs_neg_mode()
1152 * 1 0 1 1 pcs doesn't support, phy optional, outband in phylink_pcs_neg_mode()
1153 * 0 1 1 1 pcs required, phy optional inband enabled in phylink_pcs_neg_mode()
1154 * 1 1 1 1 pcs+phy optional inband enabled in phylink_pcs_neg_mode()
1189 /* If the PCS doesn't support inband, then inband must in phylink_pcs_neg_mode()
1194 /* If the PCS requires inband, then inband must always in phylink_pcs_neg_mode()
1212 struct phylink_pcs *pcs = NULL; in phylink_major_config() local
1224 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_major_config()
1225 if (IS_ERR(pcs)) { in phylink_major_config()
1228 pcs); in phylink_major_config()
1234 pcs_changed = pl->pcs != pcs; in phylink_major_config()
1237 phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising); in phylink_major_config()
1257 /* If we have a new PCS, switch to the new PCS after preparing the MAC in phylink_major_config()
1261 phylink_pcs_disable(pl->pcs); in phylink_major_config()
1263 if (pl->pcs) in phylink_major_config()
1264 pl->pcs->phylink = NULL; in phylink_major_config()
1266 pcs->phylink = pl; in phylink_major_config()
1268 pl->pcs = pcs; in phylink_major_config()
1271 if (pl->pcs) in phylink_major_config()
1272 phylink_pcs_pre_config(pl->pcs, state->interface); in phylink_major_config()
1276 if (pl->pcs) { in phylink_major_config()
1277 err = phylink_pcs_post_config(pl->pcs, state->interface); in phylink_major_config()
1287 phylink_pcs_enable(pl->pcs); in phylink_major_config()
1289 err = phylink_pcs_config(pl->pcs, pl->pcs_neg_mode, state, in phylink_major_config()
1333 * If we have a separate PCS, we only need to call its pcs_config() method,
1350 /* Recompute the PCS neg mode */ in phylink_change_inband_advert()
1351 phylink_pcs_neg_mode(pl, pl->pcs, pl->link_config.interface, in phylink_change_inband_advert()
1354 /* Modern PCS-based method; update the advert at the PCS, and in phylink_change_inband_advert()
1358 ret = phylink_pcs_config(pl->pcs, pl->pcs_neg_mode, &pl->link_config, in phylink_change_inband_advert()
1372 struct phylink_pcs *pcs; in phylink_mac_pcs_get_state() local
1393 pcs = pl->pcs; in phylink_mac_pcs_get_state()
1394 if (pcs) in phylink_mac_pcs_get_state()
1395 pcs->ops->pcs_get_state(pcs, pl->pcs_neg_mode, state); in phylink_mac_pcs_get_state()
1468 phylink_pcs_disable_eee(pl->pcs); in phylink_deactivate_lpi()
1485 phylink_pcs_enable_eee(pl->pcs); in phylink_activate_lpi()
1490 phylink_pcs_disable_eee(pl->pcs); in phylink_activate_lpi()
1533 phylink_pcs_link_up(pl->pcs, pl->pcs_neg_mode, pl->cur_interface, speed, in phylink_link_up()
1598 /* The PCS may have a latching link-fail indicator. If the link in phylink_resolve()
1600 * Otherwise, re-read the PCS state to get the current status in phylink_resolve()
2338 * phylink_pcs_change() - notify phylink of a change to PCS link state
2339 * @pcs: pointer to &struct phylink_pcs
2342 * The PCS driver should call this when the state of its link changes
2348 void phylink_pcs_change(struct phylink_pcs *pcs, bool up) in phylink_pcs_change() argument
2350 struct phylink *pl = pcs->phylink; in phylink_pcs_change()
2353 phylink_link_changed(pl, up, "pcs"); in phylink_pcs_change()
2462 phylink_pcs_disable(pl->pcs); in phylink_stop()
2773 /* The MAC is reporting the link results from its own PCS in phylink_ethtool_ksettings_get()
2792 /* If the PCS doesn't implement inband support, be permissive. */ in phylink_validate_pcs_inband_autoneg()
2801 /* Check whether the PCS implements the required mode */ in phylink_validate_pcs_inband_autoneg()
2936 * situation, so the PCS is the media-facing entity. in phylink_ethtool_ksettings_set()
3590 /* Find the union of the supported interfaces by the PCS/MAC and in phylink_sfp_config_optical()
3629 phylink_err(pl, "autoneg setting not compatible with PCS"); in phylink_sfp_config_optical()
3857 * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
3861 * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
3900 * phylink_decode_usgmii_word() - decode the USGMII word from a MAC PCS
3904 * Helper for MAC PCS supporting the USGMII protocol and the auto-negotiation
3935 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
3941 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3999 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
4000 * @pcs: a pointer to a &struct mdio_device.
4004 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4007 * Read the MAC PCS state from the MII device configured in @config and
4013 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c22_pcs_get_state() argument
4019 bmsr = mdiodev_read(pcs, MII_BMSR); in phylink_mii_c22_pcs_get_state()
4020 lpa = mdiodev_read(pcs, MII_LPA); in phylink_mii_c22_pcs_get_state()
4031 * phylink_mii_c22_pcs_encode_advertisement() - configure the clause 37 PCS
4036 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4039 * Encode the clause 37 PCS advertisement as specified by @interface and
4071 * phylink_mii_c22_pcs_config() - configure clause 22 PCS
4072 * @pcs: a pointer to a &struct mdio_device.
4075 * @neg_mode: PCS negotiation mode
4077 * Configure a Clause 22 PCS PHY with the appropriate negotiation
4082 int phylink_mii_c22_pcs_config(struct mdio_device *pcs, in phylink_mii_c22_pcs_config() argument
4093 ret = mdiobus_modify_changed(pcs->bus, pcs->addr, in phylink_mii_c22_pcs_config()
4106 ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); in phylink_mii_c22_pcs_config()
4116 * @pcs: a pointer to a &struct mdio_device.
4118 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4125 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) in phylink_mii_c22_pcs_an_restart() argument
4127 int val = mdiodev_read(pcs, MII_BMCR); in phylink_mii_c22_pcs_an_restart()
4132 mdiodev_write(pcs, MII_BMCR, val); in phylink_mii_c22_pcs_an_restart()
4137 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c45_pcs_get_state() argument
4140 struct mii_bus *bus = pcs->bus; in phylink_mii_c45_pcs_get_state()
4141 int addr = pcs->addr; in phylink_mii_c45_pcs_get_state()