Lines Matching full:pcs
51 struct phylink_pcs *pcs; member
651 struct phylink_pcs *pcs = NULL; in phylink_validate_mac_and_pcs() local
655 /* Get the PCS for this interface mode */ in phylink_validate_mac_and_pcs()
657 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_validate_mac_and_pcs()
658 if (IS_ERR(pcs)) in phylink_validate_mac_and_pcs()
659 return PTR_ERR(pcs); in phylink_validate_mac_and_pcs()
662 if (pcs) { in phylink_validate_mac_and_pcs()
663 /* The PCS, if present, must be setup before phylink_create() in phylink_validate_mac_and_pcs()
667 if (!pcs->ops) { in phylink_validate_mac_and_pcs()
668 phylink_err(pl, "interface %s: uninitialised PCS\n", in phylink_validate_mac_and_pcs()
674 /* Validate the link parameters with the PCS */ in phylink_validate_mac_and_pcs()
675 if (pcs->ops->pcs_validate) { in phylink_validate_mac_and_pcs()
676 ret = pcs->ops->pcs_validate(pcs, supported, state); in phylink_validate_mac_and_pcs()
974 static void phylink_pcs_pre_config(struct phylink_pcs *pcs, in phylink_pcs_pre_config() argument
977 if (pcs && pcs->ops->pcs_pre_config) in phylink_pcs_pre_config()
978 pcs->ops->pcs_pre_config(pcs, interface); in phylink_pcs_pre_config()
981 static int phylink_pcs_post_config(struct phylink_pcs *pcs, in phylink_pcs_post_config() argument
986 if (pcs && pcs->ops->pcs_post_config) in phylink_pcs_post_config()
987 err = pcs->ops->pcs_post_config(pcs, interface); in phylink_pcs_post_config()
992 static void phylink_pcs_disable(struct phylink_pcs *pcs) in phylink_pcs_disable() argument
994 if (pcs && pcs->ops->pcs_disable) in phylink_pcs_disable()
995 pcs->ops->pcs_disable(pcs); in phylink_pcs_disable()
998 static int phylink_pcs_enable(struct phylink_pcs *pcs) in phylink_pcs_enable() argument
1002 if (pcs && pcs->ops->pcs_enable) in phylink_pcs_enable()
1003 err = pcs->ops->pcs_enable(pcs); in phylink_pcs_enable()
1008 static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_config() argument
1012 if (!pcs) in phylink_pcs_config()
1015 return pcs->ops->pcs_config(pcs, neg_mode, state->interface, in phylink_pcs_config()
1019 static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_link_up() argument
1023 if (pcs && pcs->ops->pcs_link_up) in phylink_pcs_link_up()
1024 pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); in phylink_pcs_link_up()
1035 if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) in phylink_pcs_poll_start()
1039 int phylink_pcs_pre_init(struct phylink *pl, struct phylink_pcs *pcs) in phylink_pcs_pre_init() argument
1043 /* Signal to PCS driver that MAC requires RX clock for init */ in phylink_pcs_pre_init()
1045 pcs->rxc_always_on = true; in phylink_pcs_pre_init()
1047 if (pcs->ops->pcs_pre_init) in phylink_pcs_pre_init()
1048 ret = pcs->ops->pcs_pre_init(pcs); in phylink_pcs_pre_init()
1079 if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, in phylink_pcs_an_restart()
1083 pl->pcs->ops->pcs_an_restart(pl->pcs); in phylink_pcs_an_restart()
1087 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
1092 * Determines the negotiation mode to be used by the PCS, and returns
1102 * Note: this is for cases where the PCS itself is involved in negotiation
1156 struct phylink_pcs *pcs = NULL; in phylink_major_config() local
1169 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_major_config()
1170 if (IS_ERR(pcs)) { in phylink_major_config()
1173 pcs); in phylink_major_config()
1177 pcs_changed = pl->pcs != pcs; in phylink_major_config()
1192 /* If we have a new PCS, switch to the new PCS after preparing the MAC in phylink_major_config()
1196 phylink_pcs_disable(pl->pcs); in phylink_major_config()
1198 if (pl->pcs) in phylink_major_config()
1199 pl->pcs->phylink = NULL; in phylink_major_config()
1201 pcs->phylink = pl; in phylink_major_config()
1203 pl->pcs = pcs; in phylink_major_config()
1206 if (pl->pcs) in phylink_major_config()
1207 phylink_pcs_pre_config(pl->pcs, state->interface); in phylink_major_config()
1211 if (pl->pcs) in phylink_major_config()
1212 phylink_pcs_post_config(pl->pcs, state->interface); in phylink_major_config()
1215 phylink_pcs_enable(pl->pcs); in phylink_major_config()
1218 if (pl->pcs && pl->pcs->neg_mode) in phylink_major_config()
1221 err = phylink_pcs_config(pl->pcs, neg_mode, state, in phylink_major_config()
1251 * If we have a separate PCS, we only need to call its pcs_config() method,
1269 /* Recompute the PCS neg mode */ in phylink_change_inband_advert()
1275 if (pl->pcs->neg_mode) in phylink_change_inband_advert()
1278 /* Modern PCS-based method; update the advert at the PCS, and in phylink_change_inband_advert()
1282 ret = phylink_pcs_config(pl->pcs, neg_mode, &pl->link_config, in phylink_change_inband_advert()
1313 if (pl->pcs) in phylink_mac_pcs_get_state()
1314 pl->pcs->ops->pcs_get_state(pl->pcs, state); in phylink_mac_pcs_get_state()
1414 if (pl->pcs && pl->pcs->neg_mode) in phylink_link_up()
1417 phylink_pcs_link_up(pl->pcs, neg_mode, pl->cur_interface, speed, in phylink_link_up()
1475 /* The PCS may have a latching link-fail indicator. If the link in phylink_resolve()
1477 * Otherwise, re-read the PCS state to get the current status in phylink_resolve()
2149 * phylink_pcs_change() - notify phylink of a change to PCS link state
2150 * @pcs: pointer to &struct phylink_pcs
2153 * The PCS driver should call this when the state of its link changes
2159 void phylink_pcs_change(struct phylink_pcs *pcs, bool up) in phylink_pcs_change() argument
2161 struct phylink *pl = pcs->phylink; in phylink_pcs_change()
2164 phylink_link_changed(pl, up, "pcs"); in phylink_pcs_change()
2273 phylink_pcs_disable(pl->pcs); in phylink_stop()
2496 /* The MAC is reporting the link results from its own PCS in phylink_ethtool_ksettings_get()
3280 /* Find the union of the supported interfaces by the PCS/MAC and in phylink_sfp_config_optical()
3549 * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
3553 * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
3592 * phylink_decode_usgmii_word() - decode the USGMII word from a MAC PCS
3596 * Helper for MAC PCS supporting the USGMII protocol and the auto-negotiation
3627 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
3632 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3677 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
3678 * @pcs: a pointer to a &struct mdio_device.
3681 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3684 * Read the MAC PCS state from the MII device configured in @config and
3690 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c22_pcs_get_state() argument
3695 bmsr = mdiodev_read(pcs, MII_BMSR); in phylink_mii_c22_pcs_get_state()
3696 lpa = mdiodev_read(pcs, MII_LPA); in phylink_mii_c22_pcs_get_state()
3707 * phylink_mii_c22_pcs_encode_advertisement() - configure the clause 37 PCS
3712 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3715 * Encode the clause 37 PCS advertisement as specified by @interface and
3747 * phylink_mii_c22_pcs_config() - configure clause 22 PCS
3748 * @pcs: a pointer to a &struct mdio_device.
3751 * @neg_mode: PCS negotiation mode
3753 * Configure a Clause 22 PCS PHY with the appropriate negotiation
3758 int phylink_mii_c22_pcs_config(struct mdio_device *pcs, in phylink_mii_c22_pcs_config() argument
3769 ret = mdiobus_modify_changed(pcs->bus, pcs->addr, in phylink_mii_c22_pcs_config()
3782 ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); in phylink_mii_c22_pcs_config()
3792 * @pcs: a pointer to a &struct mdio_device.
3794 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3801 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) in phylink_mii_c22_pcs_an_restart() argument
3803 int val = mdiodev_read(pcs, MII_BMCR); in phylink_mii_c22_pcs_an_restart()
3808 mdiodev_write(pcs, MII_BMCR, val); in phylink_mii_c22_pcs_an_restart()
3813 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c45_pcs_get_state() argument
3816 struct mii_bus *bus = pcs->bus; in phylink_mii_c45_pcs_get_state()
3817 int addr = pcs->addr; in phylink_mii_c45_pcs_get_state()