Lines Matching full:pcs
45 struct phylink_pcs *pcs; member
514 struct phylink_pcs *pcs = NULL; in phylink_validate_mac_and_pcs() local
518 /* Get the PCS for this interface mode */ in phylink_validate_mac_and_pcs()
520 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_validate_mac_and_pcs()
521 if (IS_ERR(pcs)) in phylink_validate_mac_and_pcs()
522 return PTR_ERR(pcs); in phylink_validate_mac_and_pcs()
525 if (pcs) { in phylink_validate_mac_and_pcs()
526 /* The PCS, if present, must be setup before phylink_create() in phylink_validate_mac_and_pcs()
530 if (!pcs->ops) { in phylink_validate_mac_and_pcs()
531 phylink_err(pl, "interface %s: uninitialised PCS\n", in phylink_validate_mac_and_pcs()
537 /* Ensure that this PCS supports the interface which the MAC in phylink_validate_mac_and_pcs()
538 * returned it for. It is an error for the MAC to return a PCS in phylink_validate_mac_and_pcs()
541 if (!phy_interface_empty(pcs->supported_interfaces) && in phylink_validate_mac_and_pcs()
542 !test_bit(state->interface, pcs->supported_interfaces)) { in phylink_validate_mac_and_pcs()
543 phylink_err(pl, "MAC returned PCS which does not support %s\n", in phylink_validate_mac_and_pcs()
548 /* Validate the link parameters with the PCS */ in phylink_validate_mac_and_pcs()
549 if (pcs->ops->pcs_validate) { in phylink_validate_mac_and_pcs()
550 ret = pcs->ops->pcs_validate(pcs, supported, state); in phylink_validate_mac_and_pcs()
876 static unsigned int phylink_pcs_inband_caps(struct phylink_pcs *pcs, in phylink_pcs_inband_caps() argument
879 if (pcs && pcs->ops->pcs_inband_caps) in phylink_pcs_inband_caps()
880 return pcs->ops->pcs_inband_caps(pcs, interface); in phylink_pcs_inband_caps()
885 static void phylink_pcs_pre_config(struct phylink_pcs *pcs, in phylink_pcs_pre_config() argument
888 if (pcs && pcs->ops->pcs_pre_config) in phylink_pcs_pre_config()
889 pcs->ops->pcs_pre_config(pcs, interface); in phylink_pcs_pre_config()
892 static int phylink_pcs_post_config(struct phylink_pcs *pcs, in phylink_pcs_post_config() argument
897 if (pcs && pcs->ops->pcs_post_config) in phylink_pcs_post_config()
898 err = pcs->ops->pcs_post_config(pcs, interface); in phylink_pcs_post_config()
903 static void phylink_pcs_disable(struct phylink_pcs *pcs) in phylink_pcs_disable() argument
905 if (pcs && pcs->ops->pcs_disable) in phylink_pcs_disable()
906 pcs->ops->pcs_disable(pcs); in phylink_pcs_disable()
909 static int phylink_pcs_enable(struct phylink_pcs *pcs) in phylink_pcs_enable() argument
913 if (pcs && pcs->ops->pcs_enable) in phylink_pcs_enable()
914 err = pcs->ops->pcs_enable(pcs); in phylink_pcs_enable()
919 static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_config() argument
923 if (!pcs) in phylink_pcs_config()
926 return pcs->ops->pcs_config(pcs, neg_mode, state->interface, in phylink_pcs_config()
930 static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_link_up() argument
934 if (pcs && pcs->ops->pcs_link_up) in phylink_pcs_link_up()
935 pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); in phylink_pcs_link_up()
938 static void phylink_pcs_disable_eee(struct phylink_pcs *pcs) in phylink_pcs_disable_eee() argument
940 if (pcs && pcs->ops->pcs_disable_eee) in phylink_pcs_disable_eee()
941 pcs->ops->pcs_disable_eee(pcs); in phylink_pcs_disable_eee()
944 static void phylink_pcs_enable_eee(struct phylink_pcs *pcs) in phylink_pcs_enable_eee() argument
946 if (pcs && pcs->ops->pcs_enable_eee) in phylink_pcs_enable_eee()
947 pcs->ops->pcs_enable_eee(pcs); in phylink_pcs_enable_eee()
951 * PCS which will be used to handle the interface mode.
956 struct phylink_pcs *pcs; in phylink_inband_caps() local
961 pcs = pl->mac_ops->mac_select_pcs(pl->config, interface); in phylink_inband_caps()
962 if (!pcs) in phylink_inband_caps()
965 return phylink_pcs_inband_caps(pcs, interface); in phylink_inband_caps()
976 if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) in phylink_pcs_poll_start()
980 int phylink_pcs_pre_init(struct phylink *pl, struct phylink_pcs *pcs) in phylink_pcs_pre_init() argument
984 /* Signal to PCS driver that MAC requires RX clock for init */ in phylink_pcs_pre_init()
986 pcs->rxc_always_on = true; in phylink_pcs_pre_init()
988 if (pcs->ops->pcs_pre_init) in phylink_pcs_pre_init()
989 ret = pcs->ops->pcs_pre_init(pcs); in phylink_pcs_pre_init()
1020 if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, in phylink_pcs_an_restart()
1024 pl->pcs->ops->pcs_an_restart(pl->pcs); in phylink_pcs_an_restart()
1064 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
1066 * @pcs: a pointer to &struct phylink_pcs
1070 * Determines the negotiation mode to be used by the PCS, and returns
1080 * Note: this is for cases where the PCS itself is involved in negotiation
1083 static void phylink_pcs_neg_mode(struct phylink *pl, struct phylink_pcs *pcs, in phylink_pcs_neg_mode() argument
1103 if (pcs) in phylink_pcs_neg_mode()
1104 pcs_ib_caps = phylink_pcs_inband_caps(pcs, interface); in phylink_pcs_neg_mode()
1109 phylink_dbg(pl, "interface %s inband modes: pcs=%02x phy=%02x\n", in phylink_pcs_neg_mode()
1117 /* PCS supports reporting in-band capabilities, and in phylink_pcs_neg_mode()
1138 /* If either the PCS or PHY requires inband to be enabled, in phylink_pcs_neg_mode()
1146 pcs_ib_only ? "PCS" : "", in phylink_pcs_neg_mode()
1161 /* PCS PHY in phylink_pcs_neg_mode()
1164 * 1 0 0 0 pcs doesn't support outband in phylink_pcs_neg_mode()
1165 * 0 1 0 0 pcs required inband enabled in phylink_pcs_neg_mode()
1166 * 1 1 0 0 pcs optional inband enabled in phylink_pcs_neg_mode()
1168 * 1 0 1 0 pcs+phy doesn't support outband in phylink_pcs_neg_mode()
1169 * 0 1 1 0 pcs required, phy doesn't support, invalid in phylink_pcs_neg_mode()
1170 * 1 1 1 0 pcs optional, phy doesn't support, outband in phylink_pcs_neg_mode()
1172 * 1 0 0 1 pcs doesn't support, phy required, invalid in phylink_pcs_neg_mode()
1173 * 0 1 0 1 pcs+phy required inband enabled in phylink_pcs_neg_mode()
1174 * 1 1 0 1 pcs optional, phy required inband enabled in phylink_pcs_neg_mode()
1176 * 1 0 1 1 pcs doesn't support, phy optional, outband in phylink_pcs_neg_mode()
1177 * 0 1 1 1 pcs required, phy optional inband enabled in phylink_pcs_neg_mode()
1178 * 1 1 1 1 pcs+phy optional inband enabled in phylink_pcs_neg_mode()
1213 /* If the PCS doesn't support inband, then inband must in phylink_pcs_neg_mode()
1218 /* If the PCS requires inband, then inband must always in phylink_pcs_neg_mode()
1236 struct phylink_pcs *pcs = NULL; in phylink_major_config() local
1248 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_major_config()
1249 if (IS_ERR(pcs)) { in phylink_major_config()
1252 pcs); in phylink_major_config()
1258 pcs_changed = pl->pcs != pcs; in phylink_major_config()
1261 phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising); in phylink_major_config()
1281 /* If we have a new PCS, switch to the new PCS after preparing the MAC in phylink_major_config()
1285 phylink_pcs_disable(pl->pcs); in phylink_major_config()
1287 if (pl->pcs) in phylink_major_config()
1288 pl->pcs->phylink = NULL; in phylink_major_config()
1290 pcs->phylink = pl; in phylink_major_config()
1292 pl->pcs = pcs; in phylink_major_config()
1295 if (pl->pcs) in phylink_major_config()
1296 phylink_pcs_pre_config(pl->pcs, state->interface); in phylink_major_config()
1300 if (pl->pcs) { in phylink_major_config()
1301 err = phylink_pcs_post_config(pl->pcs, state->interface); in phylink_major_config()
1311 phylink_pcs_enable(pl->pcs); in phylink_major_config()
1313 err = phylink_pcs_config(pl->pcs, pl->pcs_neg_mode, state, in phylink_major_config()
1357 * If we have a separate PCS, we only need to call its pcs_config() method,
1374 /* Recompute the PCS neg mode */ in phylink_change_inband_advert()
1375 phylink_pcs_neg_mode(pl, pl->pcs, pl->link_config.interface, in phylink_change_inband_advert()
1378 /* Modern PCS-based method; update the advert at the PCS, and in phylink_change_inband_advert()
1382 ret = phylink_pcs_config(pl->pcs, pl->pcs_neg_mode, &pl->link_config, in phylink_change_inband_advert()
1396 struct phylink_pcs *pcs; in phylink_mac_pcs_get_state() local
1417 pcs = pl->pcs; in phylink_mac_pcs_get_state()
1418 if (pcs) in phylink_mac_pcs_get_state()
1419 pcs->ops->pcs_get_state(pcs, pl->pcs_neg_mode, state); in phylink_mac_pcs_get_state()
1497 phylink_pcs_disable_eee(pl->pcs); in phylink_deactivate_lpi()
1514 phylink_pcs_enable_eee(pl->pcs); in phylink_activate_lpi()
1519 phylink_pcs_disable_eee(pl->pcs); in phylink_activate_lpi()
1562 phylink_pcs_link_up(pl->pcs, pl->pcs_neg_mode, pl->cur_interface, speed, in phylink_link_up()
1632 /* The PCS may have a latching link-fail indicator. If the link in phylink_resolve()
1634 * Otherwise, re-read the PCS state to get the current status in phylink_resolve()
2382 * phylink_pcs_change() - notify phylink of a change to PCS link state
2383 * @pcs: pointer to &struct phylink_pcs
2386 * The PCS driver should call this when the state of its link changes
2392 void phylink_pcs_change(struct phylink_pcs *pcs, bool up) in phylink_pcs_change() argument
2394 struct phylink *pl = pcs->phylink; in phylink_pcs_change()
2397 phylink_link_changed(pl, up, "pcs"); in phylink_pcs_change()
2506 phylink_pcs_disable(pl->pcs); in phylink_stop()
2850 /* The MAC is reporting the link results from its own PCS in phylink_ethtool_ksettings_get()
2869 /* If the PCS doesn't implement inband support, be permissive. */ in phylink_validate_pcs_inband_autoneg()
2878 /* Check whether the PCS implements the required mode */ in phylink_validate_pcs_inband_autoneg()
3019 * situation, so the PCS is the media-facing entity. in phylink_ethtool_ksettings_set()
3675 /* Find the union of the supported interfaces by the PCS/MAC and in phylink_sfp_config_optical()
3731 phylink_err(pl, "autoneg setting not compatible with PCS"); in phylink_sfp_config_optical()
3968 * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
3972 * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
4011 * phylink_decode_usgmii_word() - decode the USGMII word from a MAC PCS
4015 * Helper for MAC PCS supporting the USGMII protocol and the auto-negotiation
4046 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
4052 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4110 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
4111 * @pcs: a pointer to a &struct mdio_device.
4115 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4118 * Read the MAC PCS state from the MII device configured in @config and
4124 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c22_pcs_get_state() argument
4130 bmsr = mdiodev_read(pcs, MII_BMSR); in phylink_mii_c22_pcs_get_state()
4131 lpa = mdiodev_read(pcs, MII_LPA); in phylink_mii_c22_pcs_get_state()
4142 * phylink_mii_c22_pcs_encode_advertisement() - configure the clause 37 PCS
4147 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4150 * Encode the clause 37 PCS advertisement as specified by @interface and
4182 * phylink_mii_c22_pcs_config() - configure clause 22 PCS
4183 * @pcs: a pointer to a &struct mdio_device.
4186 * @neg_mode: PCS negotiation mode
4188 * Configure a Clause 22 PCS PHY with the appropriate negotiation
4193 int phylink_mii_c22_pcs_config(struct mdio_device *pcs, in phylink_mii_c22_pcs_config() argument
4204 ret = mdiobus_modify_changed(pcs->bus, pcs->addr, in phylink_mii_c22_pcs_config()
4217 ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); in phylink_mii_c22_pcs_config()
4227 * @pcs: a pointer to a &struct mdio_device.
4229 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
4236 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) in phylink_mii_c22_pcs_an_restart() argument
4238 int val = mdiodev_read(pcs, MII_BMCR); in phylink_mii_c22_pcs_an_restart()
4243 mdiodev_write(pcs, MII_BMCR, val); in phylink_mii_c22_pcs_an_restart()
4248 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c45_pcs_get_state() argument
4251 struct mii_bus *bus = pcs->bus; in phylink_mii_c45_pcs_get_state()
4252 int addr = pcs->addr; in phylink_mii_c45_pcs_get_state()