Lines Matching +full:ether +full:- +full:link +full:- +full:active +full:- +full:low

4  * Copyright (c) 2014-2016,2020 Advanced Micro Devices, Inc.
26 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
83 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
116 #include "xgbe-common.h"
179 switch (pdata->an_mode) { in xgbe_an_enable_interrupts()
204 pdata->hw_if.set_speed(pdata, SPEED_10000); in xgbe_kr_mode()
207 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_KR); in xgbe_kr_mode()
214 pdata->hw_if.set_speed(pdata, SPEED_2500); in xgbe_kx_2500_mode()
217 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_KX_2500); in xgbe_kx_2500_mode()
224 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_kx_1000_mode()
227 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_KX_1000); in xgbe_kx_1000_mode()
233 /* If a KR re-driver is present, change to KR mode instead */ in xgbe_sfi_mode()
234 if (pdata->kr_redrv) in xgbe_sfi_mode()
238 pdata->hw_if.set_speed(pdata, SPEED_10000); in xgbe_sfi_mode()
241 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SFI); in xgbe_sfi_mode()
248 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_x_mode()
251 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_X); in xgbe_x_mode()
258 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_sgmii_1000_mode()
261 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SGMII_1000); in xgbe_sgmii_1000_mode()
268 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_sgmii_100_mode()
271 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SGMII_100); in xgbe_sgmii_100_mode()
277 return (pdata->phy_if.phy_impl.cur_mode(pdata)); in xgbe_cur_mode()
321 xgbe_change_mode(pdata, pdata->phy_if.phy_impl.switch_mode(pdata)); in xgbe_switch_mode()
338 return (pdata->phy_if.phy_impl.use_mode(pdata, mode)); in xgbe_use_mode()
408 pdata->an_start = 0; in xgbe_an73_disable()
414 if (pdata->phy_if.phy_impl.an_pre) in xgbe_an_restart()
415 pdata->phy_if.phy_impl.an_pre(pdata); in xgbe_an_restart()
417 switch (pdata->an_mode) { in xgbe_an_restart()
434 if (pdata->phy_if.phy_impl.an_post) in xgbe_an_disable()
435 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an_disable()
437 switch (pdata->an_mode) { in xgbe_an_disable()
476 reg |= pdata->fec_ability; in xgbe_an73_tx_training()
481 if (pdata->phy_if.phy_impl.kr_training_pre) in xgbe_an73_tx_training()
482 pdata->phy_if.phy_impl.kr_training_pre(pdata); in xgbe_an73_tx_training()
490 if (pdata->phy_if.phy_impl.kr_training_post) in xgbe_an73_tx_training()
491 pdata->phy_if.phy_impl.kr_training_post(pdata); in xgbe_an73_tx_training()
559 if (!pdata->an_start) { in xgbe_an73_page_received()
560 pdata->an_start = ticks; in xgbe_an73_page_received()
562 an_timeout = pdata->an_start + in xgbe_an73_page_received()
564 if ((int)(ticks - an_timeout) > 0) { in xgbe_an73_page_received()
565 /* Auto-negotiation timed out, reset state */ in xgbe_an73_page_received()
566 pdata->kr_state = XGBE_RX_BPA; in xgbe_an73_page_received()
567 pdata->kx_state = XGBE_RX_BPA; in xgbe_an73_page_received()
569 pdata->an_start = ticks; in xgbe_an73_page_received()
575 state = xgbe_in_kr_mode(pdata) ? &pdata->kr_state : &pdata->kx_state; in xgbe_an73_page_received()
598 pdata->kr_state = XGBE_RX_ERROR; in xgbe_an73_incompat_link()
600 if (!(XGBE_ADV(&pdata->phy, 1000baseKX_Full)) && in xgbe_an73_incompat_link()
601 !(XGBE_ADV(&pdata->phy, 2500baseX_Full))) in xgbe_an73_incompat_link()
604 if (pdata->kx_state != XGBE_RX_BPA) in xgbe_an73_incompat_link()
607 pdata->kx_state = XGBE_RX_ERROR; in xgbe_an73_incompat_link()
609 if (!(XGBE_ADV(&pdata->phy, 10000baseKR_Full))) in xgbe_an73_incompat_link()
612 if (pdata->kr_state != XGBE_RX_BPA) in xgbe_an73_incompat_link()
635 pdata->an_int = reg & XGBE_AN_CL37_INT_MASK; in xgbe_an37_isr()
636 pdata->an_status = reg & ~XGBE_AN_CL37_INT_MASK; in xgbe_an37_isr()
638 if (pdata->an_int) { in xgbe_an37_isr()
649 if (pdata->vdata->irq_reissue_support) in xgbe_an37_isr()
661 pdata->an_int = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_INT); in xgbe_an73_isr()
663 if (pdata->an_int) { in xgbe_an73_isr()
665 XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_INT, ~pdata->an_int); in xgbe_an73_isr()
673 if (pdata->vdata->irq_reissue_support) in xgbe_an73_isr()
685 switch (pdata->an_mode) { in xgbe_an_isr_task()
712 return ("Page-Received"); in xgbe_state_as_string()
714 return ("Incompatible-Link"); in xgbe_state_as_string()
718 return ("No-Link"); in xgbe_state_as_string()
729 enum xgbe_an cur_state = pdata->an_state; in xgbe_an37_state_machine()
731 if (!pdata->an_int) in xgbe_an37_state_machine()
734 if (pdata->an_int & XGBE_AN_CL37_INT_CMPLT) { in xgbe_an37_state_machine()
735 pdata->an_state = XGBE_AN_COMPLETE; in xgbe_an37_state_machine()
736 pdata->an_int &= ~XGBE_AN_CL37_INT_CMPLT; in xgbe_an37_state_machine()
740 xgbe_state_as_string(pdata->an_state)); in xgbe_an37_state_machine()
742 cur_state = pdata->an_state; in xgbe_an37_state_machine()
744 switch (pdata->an_state) { in xgbe_an37_state_machine()
756 pdata->an_state = XGBE_AN_ERROR; in xgbe_an37_state_machine()
759 if (pdata->an_state == XGBE_AN_ERROR) { in xgbe_an37_state_machine()
760 axgbe_printf(2, "error during auto-negotiation, state=%u\n", in xgbe_an37_state_machine()
763 pdata->an_int = 0; in xgbe_an37_state_machine()
767 if (pdata->an_state >= XGBE_AN_COMPLETE) { in xgbe_an37_state_machine()
768 pdata->an_result = pdata->an_state; in xgbe_an37_state_machine()
769 pdata->an_state = XGBE_AN_READY; in xgbe_an37_state_machine()
771 if (pdata->phy_if.phy_impl.an_post) in xgbe_an37_state_machine()
772 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an37_state_machine()
775 xgbe_state_as_string(pdata->an_result)); in xgbe_an37_state_machine()
779 __func__, pdata->an_state, pdata->an_int, pdata->an_mode, in xgbe_an37_state_machine()
780 pdata->an_status); in xgbe_an37_state_machine()
788 enum xgbe_an cur_state = pdata->an_state; in xgbe_an73_state_machine()
790 if (!pdata->an_int) in xgbe_an73_state_machine()
794 if (pdata->an_int & XGBE_AN_CL73_PG_RCV) { in xgbe_an73_state_machine()
795 pdata->an_state = XGBE_AN_PAGE_RECEIVED; in xgbe_an73_state_machine()
796 pdata->an_int &= ~XGBE_AN_CL73_PG_RCV; in xgbe_an73_state_machine()
797 } else if (pdata->an_int & XGBE_AN_CL73_INC_LINK) { in xgbe_an73_state_machine()
798 pdata->an_state = XGBE_AN_INCOMPAT_LINK; in xgbe_an73_state_machine()
799 pdata->an_int &= ~XGBE_AN_CL73_INC_LINK; in xgbe_an73_state_machine()
800 } else if (pdata->an_int & XGBE_AN_CL73_INT_CMPLT) { in xgbe_an73_state_machine()
801 pdata->an_state = XGBE_AN_COMPLETE; in xgbe_an73_state_machine()
802 pdata->an_int &= ~XGBE_AN_CL73_INT_CMPLT; in xgbe_an73_state_machine()
804 pdata->an_state = XGBE_AN_ERROR; in xgbe_an73_state_machine()
809 xgbe_state_as_string(pdata->an_state)); in xgbe_an73_state_machine()
811 cur_state = pdata->an_state; in xgbe_an73_state_machine()
813 switch (pdata->an_state) { in xgbe_an73_state_machine()
815 pdata->an_supported = 0; in xgbe_an73_state_machine()
819 pdata->an_state = xgbe_an73_page_received(pdata); in xgbe_an73_state_machine()
820 pdata->an_supported++; in xgbe_an73_state_machine()
824 pdata->an_supported = 0; in xgbe_an73_state_machine()
825 pdata->parallel_detect = 0; in xgbe_an73_state_machine()
826 pdata->an_state = xgbe_an73_incompat_link(pdata); in xgbe_an73_state_machine()
830 pdata->parallel_detect = pdata->an_supported ? 0 : 1; in xgbe_an73_state_machine()
832 pdata->an_supported ? "Auto negotiation" in xgbe_an73_state_machine()
840 pdata->an_state = XGBE_AN_ERROR; in xgbe_an73_state_machine()
843 if (pdata->an_state == XGBE_AN_NO_LINK) { in xgbe_an73_state_machine()
844 pdata->an_int = 0; in xgbe_an73_state_machine()
846 } else if (pdata->an_state == XGBE_AN_ERROR) { in xgbe_an73_state_machine()
848 "error during auto-negotiation, state=%u\n", in xgbe_an73_state_machine()
851 pdata->an_int = 0; in xgbe_an73_state_machine()
855 if (pdata->an_state >= XGBE_AN_COMPLETE) { in xgbe_an73_state_machine()
856 pdata->an_result = pdata->an_state; in xgbe_an73_state_machine()
857 pdata->an_state = XGBE_AN_READY; in xgbe_an73_state_machine()
858 pdata->kr_state = XGBE_RX_BPA; in xgbe_an73_state_machine()
859 pdata->kx_state = XGBE_RX_BPA; in xgbe_an73_state_machine()
860 pdata->an_start = 0; in xgbe_an73_state_machine()
862 if (pdata->phy_if.phy_impl.an_post) in xgbe_an73_state_machine()
863 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an73_state_machine()
866 xgbe_state_as_string(pdata->an_result)); in xgbe_an73_state_machine()
869 if (cur_state != pdata->an_state) in xgbe_an73_state_machine()
872 if (pdata->an_int) in xgbe_an73_state_machine()
883 sx_xlock(&pdata->an_mutex); in xgbe_an_state_machine()
885 switch (pdata->an_mode) { in xgbe_an_state_machine()
899 if (pdata->vdata->irq_reissue_support) in xgbe_an_state_machine()
902 sx_xunlock(&pdata->an_mutex); in xgbe_an_state_machine()
911 pdata->phy_if.phy_impl.an_advertising(pdata, &local_phy); in xgbe_an37_init()
937 reg, pdata->an_mode); in xgbe_an37_init()
941 switch (pdata->an_mode) { in xgbe_an37_init()
957 (pdata->an_mode == XGBE_AN_MODE_CL37) ? "BaseX" : "SGMII"); in xgbe_an37_init()
964 * This local_phy is needed because phy-v2 alters the in xgbe_an73_init()
965 * advertising flag variable. so phy-v1 an_advertising is just copying in xgbe_an73_init()
970 pdata->phy_if.phy_impl.an_advertising(pdata, &local_phy); in xgbe_an73_init()
1020 pdata->an_mode = pdata->phy_if.phy_impl.an_mode(pdata); in xgbe_an_init()
1021 axgbe_printf(2, "%s: setting up an_mode %d\n", __func__, pdata->an_mode); in xgbe_an_init()
1023 switch (pdata->an_mode) { in xgbe_an_init()
1040 if (pdata->tx_pause && pdata->rx_pause) in xgbe_phy_fc_string()
1042 else if (pdata->rx_pause) in xgbe_phy_fc_string()
1044 else if (pdata->tx_pause) in xgbe_phy_fc_string()
1072 if (pdata->phy.link) in xgbe_phy_print_status()
1074 "Link is UP - %s/%s - flow control %s\n", in xgbe_phy_print_status()
1075 xgbe_phy_speed_string(pdata->phy.speed), in xgbe_phy_print_status()
1076 pdata->phy.duplex == DUPLEX_FULL ? "Full" : "Half", in xgbe_phy_print_status()
1079 axgbe_printf(0, "Link is DOWN\n"); in xgbe_phy_print_status()
1087 axgbe_printf(1, "link %d/%d tx %d/%d rx %d/%d speed %d/%d autoneg %d/%d\n", in xgbe_phy_adjust_link()
1088 pdata->phy_link, pdata->phy.link, in xgbe_phy_adjust_link()
1089 pdata->tx_pause, pdata->phy.tx_pause, in xgbe_phy_adjust_link()
1090 pdata->rx_pause, pdata->phy.rx_pause, in xgbe_phy_adjust_link()
1091 pdata->phy_speed, pdata->phy.speed, in xgbe_phy_adjust_link()
1092 pdata->pause_autoneg, pdata->phy.pause_autoneg); in xgbe_phy_adjust_link()
1094 if (pdata->phy.link) { in xgbe_phy_adjust_link()
1096 pdata->pause_autoneg = pdata->phy.pause_autoneg; in xgbe_phy_adjust_link()
1098 if (pdata->tx_pause != pdata->phy.tx_pause) { in xgbe_phy_adjust_link()
1100 axgbe_printf(2, "tx pause %d/%d\n", pdata->tx_pause, in xgbe_phy_adjust_link()
1101 pdata->phy.tx_pause); in xgbe_phy_adjust_link()
1102 pdata->tx_pause = pdata->phy.tx_pause; in xgbe_phy_adjust_link()
1103 pdata->hw_if.config_tx_flow_control(pdata); in xgbe_phy_adjust_link()
1106 if (pdata->rx_pause != pdata->phy.rx_pause) { in xgbe_phy_adjust_link()
1108 axgbe_printf(2, "rx pause %d/%d\n", pdata->rx_pause, in xgbe_phy_adjust_link()
1109 pdata->phy.rx_pause); in xgbe_phy_adjust_link()
1110 pdata->rx_pause = pdata->phy.rx_pause; in xgbe_phy_adjust_link()
1111 pdata->hw_if.config_rx_flow_control(pdata); in xgbe_phy_adjust_link()
1115 if (pdata->phy_speed != pdata->phy.speed) { in xgbe_phy_adjust_link()
1117 pdata->phy_speed = pdata->phy.speed; in xgbe_phy_adjust_link()
1120 if (pdata->phy_link != pdata->phy.link) { in xgbe_phy_adjust_link()
1122 pdata->phy_link = pdata->phy.link; in xgbe_phy_adjust_link()
1124 } else if (pdata->phy_link) { in xgbe_phy_adjust_link()
1126 pdata->phy_link = 0; in xgbe_phy_adjust_link()
1127 pdata->phy_speed = SPEED_UNKNOWN; in xgbe_phy_adjust_link()
1130 axgbe_printf(2, "phy_link %d Link %d new_state %d\n", pdata->phy_link, in xgbe_phy_adjust_link()
1131 pdata->phy.link, new_state); in xgbe_phy_adjust_link()
1140 return (pdata->phy_if.phy_impl.valid_speed(pdata, speed)); in xgbe_phy_valid_speed()
1150 /* Disable auto-negotiation */ in xgbe_phy_config_fixed()
1154 mode = pdata->phy_if.phy_impl.get_mode(pdata, pdata->phy.speed); in xgbe_phy_config_fixed()
1166 return (-EINVAL); in xgbe_phy_config_fixed()
1170 if (pdata->phy.duplex != DUPLEX_FULL) in xgbe_phy_config_fixed()
1171 return (-EINVAL); in xgbe_phy_config_fixed()
1184 sx_xlock(&pdata->an_mutex); in __xgbe_phy_config_aneg()
1186 set_bit(XGBE_LINK_INIT, &pdata->dev_state); in __xgbe_phy_config_aneg()
1187 pdata->link_check = ticks; in __xgbe_phy_config_aneg()
1189 ret = pdata->phy_if.phy_impl.an_config(pdata); in __xgbe_phy_config_aneg()
1195 if (pdata->phy.autoneg != AUTONEG_ENABLE) { in __xgbe_phy_config_aneg()
1197 if (ret || !pdata->kr_redrv) { in __xgbe_phy_config_aneg()
1207 /* Disable auto-negotiation interrupt */ in __xgbe_phy_config_aneg()
1213 /* Clear any auto-negotitation interrupts */ in __xgbe_phy_config_aneg()
1216 /* Start auto-negotiation in a supported mode */ in __xgbe_phy_config_aneg()
1218 /* Start auto-negotiation in a supported mode */ in __xgbe_phy_config_aneg()
1235 ret = -EINVAL; in __xgbe_phy_config_aneg()
1240 /* Disable and stop any in progress auto-negotiation */ in __xgbe_phy_config_aneg()
1243 /* Clear any auto-negotitation interrupts */ in __xgbe_phy_config_aneg()
1246 pdata->an_result = XGBE_AN_READY; in __xgbe_phy_config_aneg()
1247 pdata->an_state = XGBE_AN_READY; in __xgbe_phy_config_aneg()
1248 pdata->kr_state = XGBE_RX_BPA; in __xgbe_phy_config_aneg()
1249 pdata->kx_state = XGBE_RX_BPA; in __xgbe_phy_config_aneg()
1251 /* Re-enable auto-negotiation interrupt */ in __xgbe_phy_config_aneg()
1258 /* Enable and start auto-negotiation */ in __xgbe_phy_config_aneg()
1265 set_bit(XGBE_LINK_ERR, &pdata->dev_state); in __xgbe_phy_config_aneg()
1267 clear_bit(XGBE_LINK_ERR, &pdata->dev_state); in __xgbe_phy_config_aneg()
1269 sx_unlock(&pdata->an_mutex); in __xgbe_phy_config_aneg()
1289 return (pdata->an_result == XGBE_AN_COMPLETE); in xgbe_phy_aneg_done()
1297 link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * hz); in xgbe_check_link_timeout()
1298 if ((int)(ticks - link_timeout) > 0) { in xgbe_check_link_timeout()
1299 axgbe_printf(2, "AN link timeout\n"); in xgbe_check_link_timeout()
1307 return (pdata->phy_if.phy_impl.an_outcome(pdata)); in xgbe_phy_status_aneg()
1315 XGBE_ZERO_LP_ADV(&pdata->phy); in xgbe_phy_status_result()
1317 if ((pdata->phy.autoneg != AUTONEG_ENABLE) || pdata->parallel_detect) in xgbe_phy_status_result()
1325 pdata->phy.speed = SPEED_100; in xgbe_phy_status_result()
1330 pdata->phy.speed = SPEED_1000; in xgbe_phy_status_result()
1333 pdata->phy.speed = SPEED_2500; in xgbe_phy_status_result()
1337 pdata->phy.speed = SPEED_10000; in xgbe_phy_status_result()
1342 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_status_result()
1345 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_status_result()
1346 axgbe_printf(2, "%s: speed %d duplex %d\n", __func__, pdata->phy.speed, in xgbe_phy_status_result()
1347 pdata->phy.duplex); in xgbe_phy_status_result()
1349 if (xgbe_set_mode(pdata, mode) && pdata->an_again) in xgbe_phy_status_result()
1359 if (test_bit(XGBE_LINK_ERR, &pdata->dev_state)) { in xgbe_phy_status()
1361 pdata->phy.link = 0; in xgbe_phy_status()
1362 clear_bit(XGBE_LINK_ERR, &pdata->dev_state); in xgbe_phy_status()
1366 link_aneg = (pdata->phy.autoneg == AUTONEG_ENABLE); in xgbe_phy_status()
1367 axgbe_printf(3, "link_aneg - %d\n", link_aneg); in xgbe_phy_status()
1369 /* Get the link status. Link status is latched low, so read in xgbe_phy_status()
1372 pdata->phy.link = pdata->phy_if.phy_impl.link_status(pdata, in xgbe_phy_status()
1375 axgbe_printf(1, "link_status returned Link:%d an_restart:%d aneg:%d\n", in xgbe_phy_status()
1376 pdata->phy.link, an_restart, link_aneg); in xgbe_phy_status()
1383 if (pdata->phy.link) { in xgbe_phy_status()
1384 axgbe_printf(2, "Link Active\n"); in xgbe_phy_status()
1391 axgbe_printf(2, "%s: Link write phy_status result\n", __func__); in xgbe_phy_status()
1394 if (test_bit(XGBE_LINK_INIT, &pdata->dev_state)) in xgbe_phy_status()
1395 clear_bit(XGBE_LINK_INIT, &pdata->dev_state); in xgbe_phy_status()
1398 axgbe_printf(2, "Link Deactive\n"); in xgbe_phy_status()
1399 if (test_bit(XGBE_LINK_INIT, &pdata->dev_state)) { in xgbe_phy_status()
1414 axgbe_printf(2, "%s: Link %d\n", __func__, pdata->phy.link); in xgbe_phy_status()
1423 if (!pdata->phy_started) in xgbe_phy_stop()
1427 pdata->phy_started = 0; in xgbe_phy_stop()
1429 /* Disable auto-negotiation */ in xgbe_phy_stop()
1432 pdata->phy_if.phy_impl.stop(pdata); in xgbe_phy_stop()
1434 pdata->phy.link = 0; in xgbe_phy_stop()
1444 if (pdata->phy_started) in xgbe_phy_start()
1447 DBGPR("-->xgbe_phy_start\n"); in xgbe_phy_start()
1449 ret = pdata->phy_if.phy_impl.start(pdata); in xgbe_phy_start()
1455 /* Set initial mode - call the mode setting routines in xgbe_phy_start()
1481 ret = -EINVAL; in xgbe_phy_start()
1486 pdata->phy_started = 1; in xgbe_phy_start()
1491 /* Enable auto-negotiation interrupts */ in xgbe_phy_start()
1501 pdata->phy_if.phy_impl.stop(pdata); in xgbe_phy_start()
1511 ret = pdata->phy_if.phy_impl.reset(pdata); in xgbe_phy_reset()
1517 /* Disable auto-negotiation for now */ in xgbe_phy_reset()
1520 /* Clear auto-negotiation interrupts */ in xgbe_phy_reset()
1530 if (XGBE_ADV(&pdata->phy, 10000baseKR_Full)) in xgbe_phy_best_advertised_speed()
1532 else if (XGBE_ADV(&pdata->phy, 10000baseT_Full)) in xgbe_phy_best_advertised_speed()
1534 else if (XGBE_ADV(&pdata->phy, 2500baseX_Full)) in xgbe_phy_best_advertised_speed()
1536 else if (XGBE_ADV(&pdata->phy, 2500baseT_Full)) in xgbe_phy_best_advertised_speed()
1538 else if (XGBE_ADV(&pdata->phy, 1000baseKX_Full)) in xgbe_phy_best_advertised_speed()
1540 else if (XGBE_ADV(&pdata->phy, 1000baseT_Full)) in xgbe_phy_best_advertised_speed()
1542 else if (XGBE_ADV(&pdata->phy, 100baseT_Full)) in xgbe_phy_best_advertised_speed()
1551 pdata->phy_if.phy_impl.exit(pdata); in xgbe_phy_exit()
1559 DBGPR("-->xgbe_phy_init\n"); in xgbe_phy_init()
1561 sx_init(&pdata->an_mutex, "axgbe AN lock"); in xgbe_phy_init()
1562 pdata->mdio_mmd = MDIO_MMD_PCS; in xgbe_phy_init()
1565 pdata->fec_ability = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, in xgbe_phy_init()
1567 pdata->fec_ability &= (MDIO_PMA_10GBR_FECABLE_ABLE | in xgbe_phy_init()
1571 ret = pdata->phy_if.phy_impl.init(pdata); in xgbe_phy_init()
1575 /* Copy supported link modes to advertising link modes */ in xgbe_phy_init()
1576 XGBE_LM_COPY(&pdata->phy, advertising, &pdata->phy, supported); in xgbe_phy_init()
1578 pdata->phy.address = 0; in xgbe_phy_init()
1580 if (XGBE_ADV(&pdata->phy, Autoneg)) { in xgbe_phy_init()
1581 pdata->phy.autoneg = AUTONEG_ENABLE; in xgbe_phy_init()
1582 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_init()
1583 pdata->phy.duplex = DUPLEX_UNKNOWN; in xgbe_phy_init()
1585 pdata->phy.autoneg = AUTONEG_DISABLE; in xgbe_phy_init()
1586 pdata->phy.speed = xgbe_phy_best_advertised_speed(pdata); in xgbe_phy_init()
1587 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_init()
1590 pdata->phy_started = 0; in xgbe_phy_init()
1591 pdata->phy.link = 0; in xgbe_phy_init()
1593 pdata->phy.pause_autoneg = pdata->pause_autoneg; in xgbe_phy_init()
1594 pdata->phy.tx_pause = pdata->tx_pause; in xgbe_phy_init()
1595 pdata->phy.rx_pause = pdata->rx_pause; in xgbe_phy_init()
1598 XGBE_CLR_ADV(&pdata->phy, Pause); in xgbe_phy_init()
1599 XGBE_CLR_ADV(&pdata->phy, Asym_Pause); in xgbe_phy_init()
1601 if (pdata->rx_pause) { in xgbe_phy_init()
1602 XGBE_SET_ADV(&pdata->phy, Pause); in xgbe_phy_init()
1603 XGBE_SET_ADV(&pdata->phy, Asym_Pause); in xgbe_phy_init()
1606 if (pdata->tx_pause) { in xgbe_phy_init()
1607 if (XGBE_ADV(&pdata->phy, Asym_Pause)) in xgbe_phy_init()
1608 XGBE_CLR_ADV(&pdata->phy, Asym_Pause); in xgbe_phy_init()
1610 XGBE_SET_ADV(&pdata->phy, Asym_Pause); in xgbe_phy_init()
1619 phy_if->phy_init = xgbe_phy_init; in xgbe_init_function_ptrs_phy()
1620 phy_if->phy_exit = xgbe_phy_exit; in xgbe_init_function_ptrs_phy()
1622 phy_if->phy_reset = xgbe_phy_reset; in xgbe_init_function_ptrs_phy()
1623 phy_if->phy_start = xgbe_phy_start; in xgbe_init_function_ptrs_phy()
1624 phy_if->phy_stop = xgbe_phy_stop; in xgbe_init_function_ptrs_phy()
1626 phy_if->phy_status = xgbe_phy_status; in xgbe_init_function_ptrs_phy()
1627 phy_if->phy_config_aneg = xgbe_phy_config_aneg; in xgbe_init_function_ptrs_phy()
1629 phy_if->phy_valid_speed = xgbe_phy_valid_speed; in xgbe_init_function_ptrs_phy()
1631 phy_if->an_isr = xgbe_an_combined_isr; in xgbe_init_function_ptrs_phy()