Lines Matching full:pcs
51 struct phylink_pcs *pcs; member
660 struct phylink_pcs *pcs; in phylink_validate_mac_and_pcs() local
663 /* Get the PCS for this interface mode */ in phylink_validate_mac_and_pcs()
665 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_validate_mac_and_pcs()
666 if (IS_ERR(pcs)) in phylink_validate_mac_and_pcs()
667 return PTR_ERR(pcs); in phylink_validate_mac_and_pcs()
669 pcs = pl->pcs; in phylink_validate_mac_and_pcs()
672 if (pcs) { in phylink_validate_mac_and_pcs()
673 /* The PCS, if present, must be setup before phylink_create() in phylink_validate_mac_and_pcs()
677 if (!pcs->ops) { in phylink_validate_mac_and_pcs()
678 phylink_err(pl, "interface %s: uninitialised PCS\n", in phylink_validate_mac_and_pcs()
684 /* Validate the link parameters with the PCS */ in phylink_validate_mac_and_pcs()
685 if (pcs->ops->pcs_validate) { in phylink_validate_mac_and_pcs()
686 ret = pcs->ops->pcs_validate(pcs, supported, state); in phylink_validate_mac_and_pcs()
991 static void phylink_pcs_pre_config(struct phylink_pcs *pcs, in phylink_pcs_pre_config() argument
994 if (pcs && pcs->ops->pcs_pre_config) in phylink_pcs_pre_config()
995 pcs->ops->pcs_pre_config(pcs, interface); in phylink_pcs_pre_config()
998 static int phylink_pcs_post_config(struct phylink_pcs *pcs, in phylink_pcs_post_config() argument
1003 if (pcs && pcs->ops->pcs_post_config) in phylink_pcs_post_config()
1004 err = pcs->ops->pcs_post_config(pcs, interface); in phylink_pcs_post_config()
1009 static void phylink_pcs_disable(struct phylink_pcs *pcs) in phylink_pcs_disable() argument
1011 if (pcs && pcs->ops->pcs_disable) in phylink_pcs_disable()
1012 pcs->ops->pcs_disable(pcs); in phylink_pcs_disable()
1015 static int phylink_pcs_enable(struct phylink_pcs *pcs) in phylink_pcs_enable() argument
1019 if (pcs && pcs->ops->pcs_enable) in phylink_pcs_enable()
1020 err = pcs->ops->pcs_enable(pcs); in phylink_pcs_enable()
1025 static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_config() argument
1029 if (!pcs) in phylink_pcs_config()
1032 return pcs->ops->pcs_config(pcs, neg_mode, state->interface, in phylink_pcs_config()
1036 static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_link_up() argument
1040 if (pcs && pcs->ops->pcs_link_up) in phylink_pcs_link_up()
1041 pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); in phylink_pcs_link_up()
1052 if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) in phylink_pcs_poll_start()
1056 int phylink_pcs_pre_init(struct phylink *pl, struct phylink_pcs *pcs) in phylink_pcs_pre_init() argument
1060 /* Signal to PCS driver that MAC requires RX clock for init */ in phylink_pcs_pre_init()
1062 pcs->rxc_always_on = true; in phylink_pcs_pre_init()
1064 if (pcs->ops->pcs_pre_init) in phylink_pcs_pre_init()
1065 ret = pcs->ops->pcs_pre_init(pcs); in phylink_pcs_pre_init()
1096 if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, in phylink_pcs_an_restart()
1100 pl->pcs->ops->pcs_an_restart(pl->pcs); in phylink_pcs_an_restart()
1104 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
1109 * Determines the negotiation mode to be used by the PCS, and returns
1119 * Note: this is for cases where the PCS itself is involved in negotiation
1173 struct phylink_pcs *pcs = NULL; in phylink_major_config() local
1186 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_major_config()
1187 if (IS_ERR(pcs)) { in phylink_major_config()
1190 pcs); in phylink_major_config()
1194 pcs_changed = pcs && pl->pcs != pcs; in phylink_major_config()
1209 /* If we have a new PCS, switch to the new PCS after preparing the MAC in phylink_major_config()
1213 phylink_pcs_disable(pl->pcs); in phylink_major_config()
1215 if (pl->pcs) in phylink_major_config()
1216 pl->pcs->phylink = NULL; in phylink_major_config()
1218 pcs->phylink = pl; in phylink_major_config()
1220 pl->pcs = pcs; in phylink_major_config()
1223 if (pl->pcs) in phylink_major_config()
1224 phylink_pcs_pre_config(pl->pcs, state->interface); in phylink_major_config()
1228 if (pl->pcs) in phylink_major_config()
1229 phylink_pcs_post_config(pl->pcs, state->interface); in phylink_major_config()
1232 phylink_pcs_enable(pl->pcs); in phylink_major_config()
1235 if (pl->pcs && pl->pcs->neg_mode) in phylink_major_config()
1238 err = phylink_pcs_config(pl->pcs, neg_mode, state, in phylink_major_config()
1268 * If we have a separate PCS, we only need to call its pcs_config() method,
1286 /* Recompute the PCS neg mode */ in phylink_change_inband_advert()
1292 if (pl->pcs->neg_mode) in phylink_change_inband_advert()
1295 /* Modern PCS-based method; update the advert at the PCS, and in phylink_change_inband_advert()
1299 ret = phylink_pcs_config(pl->pcs, neg_mode, &pl->link_config, in phylink_change_inband_advert()
1330 if (pl->pcs) in phylink_mac_pcs_get_state()
1331 pl->pcs->ops->pcs_get_state(pl->pcs, state); in phylink_mac_pcs_get_state()
1431 if (pl->pcs && pl->pcs->neg_mode) in phylink_link_up()
1434 phylink_pcs_link_up(pl->pcs, neg_mode, pl->cur_interface, speed, in phylink_link_up()
1499 /* The PCS may have a latching link-fail indicator. in phylink_resolve()
1502 * PCS state to get the current status of the link. in phylink_resolve()
2183 * phylink_pcs_change() - notify phylink of a change to PCS link state
2184 * @pcs: pointer to &struct phylink_pcs
2187 * The PCS driver should call this when the state of its link changes
2193 void phylink_pcs_change(struct phylink_pcs *pcs, bool up) in phylink_pcs_change() argument
2195 struct phylink *pl = pcs->phylink; in phylink_pcs_change()
2198 phylink_link_changed(pl, up, "pcs"); in phylink_pcs_change()
2307 phylink_pcs_disable(pl->pcs); in phylink_stop()
2504 /* The MAC is reporting the link results from its own PCS in phylink_ethtool_ksettings_get()
3298 /* Find the union of the supported interfaces by the PCS/MAC and in phylink_sfp_config_optical()
3582 * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
3586 * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
3625 * phylink_decode_usgmii_word() - decode the USGMII word from a MAC PCS
3629 * Helper for MAC PCS supporting the USGMII protocol and the auto-negotiation
3660 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
3665 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3710 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
3711 * @pcs: a pointer to a &struct mdio_device.
3714 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3717 * Read the MAC PCS state from the MII device configured in @config and
3723 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c22_pcs_get_state() argument
3728 bmsr = mdiodev_read(pcs, MII_BMSR); in phylink_mii_c22_pcs_get_state()
3729 lpa = mdiodev_read(pcs, MII_LPA); in phylink_mii_c22_pcs_get_state()
3740 * phylink_mii_c22_pcs_encode_advertisement() - configure the clause 37 PCS
3745 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3748 * Encode the clause 37 PCS advertisement as specified by @interface and
3780 * phylink_mii_c22_pcs_config() - configure clause 22 PCS
3781 * @pcs: a pointer to a &struct mdio_device.
3784 * @neg_mode: PCS negotiation mode
3786 * Configure a Clause 22 PCS PHY with the appropriate negotiation
3791 int phylink_mii_c22_pcs_config(struct mdio_device *pcs, in phylink_mii_c22_pcs_config() argument
3802 ret = mdiobus_modify_changed(pcs->bus, pcs->addr, in phylink_mii_c22_pcs_config()
3815 ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); in phylink_mii_c22_pcs_config()
3825 * @pcs: a pointer to a &struct mdio_device.
3827 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3834 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) in phylink_mii_c22_pcs_an_restart() argument
3836 int val = mdiodev_read(pcs, MII_BMCR); in phylink_mii_c22_pcs_an_restart()
3841 mdiodev_write(pcs, MII_BMCR, val); in phylink_mii_c22_pcs_an_restart()
3846 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c45_pcs_get_state() argument
3849 struct mii_bus *bus = pcs->bus; in phylink_mii_c45_pcs_get_state()
3850 int addr = pcs->addr; in phylink_mii_c45_pcs_get_state()