Lines Matching full:pcs
51 struct phylink_pcs *pcs; member
655 struct phylink_pcs *pcs; in phylink_validate_mac_and_pcs() local
658 /* Get the PCS for this interface mode */ in phylink_validate_mac_and_pcs()
660 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_validate_mac_and_pcs()
661 if (IS_ERR(pcs)) in phylink_validate_mac_and_pcs()
662 return PTR_ERR(pcs); in phylink_validate_mac_and_pcs()
664 pcs = pl->pcs; in phylink_validate_mac_and_pcs()
667 if (pcs) { in phylink_validate_mac_and_pcs()
668 /* The PCS, if present, must be setup before phylink_create() in phylink_validate_mac_and_pcs()
672 if (!pcs->ops) { in phylink_validate_mac_and_pcs()
673 phylink_err(pl, "interface %s: uninitialised PCS\n", in phylink_validate_mac_and_pcs()
679 /* Validate the link parameters with the PCS */ in phylink_validate_mac_and_pcs()
680 if (pcs->ops->pcs_validate) { in phylink_validate_mac_and_pcs()
681 ret = pcs->ops->pcs_validate(pcs, supported, state); in phylink_validate_mac_and_pcs()
980 static void phylink_pcs_pre_config(struct phylink_pcs *pcs, in phylink_pcs_pre_config() argument
983 if (pcs && pcs->ops->pcs_pre_config) in phylink_pcs_pre_config()
984 pcs->ops->pcs_pre_config(pcs, interface); in phylink_pcs_pre_config()
987 static int phylink_pcs_post_config(struct phylink_pcs *pcs, in phylink_pcs_post_config() argument
992 if (pcs && pcs->ops->pcs_post_config) in phylink_pcs_post_config()
993 err = pcs->ops->pcs_post_config(pcs, interface); in phylink_pcs_post_config()
998 static void phylink_pcs_disable(struct phylink_pcs *pcs) in phylink_pcs_disable() argument
1000 if (pcs && pcs->ops->pcs_disable) in phylink_pcs_disable()
1001 pcs->ops->pcs_disable(pcs); in phylink_pcs_disable()
1004 static int phylink_pcs_enable(struct phylink_pcs *pcs) in phylink_pcs_enable() argument
1008 if (pcs && pcs->ops->pcs_enable) in phylink_pcs_enable()
1009 err = pcs->ops->pcs_enable(pcs); in phylink_pcs_enable()
1014 static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_config() argument
1018 if (!pcs) in phylink_pcs_config()
1021 return pcs->ops->pcs_config(pcs, neg_mode, state->interface, in phylink_pcs_config()
1025 static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, in phylink_pcs_link_up() argument
1029 if (pcs && pcs->ops->pcs_link_up) in phylink_pcs_link_up()
1030 pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); in phylink_pcs_link_up()
1041 if (pl->pcs && pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) in phylink_pcs_poll_start()
1070 if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, in phylink_pcs_an_restart()
1074 pl->pcs->ops->pcs_an_restart(pl->pcs); in phylink_pcs_an_restart()
1078 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
1083 * Determines the negotiation mode to be used by the PCS, and returns
1093 * Note: this is for cases where the PCS itself is involved in negotiation
1146 struct phylink_pcs *pcs = NULL; in phylink_major_config() local
1159 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); in phylink_major_config()
1160 if (IS_ERR(pcs)) { in phylink_major_config()
1163 pcs); in phylink_major_config()
1167 pcs_changed = pcs && pl->pcs != pcs; in phylink_major_config()
1182 /* If we have a new PCS, switch to the new PCS after preparing the MAC in phylink_major_config()
1186 phylink_pcs_disable(pl->pcs); in phylink_major_config()
1188 if (pl->pcs) in phylink_major_config()
1189 pl->pcs->phylink = NULL; in phylink_major_config()
1191 pcs->phylink = pl; in phylink_major_config()
1193 pl->pcs = pcs; in phylink_major_config()
1196 if (pl->pcs) in phylink_major_config()
1197 phylink_pcs_pre_config(pl->pcs, state->interface); in phylink_major_config()
1201 if (pl->pcs) in phylink_major_config()
1202 phylink_pcs_post_config(pl->pcs, state->interface); in phylink_major_config()
1205 phylink_pcs_enable(pl->pcs); in phylink_major_config()
1208 if (pl->pcs && pl->pcs->neg_mode) in phylink_major_config()
1211 err = phylink_pcs_config(pl->pcs, neg_mode, state, in phylink_major_config()
1241 * If we have a separate PCS, we only need to call its pcs_config() method,
1259 /* Recompute the PCS neg mode */ in phylink_change_inband_advert()
1265 if (pl->pcs->neg_mode) in phylink_change_inband_advert()
1268 /* Modern PCS-based method; update the advert at the PCS, and in phylink_change_inband_advert()
1272 ret = phylink_pcs_config(pl->pcs, neg_mode, &pl->link_config, in phylink_change_inband_advert()
1303 if (pl->pcs) in phylink_mac_pcs_get_state()
1304 pl->pcs->ops->pcs_get_state(pl->pcs, state); in phylink_mac_pcs_get_state()
1404 if (pl->pcs && pl->pcs->neg_mode) in phylink_link_up()
1407 phylink_pcs_link_up(pl->pcs, neg_mode, pl->cur_interface, speed, in phylink_link_up()
1472 /* The PCS may have a latching link-fail indicator. in phylink_resolve()
1475 * PCS state to get the current status of the link. in phylink_resolve()
2101 * phylink_pcs_change() - notify phylink of a change to PCS link state
2102 * @pcs: pointer to &struct phylink_pcs
2105 * The PCS driver should call this when the state of its link changes
2111 void phylink_pcs_change(struct phylink_pcs *pcs, bool up) in phylink_pcs_change() argument
2113 struct phylink *pl = pcs->phylink; in phylink_pcs_change()
2116 phylink_link_changed(pl, up, "pcs"); in phylink_pcs_change()
2225 phylink_pcs_disable(pl->pcs); in phylink_stop()
2422 /* The MAC is reporting the link results from its own PCS in phylink_ethtool_ksettings_get()
3216 /* Find the union of the supported interfaces by the PCS/MAC and in phylink_sfp_config_optical()
3499 * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
3503 * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
3542 * phylink_decode_usgmii_word() - decode the USGMII word from a MAC PCS
3546 * Helper for MAC PCS supporting the USGMII protocol and the auto-negotiation
3577 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
3582 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3627 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
3628 * @pcs: a pointer to a &struct mdio_device.
3631 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3634 * Read the MAC PCS state from the MII device configured in @config and
3640 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c22_pcs_get_state() argument
3645 bmsr = mdiodev_read(pcs, MII_BMSR); in phylink_mii_c22_pcs_get_state()
3646 lpa = mdiodev_read(pcs, MII_LPA); in phylink_mii_c22_pcs_get_state()
3657 * phylink_mii_c22_pcs_encode_advertisement() - configure the clause 37 PCS
3662 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3665 * Encode the clause 37 PCS advertisement as specified by @interface and
3697 * phylink_mii_c22_pcs_config() - configure clause 22 PCS
3698 * @pcs: a pointer to a &struct mdio_device.
3701 * @neg_mode: PCS negotiation mode
3703 * Configure a Clause 22 PCS PHY with the appropriate negotiation
3708 int phylink_mii_c22_pcs_config(struct mdio_device *pcs, in phylink_mii_c22_pcs_config() argument
3719 ret = mdiobus_modify_changed(pcs->bus, pcs->addr, in phylink_mii_c22_pcs_config()
3732 ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); in phylink_mii_c22_pcs_config()
3742 * @pcs: a pointer to a &struct mdio_device.
3744 * Helper for MAC PCS supporting the 802.3 clause 22 register set for
3751 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) in phylink_mii_c22_pcs_an_restart() argument
3753 int val = mdiodev_read(pcs, MII_BMCR); in phylink_mii_c22_pcs_an_restart()
3758 mdiodev_write(pcs, MII_BMCR, val); in phylink_mii_c22_pcs_an_restart()
3763 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, in phylink_mii_c45_pcs_get_state() argument
3766 struct mii_bus *bus = pcs->bus; in phylink_mii_c45_pcs_get_state()
3767 int addr = pcs->addr; in phylink_mii_c45_pcs_get_state()