Lines Matching +full:auto +full:- +full:mode
9 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
59 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
127 #include "xgbe-common.h"
132 if (!pdata->phy_if.phy_impl.module_eeprom) in xgbe_phy_module_eeprom()
133 return -ENXIO; in xgbe_phy_module_eeprom()
135 return pdata->phy_if.phy_impl.module_eeprom(pdata, eeprom, data); in xgbe_phy_module_eeprom()
141 if (!pdata->phy_if.phy_impl.module_info) in xgbe_phy_module_info()
142 return -ENXIO; in xgbe_phy_module_info()
144 return pdata->phy_if.phy_impl.module_info(pdata, modinfo); in xgbe_phy_module_info()
199 switch (pdata->an_mode) { in xgbe_an_enable_interrupts()
222 pdata->hw_if.set_speed(pdata, SPEED_10000); in xgbe_kr_mode()
225 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_KR); in xgbe_kr_mode()
231 pdata->hw_if.set_speed(pdata, SPEED_2500); in xgbe_kx_2500_mode()
234 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_KX_2500); in xgbe_kx_2500_mode()
240 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_kx_1000_mode()
243 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_KX_1000); in xgbe_kx_1000_mode()
248 /* If a KR re-driver is present, change to KR mode instead */ in xgbe_sfi_mode()
249 if (pdata->kr_redrv) in xgbe_sfi_mode()
253 pdata->hw_if.set_speed(pdata, SPEED_10000); in xgbe_sfi_mode()
256 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SFI); in xgbe_sfi_mode()
262 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_x_mode()
265 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_X); in xgbe_x_mode()
271 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_sgmii_1000_mode()
274 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SGMII_1000); in xgbe_sgmii_1000_mode()
280 pdata->hw_if.set_speed(pdata, SPEED_10); in xgbe_sgmii_10_mode()
283 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SGMII_10); in xgbe_sgmii_10_mode()
289 pdata->hw_if.set_speed(pdata, SPEED_1000); in xgbe_sgmii_100_mode()
292 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SGMII_100); in xgbe_sgmii_100_mode()
297 return pdata->phy_if.phy_impl.cur_mode(pdata); in xgbe_cur_mode()
306 enum xgbe_mode mode) in xgbe_change_mode() argument
308 switch (mode) { in xgbe_change_mode()
336 netif_dbg(pdata, link, pdata->netdev, in xgbe_change_mode()
337 "invalid operation mode requested (%u)\n", mode); in xgbe_change_mode()
343 xgbe_change_mode(pdata, pdata->phy_if.phy_impl.switch_mode(pdata)); in xgbe_switch_mode()
347 enum xgbe_mode mode) in xgbe_set_mode() argument
349 if (mode == xgbe_cur_mode(pdata)) in xgbe_set_mode()
352 xgbe_change_mode(pdata, mode); in xgbe_set_mode()
358 enum xgbe_mode mode) in xgbe_use_mode() argument
360 return pdata->phy_if.phy_impl.use_mode(pdata, mode); in xgbe_use_mode()
385 netif_dbg(pdata, link, pdata->netdev, "CL37 AN enabled/restarted\n"); in xgbe_an37_restart()
393 netif_dbg(pdata, link, pdata->netdev, "CL37 AN disabled\n"); in xgbe_an37_disable()
424 netif_dbg(pdata, link, pdata->netdev, "CL73 AN enabled/restarted\n"); in xgbe_an73_restart()
432 pdata->an_start = 0; in xgbe_an73_disable()
434 netif_dbg(pdata, link, pdata->netdev, "CL73 AN disabled\n"); in xgbe_an73_disable()
439 if (pdata->phy_if.phy_impl.an_pre) in xgbe_an_restart()
440 pdata->phy_if.phy_impl.an_pre(pdata); in xgbe_an_restart()
442 switch (pdata->an_mode) { in xgbe_an_restart()
458 if (pdata->phy_if.phy_impl.an_post) in xgbe_an_disable()
459 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an_disable()
461 switch (pdata->an_mode) { in xgbe_an_disable()
488 /* If we're not in KR mode then we're done */ in xgbe_an73_tx_training()
499 reg |= pdata->fec_ability; in xgbe_an73_tx_training()
504 if (pdata->phy_if.phy_impl.kr_training_pre) in xgbe_an73_tx_training()
505 pdata->phy_if.phy_impl.kr_training_pre(pdata); in xgbe_an73_tx_training()
511 pdata->kr_start_time = jiffies; in xgbe_an73_tx_training()
513 netif_dbg(pdata, link, pdata->netdev, in xgbe_an73_tx_training()
516 if (pdata->phy_if.phy_impl.kr_training_post) in xgbe_an73_tx_training()
517 pdata->phy_if.phy_impl.kr_training_post(pdata); in xgbe_an73_tx_training()
548 /* Check for a supported mode, otherwise restart in a different one */ in xgbe_an73_rx_bpa()
584 if (!pdata->an_start) { in xgbe_an73_page_received()
585 pdata->an_start = jiffies; in xgbe_an73_page_received()
587 an_timeout = pdata->an_start + in xgbe_an73_page_received()
590 /* Auto-negotiation timed out, reset state */ in xgbe_an73_page_received()
591 pdata->kr_state = XGBE_RX_BPA; in xgbe_an73_page_received()
592 pdata->kx_state = XGBE_RX_BPA; in xgbe_an73_page_received()
594 pdata->an_start = jiffies; in xgbe_an73_page_received()
596 netif_dbg(pdata, link, pdata->netdev, in xgbe_an73_page_received()
601 state = xgbe_in_kr_mode(pdata) ? &pdata->kr_state in xgbe_an73_page_received()
602 : &pdata->kx_state; in xgbe_an73_page_received()
622 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_an73_incompat_link()
626 pdata->kr_state = XGBE_RX_ERROR; in xgbe_an73_incompat_link()
632 if (pdata->kx_state != XGBE_RX_BPA) in xgbe_an73_incompat_link()
635 pdata->kx_state = XGBE_RX_ERROR; in xgbe_an73_incompat_link()
640 if (pdata->kr_state != XGBE_RX_BPA) in xgbe_an73_incompat_link()
648 pdata->an_result = XGBE_AN_READY; in xgbe_an73_incompat_link()
664 pdata->an_int = reg & XGBE_AN_CL37_INT_MASK; in xgbe_an37_isr()
665 pdata->an_status = reg & ~XGBE_AN_CL37_INT_MASK; in xgbe_an37_isr()
667 if (pdata->an_int) { in xgbe_an37_isr()
672 queue_work(pdata->an_workqueue, &pdata->an_irq_work); in xgbe_an37_isr()
678 if (pdata->vdata->irq_reissue_support) in xgbe_an37_isr()
689 pdata->an_int = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_INT); in xgbe_an73_isr()
691 if (pdata->an_int) { in xgbe_an73_isr()
693 XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_INT, ~pdata->an_int); in xgbe_an73_isr()
695 queue_work(pdata->an_workqueue, &pdata->an_irq_work); in xgbe_an73_isr()
701 if (pdata->vdata->irq_reissue_support) in xgbe_an73_isr()
710 netif_dbg(pdata, intr, pdata->netdev, "AN interrupt received\n"); in xgbe_an_isr_bh_work()
712 switch (pdata->an_mode) { in xgbe_an_isr_bh_work()
730 if (pdata->isr_as_bh_work) in xgbe_an_isr()
731 queue_work(system_bh_wq, &pdata->an_bh_work); in xgbe_an_isr()
733 xgbe_an_isr_bh_work(&pdata->an_bh_work); in xgbe_an_isr()
740 xgbe_an_isr_bh_work(&pdata->an_bh_work); in xgbe_an_combined_isr()
754 flush_work(&pdata->an_work); in xgbe_an_irq_work()
755 queue_work(pdata->an_workqueue, &pdata->an_work); in xgbe_an_irq_work()
764 return "Page-Received"; in xgbe_state_as_string()
766 return "Incompatible-Link"; in xgbe_state_as_string()
770 return "No-Link"; in xgbe_state_as_string()
780 enum xgbe_an cur_state = pdata->an_state; in xgbe_an37_state_machine()
782 if (!pdata->an_int) in xgbe_an37_state_machine()
785 if (pdata->an_int & XGBE_AN_CL37_INT_CMPLT) { in xgbe_an37_state_machine()
786 pdata->an_state = XGBE_AN_COMPLETE; in xgbe_an37_state_machine()
787 pdata->an_int &= ~XGBE_AN_CL37_INT_CMPLT; in xgbe_an37_state_machine()
790 if ((pdata->an_mode == XGBE_AN_MODE_CL37_SGMII) && in xgbe_an37_state_machine()
791 !(pdata->an_status & XGBE_SGMII_AN_LINK_STATUS)) in xgbe_an37_state_machine()
792 pdata->an_state = XGBE_AN_NO_LINK; in xgbe_an37_state_machine()
795 netif_dbg(pdata, link, pdata->netdev, "CL37 AN %s\n", in xgbe_an37_state_machine()
796 xgbe_state_as_string(pdata->an_state)); in xgbe_an37_state_machine()
798 cur_state = pdata->an_state; in xgbe_an37_state_machine()
800 switch (pdata->an_state) { in xgbe_an37_state_machine()
805 netif_dbg(pdata, link, pdata->netdev, in xgbe_an37_state_machine()
806 "Auto negotiation successful\n"); in xgbe_an37_state_machine()
813 pdata->an_state = XGBE_AN_ERROR; in xgbe_an37_state_machine()
816 if (pdata->an_state == XGBE_AN_ERROR) { in xgbe_an37_state_machine()
817 netdev_err(pdata->netdev, in xgbe_an37_state_machine()
818 "error during auto-negotiation, state=%u\n", in xgbe_an37_state_machine()
821 pdata->an_int = 0; in xgbe_an37_state_machine()
825 if (pdata->an_state >= XGBE_AN_COMPLETE) { in xgbe_an37_state_machine()
826 pdata->an_result = pdata->an_state; in xgbe_an37_state_machine()
827 pdata->an_state = XGBE_AN_READY; in xgbe_an37_state_machine()
829 if (pdata->phy_if.phy_impl.an_post) in xgbe_an37_state_machine()
830 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an37_state_machine()
832 netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n", in xgbe_an37_state_machine()
833 xgbe_state_as_string(pdata->an_result)); in xgbe_an37_state_machine()
841 enum xgbe_an cur_state = pdata->an_state; in xgbe_an73_state_machine()
843 if (!pdata->an_int) in xgbe_an73_state_machine()
847 if (pdata->an_int & XGBE_AN_CL73_PG_RCV) { in xgbe_an73_state_machine()
848 pdata->an_state = XGBE_AN_PAGE_RECEIVED; in xgbe_an73_state_machine()
849 pdata->an_int &= ~XGBE_AN_CL73_PG_RCV; in xgbe_an73_state_machine()
850 } else if (pdata->an_int & XGBE_AN_CL73_INC_LINK) { in xgbe_an73_state_machine()
851 pdata->an_state = XGBE_AN_INCOMPAT_LINK; in xgbe_an73_state_machine()
852 pdata->an_int &= ~XGBE_AN_CL73_INC_LINK; in xgbe_an73_state_machine()
853 } else if (pdata->an_int & XGBE_AN_CL73_INT_CMPLT) { in xgbe_an73_state_machine()
854 pdata->an_state = XGBE_AN_COMPLETE; in xgbe_an73_state_machine()
855 pdata->an_int &= ~XGBE_AN_CL73_INT_CMPLT; in xgbe_an73_state_machine()
857 pdata->an_state = XGBE_AN_ERROR; in xgbe_an73_state_machine()
861 netif_dbg(pdata, link, pdata->netdev, "CL73 AN %s\n", in xgbe_an73_state_machine()
862 xgbe_state_as_string(pdata->an_state)); in xgbe_an73_state_machine()
864 cur_state = pdata->an_state; in xgbe_an73_state_machine()
866 switch (pdata->an_state) { in xgbe_an73_state_machine()
868 pdata->an_supported = 0; in xgbe_an73_state_machine()
872 pdata->an_state = xgbe_an73_page_received(pdata); in xgbe_an73_state_machine()
873 pdata->an_supported++; in xgbe_an73_state_machine()
877 pdata->an_supported = 0; in xgbe_an73_state_machine()
878 pdata->parallel_detect = 0; in xgbe_an73_state_machine()
879 pdata->an_state = xgbe_an73_incompat_link(pdata); in xgbe_an73_state_machine()
883 pdata->parallel_detect = pdata->an_supported ? 0 : 1; in xgbe_an73_state_machine()
884 netif_dbg(pdata, link, pdata->netdev, "%s successful\n", in xgbe_an73_state_machine()
885 pdata->an_supported ? "Auto negotiation" in xgbe_an73_state_machine()
893 pdata->an_state = XGBE_AN_ERROR; in xgbe_an73_state_machine()
896 if (pdata->an_state == XGBE_AN_NO_LINK) { in xgbe_an73_state_machine()
897 pdata->an_int = 0; in xgbe_an73_state_machine()
899 } else if (pdata->an_state == XGBE_AN_ERROR) { in xgbe_an73_state_machine()
900 netdev_err(pdata->netdev, in xgbe_an73_state_machine()
901 "error during auto-negotiation, state=%u\n", in xgbe_an73_state_machine()
904 pdata->an_int = 0; in xgbe_an73_state_machine()
908 if (pdata->an_state >= XGBE_AN_COMPLETE) { in xgbe_an73_state_machine()
909 pdata->an_result = pdata->an_state; in xgbe_an73_state_machine()
910 pdata->an_state = XGBE_AN_READY; in xgbe_an73_state_machine()
911 pdata->kr_state = XGBE_RX_BPA; in xgbe_an73_state_machine()
912 pdata->kx_state = XGBE_RX_BPA; in xgbe_an73_state_machine()
913 pdata->an_start = 0; in xgbe_an73_state_machine()
915 if (pdata->phy_if.phy_impl.an_post) in xgbe_an73_state_machine()
916 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an73_state_machine()
918 netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n", in xgbe_an73_state_machine()
919 xgbe_state_as_string(pdata->an_result)); in xgbe_an73_state_machine()
922 if (cur_state != pdata->an_state) in xgbe_an73_state_machine()
925 if (pdata->an_int) in xgbe_an73_state_machine()
937 mutex_lock(&pdata->an_mutex); in xgbe_an_state_machine()
939 switch (pdata->an_mode) { in xgbe_an_state_machine()
953 if (pdata->vdata->irq_reissue_support) in xgbe_an_state_machine()
956 mutex_unlock(&pdata->an_mutex); in xgbe_an_state_machine()
964 pdata->phy_if.phy_impl.an_advertising(pdata, &lks); in xgbe_an37_init()
989 switch (pdata->an_mode) { in xgbe_an37_init()
1004 netif_dbg(pdata, link, pdata->netdev, "CL37 AN (%s) initialized\n", in xgbe_an37_init()
1005 (pdata->an_mode == XGBE_AN_MODE_CL37) ? "BaseX" : "SGMII"); in xgbe_an37_init()
1013 pdata->phy_if.phy_impl.an_advertising(pdata, &lks); in xgbe_an73_init()
1056 netif_dbg(pdata, link, pdata->netdev, "CL73 AN initialized\n"); in xgbe_an73_init()
1062 pdata->an_mode = pdata->phy_if.phy_impl.an_mode(pdata); in xgbe_an_init()
1063 switch (pdata->an_mode) { in xgbe_an_init()
1079 if (pdata->tx_pause && pdata->rx_pause) in xgbe_phy_fc_string()
1081 else if (pdata->rx_pause) in xgbe_phy_fc_string()
1083 else if (pdata->tx_pause) in xgbe_phy_fc_string()
1111 if (pdata->phy.link) in xgbe_phy_print_status()
1112 netdev_info(pdata->netdev, in xgbe_phy_print_status()
1113 "Link is Up - %s/%s - flow control %s\n", in xgbe_phy_print_status()
1114 xgbe_phy_speed_string(pdata->phy.speed), in xgbe_phy_print_status()
1115 pdata->phy.duplex == DUPLEX_FULL ? "Full" : "Half", in xgbe_phy_print_status()
1118 netdev_info(pdata->netdev, "Link is Down\n"); in xgbe_phy_print_status()
1125 if (pdata->phy.link) { in xgbe_phy_adjust_link()
1127 pdata->pause_autoneg = pdata->phy.pause_autoneg; in xgbe_phy_adjust_link()
1129 if (pdata->tx_pause != pdata->phy.tx_pause) { in xgbe_phy_adjust_link()
1131 pdata->tx_pause = pdata->phy.tx_pause; in xgbe_phy_adjust_link()
1132 pdata->hw_if.config_tx_flow_control(pdata); in xgbe_phy_adjust_link()
1135 if (pdata->rx_pause != pdata->phy.rx_pause) { in xgbe_phy_adjust_link()
1137 pdata->rx_pause = pdata->phy.rx_pause; in xgbe_phy_adjust_link()
1138 pdata->hw_if.config_rx_flow_control(pdata); in xgbe_phy_adjust_link()
1142 if (pdata->phy_speed != pdata->phy.speed) { in xgbe_phy_adjust_link()
1144 pdata->phy_speed = pdata->phy.speed; in xgbe_phy_adjust_link()
1147 if (pdata->phy_link != pdata->phy.link) { in xgbe_phy_adjust_link()
1149 pdata->phy_link = pdata->phy.link; in xgbe_phy_adjust_link()
1151 } else if (pdata->phy_link) { in xgbe_phy_adjust_link()
1153 pdata->phy_link = 0; in xgbe_phy_adjust_link()
1154 pdata->phy_speed = SPEED_UNKNOWN; in xgbe_phy_adjust_link()
1163 return pdata->phy_if.phy_impl.valid_speed(pdata, speed); in xgbe_phy_valid_speed()
1168 enum xgbe_mode mode; in xgbe_phy_config_fixed() local
1170 netif_dbg(pdata, link, pdata->netdev, "fixed PHY configuration\n"); in xgbe_phy_config_fixed()
1172 /* Disable auto-negotiation */ in xgbe_phy_config_fixed()
1175 /* Set specified mode for specified speed */ in xgbe_phy_config_fixed()
1176 mode = pdata->phy_if.phy_impl.get_mode(pdata, pdata->phy.speed); in xgbe_phy_config_fixed()
1177 switch (mode) { in xgbe_phy_config_fixed()
1189 return -EINVAL; in xgbe_phy_config_fixed()
1192 /* Validate duplex mode */ in xgbe_phy_config_fixed()
1193 if (pdata->phy.duplex != DUPLEX_FULL) in xgbe_phy_config_fixed()
1194 return -EINVAL; in xgbe_phy_config_fixed()
1196 /* Force the mode change for SFI in Fixed PHY config. in xgbe_phy_config_fixed()
1197 * Fixed PHY configs needs PLL to be enabled while doing mode set. in xgbe_phy_config_fixed()
1201 * PLL isn't enabled while the initial mode set command is issued. in xgbe_phy_config_fixed()
1202 * So, force the mode change for SFI in Fixed PHY configuration to in xgbe_phy_config_fixed()
1205 if (mode == XGBE_MODE_SFI) in xgbe_phy_config_fixed()
1206 xgbe_change_mode(pdata, mode); in xgbe_phy_config_fixed()
1208 xgbe_set_mode(pdata, mode); in xgbe_phy_config_fixed()
1217 mutex_lock(&pdata->an_mutex); in __xgbe_phy_config_aneg()
1219 set_bit(XGBE_LINK_INIT, &pdata->dev_state); in __xgbe_phy_config_aneg()
1220 pdata->link_check = jiffies; in __xgbe_phy_config_aneg()
1222 ret = pdata->phy_if.phy_impl.an_config(pdata); in __xgbe_phy_config_aneg()
1226 if (pdata->phy.autoneg != AUTONEG_ENABLE) { in __xgbe_phy_config_aneg()
1228 if (ret || !pdata->kr_redrv) in __xgbe_phy_config_aneg()
1231 netif_dbg(pdata, link, pdata->netdev, "AN redriver support\n"); in __xgbe_phy_config_aneg()
1233 netif_dbg(pdata, link, pdata->netdev, "AN PHY configuration\n"); in __xgbe_phy_config_aneg()
1236 /* Disable auto-negotiation interrupt */ in __xgbe_phy_config_aneg()
1237 disable_irq(pdata->an_irq); in __xgbe_phy_config_aneg()
1240 /* Start auto-negotiation in a supported mode */ in __xgbe_phy_config_aneg()
1258 enable_irq(pdata->an_irq); in __xgbe_phy_config_aneg()
1259 ret = -EINVAL; in __xgbe_phy_config_aneg()
1264 /* Disable and stop any in progress auto-negotiation */ in __xgbe_phy_config_aneg()
1267 /* Clear any auto-negotitation interrupts */ in __xgbe_phy_config_aneg()
1270 pdata->an_result = XGBE_AN_READY; in __xgbe_phy_config_aneg()
1271 pdata->an_state = XGBE_AN_READY; in __xgbe_phy_config_aneg()
1272 pdata->kr_state = XGBE_RX_BPA; in __xgbe_phy_config_aneg()
1273 pdata->kx_state = XGBE_RX_BPA; in __xgbe_phy_config_aneg()
1275 /* Re-enable auto-negotiation interrupt */ in __xgbe_phy_config_aneg()
1276 enable_irq(pdata->an_irq); in __xgbe_phy_config_aneg()
1283 set_bit(XGBE_LINK_ERR, &pdata->dev_state); in __xgbe_phy_config_aneg()
1285 clear_bit(XGBE_LINK_ERR, &pdata->dev_state); in __xgbe_phy_config_aneg()
1287 mutex_unlock(&pdata->an_mutex); in __xgbe_phy_config_aneg()
1304 return (pdata->an_result == XGBE_AN_COMPLETE); in xgbe_phy_aneg_done()
1313 link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ); in xgbe_check_link_timeout()
1316 pdata->phy.autoneg == AUTONEG_ENABLE) { in xgbe_check_link_timeout()
1323 while (wait--) { in xgbe_check_link_timeout()
1324 kr_time = pdata->kr_start_time + in xgbe_check_link_timeout()
1329 if (pdata->an_result == XGBE_AN_COMPLETE) in xgbe_check_link_timeout()
1334 netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n"); in xgbe_check_link_timeout()
1341 return pdata->phy_if.phy_impl.an_outcome(pdata); in xgbe_phy_status_aneg()
1346 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_phy_status_result()
1347 enum xgbe_mode mode; in xgbe_phy_status_result() local
1351 if ((pdata->phy.autoneg != AUTONEG_ENABLE) || pdata->parallel_detect) in xgbe_phy_status_result()
1352 mode = xgbe_cur_mode(pdata); in xgbe_phy_status_result()
1354 mode = xgbe_phy_status_aneg(pdata); in xgbe_phy_status_result()
1356 switch (mode) { in xgbe_phy_status_result()
1358 pdata->phy.speed = SPEED_10; in xgbe_phy_status_result()
1361 pdata->phy.speed = SPEED_100; in xgbe_phy_status_result()
1366 pdata->phy.speed = SPEED_1000; in xgbe_phy_status_result()
1369 pdata->phy.speed = SPEED_2500; in xgbe_phy_status_result()
1373 pdata->phy.speed = SPEED_10000; in xgbe_phy_status_result()
1377 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_status_result()
1380 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_status_result()
1382 if (!xgbe_set_mode(pdata, mode)) in xgbe_phy_status_result()
1385 if (pdata->an_again) in xgbe_phy_status_result()
1396 if (test_bit(XGBE_LINK_ERR, &pdata->dev_state)) { in xgbe_phy_status()
1397 netif_carrier_off(pdata->netdev); in xgbe_phy_status()
1399 pdata->phy.link = 0; in xgbe_phy_status()
1403 link_aneg = (pdata->phy.autoneg == AUTONEG_ENABLE); in xgbe_phy_status()
1405 pdata->phy.link = pdata->phy_if.phy_impl.link_status(pdata, in xgbe_phy_status()
1412 if (pdata->phy.link) { in xgbe_phy_status()
1421 if (test_bit(XGBE_LINK_INIT, &pdata->dev_state)) in xgbe_phy_status()
1422 clear_bit(XGBE_LINK_INIT, &pdata->dev_state); in xgbe_phy_status()
1424 netif_carrier_on(pdata->netdev); in xgbe_phy_status()
1426 if (test_bit(XGBE_LINK_INIT, &pdata->dev_state)) { in xgbe_phy_status()
1435 netif_carrier_off(pdata->netdev); in xgbe_phy_status()
1444 netif_dbg(pdata, link, pdata->netdev, "stopping PHY\n"); in xgbe_phy_stop()
1446 if (!pdata->phy_started) in xgbe_phy_stop()
1450 pdata->phy_started = 0; in xgbe_phy_stop()
1452 /* Disable auto-negotiation */ in xgbe_phy_stop()
1455 if (pdata->dev_irq != pdata->an_irq) { in xgbe_phy_stop()
1456 devm_free_irq(pdata->dev, pdata->an_irq, pdata); in xgbe_phy_stop()
1457 cancel_work_sync(&pdata->an_bh_work); in xgbe_phy_stop()
1460 pdata->phy_if.phy_impl.stop(pdata); in xgbe_phy_stop()
1462 pdata->phy.link = 0; in xgbe_phy_stop()
1469 struct net_device *netdev = pdata->netdev; in xgbe_phy_start()
1472 netif_dbg(pdata, link, pdata->netdev, "starting PHY\n"); in xgbe_phy_start()
1474 ret = pdata->phy_if.phy_impl.start(pdata); in xgbe_phy_start()
1479 if (pdata->dev_irq != pdata->an_irq) { in xgbe_phy_start()
1480 INIT_WORK(&pdata->an_bh_work, xgbe_an_isr_bh_work); in xgbe_phy_start()
1482 ret = devm_request_irq(pdata->dev, pdata->an_irq, in xgbe_phy_start()
1483 xgbe_an_isr, 0, pdata->an_name, in xgbe_phy_start()
1491 /* Set initial mode - call the mode setting routines in xgbe_phy_start()
1511 ret = -EINVAL; in xgbe_phy_start()
1516 pdata->phy_started = 1; in xgbe_phy_start()
1524 if (pdata->dev_irq != pdata->an_irq) in xgbe_phy_start()
1525 devm_free_irq(pdata->dev, pdata->an_irq, pdata); in xgbe_phy_start()
1528 pdata->phy_if.phy_impl.stop(pdata); in xgbe_phy_start()
1537 ret = pdata->phy_if.phy_impl.reset(pdata); in xgbe_phy_reset()
1541 /* Disable auto-negotiation for now */ in xgbe_phy_reset()
1544 /* Clear auto-negotiation interrupts */ in xgbe_phy_reset()
1552 struct device *dev = pdata->dev; in xgbe_dump_phy_registers()
1569 dev_dbg(dev, "Auto-Neg Control Reg (%#06x) = %#06x\n", MDIO_CTRL1, in xgbe_dump_phy_registers()
1571 dev_dbg(dev, "Auto-Neg Status Reg (%#06x) = %#06x\n", MDIO_STAT1, in xgbe_dump_phy_registers()
1573 dev_dbg(dev, "Auto-Neg Ad Reg 1 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1576 dev_dbg(dev, "Auto-Neg Ad Reg 2 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1579 dev_dbg(dev, "Auto-Neg Ad Reg 3 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1582 dev_dbg(dev, "Auto-Neg Completion Reg (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1591 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_phy_best_advertised_speed()
1615 pdata->phy_if.phy_impl.exit(pdata); in xgbe_phy_exit()
1620 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_phy_init()
1623 mutex_init(&pdata->an_mutex); in xgbe_phy_init()
1624 INIT_WORK(&pdata->an_irq_work, xgbe_an_irq_work); in xgbe_phy_init()
1625 INIT_WORK(&pdata->an_work, xgbe_an_state_machine); in xgbe_phy_init()
1626 pdata->mdio_mmd = MDIO_MMD_PCS; in xgbe_phy_init()
1629 pdata->fec_ability = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, in xgbe_phy_init()
1631 pdata->fec_ability &= (MDIO_PMA_10GBR_FECABLE_ABLE | in xgbe_phy_init()
1635 ret = pdata->phy_if.phy_impl.init(pdata); in xgbe_phy_init()
1642 pdata->phy.address = 0; in xgbe_phy_init()
1645 pdata->phy.autoneg = AUTONEG_ENABLE; in xgbe_phy_init()
1646 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_init()
1647 pdata->phy.duplex = DUPLEX_UNKNOWN; in xgbe_phy_init()
1649 pdata->phy.autoneg = AUTONEG_DISABLE; in xgbe_phy_init()
1650 pdata->phy.speed = xgbe_phy_best_advertised_speed(pdata); in xgbe_phy_init()
1651 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_init()
1654 pdata->phy.link = 0; in xgbe_phy_init()
1656 pdata->phy.pause_autoneg = pdata->pause_autoneg; in xgbe_phy_init()
1657 pdata->phy.tx_pause = pdata->tx_pause; in xgbe_phy_init()
1658 pdata->phy.rx_pause = pdata->rx_pause; in xgbe_phy_init()
1664 if (pdata->rx_pause) { in xgbe_phy_init()
1669 if (pdata->tx_pause) { in xgbe_phy_init()
1685 phy_if->phy_init = xgbe_phy_init; in xgbe_init_function_ptrs_phy()
1686 phy_if->phy_exit = xgbe_phy_exit; in xgbe_init_function_ptrs_phy()
1688 phy_if->phy_reset = xgbe_phy_reset; in xgbe_init_function_ptrs_phy()
1689 phy_if->phy_start = xgbe_phy_start; in xgbe_init_function_ptrs_phy()
1690 phy_if->phy_stop = xgbe_phy_stop; in xgbe_init_function_ptrs_phy()
1692 phy_if->phy_status = xgbe_phy_status; in xgbe_init_function_ptrs_phy()
1693 phy_if->phy_config_aneg = xgbe_phy_config_aneg; in xgbe_init_function_ptrs_phy()
1695 phy_if->phy_valid_speed = xgbe_phy_valid_speed; in xgbe_init_function_ptrs_phy()
1697 phy_if->an_isr = xgbe_an_combined_isr; in xgbe_init_function_ptrs_phy()
1699 phy_if->module_info = xgbe_phy_module_info; in xgbe_init_function_ptrs_phy()
1700 phy_if->module_eeprom = xgbe_phy_module_eeprom; in xgbe_init_function_ptrs_phy()