Lines Matching +full:auto +full:- +full:negotiation
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_1000); in xgbe_sgmii_100_mode()
283 pdata->phy_if.phy_impl.set_mode(pdata, XGBE_MODE_SGMII_100); in xgbe_sgmii_100_mode()
288 return pdata->phy_if.phy_impl.cur_mode(pdata); in xgbe_cur_mode()
324 netif_dbg(pdata, link, pdata->netdev, in xgbe_change_mode()
331 xgbe_change_mode(pdata, pdata->phy_if.phy_impl.switch_mode(pdata)); in xgbe_switch_mode()
348 return pdata->phy_if.phy_impl.use_mode(pdata, mode); in xgbe_use_mode()
373 netif_dbg(pdata, link, pdata->netdev, "CL37 AN enabled/restarted\n"); in xgbe_an37_restart()
381 netif_dbg(pdata, link, pdata->netdev, "CL37 AN disabled\n"); in xgbe_an37_disable()
412 netif_dbg(pdata, link, pdata->netdev, "CL73 AN enabled/restarted\n"); in xgbe_an73_restart()
420 pdata->an_start = 0; in xgbe_an73_disable()
422 netif_dbg(pdata, link, pdata->netdev, "CL73 AN disabled\n"); in xgbe_an73_disable()
427 if (pdata->phy_if.phy_impl.an_pre) in xgbe_an_restart()
428 pdata->phy_if.phy_impl.an_pre(pdata); in xgbe_an_restart()
430 switch (pdata->an_mode) { in xgbe_an_restart()
446 if (pdata->phy_if.phy_impl.an_post) in xgbe_an_disable()
447 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an_disable()
449 switch (pdata->an_mode) { in xgbe_an_disable()
487 reg |= pdata->fec_ability; in xgbe_an73_tx_training()
492 if (pdata->phy_if.phy_impl.kr_training_pre) in xgbe_an73_tx_training()
493 pdata->phy_if.phy_impl.kr_training_pre(pdata); in xgbe_an73_tx_training()
500 netif_dbg(pdata, link, pdata->netdev, in xgbe_an73_tx_training()
503 if (pdata->phy_if.phy_impl.kr_training_post) in xgbe_an73_tx_training()
504 pdata->phy_if.phy_impl.kr_training_post(pdata); in xgbe_an73_tx_training()
571 if (!pdata->an_start) { in xgbe_an73_page_received()
572 pdata->an_start = jiffies; in xgbe_an73_page_received()
574 an_timeout = pdata->an_start + in xgbe_an73_page_received()
577 /* Auto-negotiation timed out, reset state */ in xgbe_an73_page_received()
578 pdata->kr_state = XGBE_RX_BPA; in xgbe_an73_page_received()
579 pdata->kx_state = XGBE_RX_BPA; in xgbe_an73_page_received()
581 pdata->an_start = jiffies; in xgbe_an73_page_received()
583 netif_dbg(pdata, link, pdata->netdev, in xgbe_an73_page_received()
588 state = xgbe_in_kr_mode(pdata) ? &pdata->kr_state in xgbe_an73_page_received()
589 : &pdata->kx_state; in xgbe_an73_page_received()
609 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_an73_incompat_link()
613 pdata->kr_state = XGBE_RX_ERROR; in xgbe_an73_incompat_link()
619 if (pdata->kx_state != XGBE_RX_BPA) in xgbe_an73_incompat_link()
622 pdata->kx_state = XGBE_RX_ERROR; in xgbe_an73_incompat_link()
627 if (pdata->kr_state != XGBE_RX_BPA) in xgbe_an73_incompat_link()
649 pdata->an_int = reg & XGBE_AN_CL37_INT_MASK; in xgbe_an37_isr()
650 pdata->an_status = reg & ~XGBE_AN_CL37_INT_MASK; in xgbe_an37_isr()
652 if (pdata->an_int) { in xgbe_an37_isr()
657 queue_work(pdata->an_workqueue, &pdata->an_irq_work); in xgbe_an37_isr()
663 if (pdata->vdata->irq_reissue_support) in xgbe_an37_isr()
674 pdata->an_int = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_INT); in xgbe_an73_isr()
676 if (pdata->an_int) { in xgbe_an73_isr()
678 XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_INT, ~pdata->an_int); in xgbe_an73_isr()
680 queue_work(pdata->an_workqueue, &pdata->an_irq_work); in xgbe_an73_isr()
686 if (pdata->vdata->irq_reissue_support) in xgbe_an73_isr()
695 netif_dbg(pdata, intr, pdata->netdev, "AN interrupt received\n"); in xgbe_an_isr_task()
697 switch (pdata->an_mode) { in xgbe_an_isr_task()
715 if (pdata->isr_as_tasklet) in xgbe_an_isr()
716 tasklet_schedule(&pdata->tasklet_an); in xgbe_an_isr()
718 xgbe_an_isr_task(&pdata->tasklet_an); in xgbe_an_isr()
725 xgbe_an_isr_task(&pdata->tasklet_an); in xgbe_an_combined_isr()
739 flush_work(&pdata->an_work); in xgbe_an_irq_work()
740 queue_work(pdata->an_workqueue, &pdata->an_work); in xgbe_an_irq_work()
749 return "Page-Received"; in xgbe_state_as_string()
751 return "Incompatible-Link"; in xgbe_state_as_string()
755 return "No-Link"; in xgbe_state_as_string()
765 enum xgbe_an cur_state = pdata->an_state; in xgbe_an37_state_machine()
767 if (!pdata->an_int) in xgbe_an37_state_machine()
770 if (pdata->an_int & XGBE_AN_CL37_INT_CMPLT) { in xgbe_an37_state_machine()
771 pdata->an_state = XGBE_AN_COMPLETE; in xgbe_an37_state_machine()
772 pdata->an_int &= ~XGBE_AN_CL37_INT_CMPLT; in xgbe_an37_state_machine()
775 if ((pdata->an_mode == XGBE_AN_MODE_CL37_SGMII) && in xgbe_an37_state_machine()
776 !(pdata->an_status & XGBE_SGMII_AN_LINK_STATUS)) in xgbe_an37_state_machine()
777 pdata->an_state = XGBE_AN_NO_LINK; in xgbe_an37_state_machine()
780 netif_dbg(pdata, link, pdata->netdev, "CL37 AN %s\n", in xgbe_an37_state_machine()
781 xgbe_state_as_string(pdata->an_state)); in xgbe_an37_state_machine()
783 cur_state = pdata->an_state; in xgbe_an37_state_machine()
785 switch (pdata->an_state) { in xgbe_an37_state_machine()
790 netif_dbg(pdata, link, pdata->netdev, in xgbe_an37_state_machine()
791 "Auto negotiation successful\n"); in xgbe_an37_state_machine()
798 pdata->an_state = XGBE_AN_ERROR; in xgbe_an37_state_machine()
801 if (pdata->an_state == XGBE_AN_ERROR) { in xgbe_an37_state_machine()
802 netdev_err(pdata->netdev, in xgbe_an37_state_machine()
803 "error during auto-negotiation, state=%u\n", in xgbe_an37_state_machine()
806 pdata->an_int = 0; in xgbe_an37_state_machine()
810 if (pdata->an_state >= XGBE_AN_COMPLETE) { in xgbe_an37_state_machine()
811 pdata->an_result = pdata->an_state; in xgbe_an37_state_machine()
812 pdata->an_state = XGBE_AN_READY; in xgbe_an37_state_machine()
814 if (pdata->phy_if.phy_impl.an_post) in xgbe_an37_state_machine()
815 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an37_state_machine()
817 netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n", in xgbe_an37_state_machine()
818 xgbe_state_as_string(pdata->an_result)); in xgbe_an37_state_machine()
826 enum xgbe_an cur_state = pdata->an_state; in xgbe_an73_state_machine()
828 if (!pdata->an_int) in xgbe_an73_state_machine()
832 if (pdata->an_int & XGBE_AN_CL73_PG_RCV) { in xgbe_an73_state_machine()
833 pdata->an_state = XGBE_AN_PAGE_RECEIVED; in xgbe_an73_state_machine()
834 pdata->an_int &= ~XGBE_AN_CL73_PG_RCV; in xgbe_an73_state_machine()
835 } else if (pdata->an_int & XGBE_AN_CL73_INC_LINK) { in xgbe_an73_state_machine()
836 pdata->an_state = XGBE_AN_INCOMPAT_LINK; in xgbe_an73_state_machine()
837 pdata->an_int &= ~XGBE_AN_CL73_INC_LINK; in xgbe_an73_state_machine()
838 } else if (pdata->an_int & XGBE_AN_CL73_INT_CMPLT) { in xgbe_an73_state_machine()
839 pdata->an_state = XGBE_AN_COMPLETE; in xgbe_an73_state_machine()
840 pdata->an_int &= ~XGBE_AN_CL73_INT_CMPLT; in xgbe_an73_state_machine()
842 pdata->an_state = XGBE_AN_ERROR; in xgbe_an73_state_machine()
846 netif_dbg(pdata, link, pdata->netdev, "CL73 AN %s\n", in xgbe_an73_state_machine()
847 xgbe_state_as_string(pdata->an_state)); in xgbe_an73_state_machine()
849 cur_state = pdata->an_state; in xgbe_an73_state_machine()
851 switch (pdata->an_state) { in xgbe_an73_state_machine()
853 pdata->an_supported = 0; in xgbe_an73_state_machine()
857 pdata->an_state = xgbe_an73_page_received(pdata); in xgbe_an73_state_machine()
858 pdata->an_supported++; in xgbe_an73_state_machine()
862 pdata->an_supported = 0; in xgbe_an73_state_machine()
863 pdata->parallel_detect = 0; in xgbe_an73_state_machine()
864 pdata->an_state = xgbe_an73_incompat_link(pdata); in xgbe_an73_state_machine()
868 pdata->parallel_detect = pdata->an_supported ? 0 : 1; in xgbe_an73_state_machine()
869 netif_dbg(pdata, link, pdata->netdev, "%s successful\n", in xgbe_an73_state_machine()
870 pdata->an_supported ? "Auto negotiation" in xgbe_an73_state_machine()
878 pdata->an_state = XGBE_AN_ERROR; in xgbe_an73_state_machine()
881 if (pdata->an_state == XGBE_AN_NO_LINK) { in xgbe_an73_state_machine()
882 pdata->an_int = 0; in xgbe_an73_state_machine()
884 } else if (pdata->an_state == XGBE_AN_ERROR) { in xgbe_an73_state_machine()
885 netdev_err(pdata->netdev, in xgbe_an73_state_machine()
886 "error during auto-negotiation, state=%u\n", in xgbe_an73_state_machine()
889 pdata->an_int = 0; in xgbe_an73_state_machine()
893 if (pdata->an_state >= XGBE_AN_COMPLETE) { in xgbe_an73_state_machine()
894 pdata->an_result = pdata->an_state; in xgbe_an73_state_machine()
895 pdata->an_state = XGBE_AN_READY; in xgbe_an73_state_machine()
896 pdata->kr_state = XGBE_RX_BPA; in xgbe_an73_state_machine()
897 pdata->kx_state = XGBE_RX_BPA; in xgbe_an73_state_machine()
898 pdata->an_start = 0; in xgbe_an73_state_machine()
900 if (pdata->phy_if.phy_impl.an_post) in xgbe_an73_state_machine()
901 pdata->phy_if.phy_impl.an_post(pdata); in xgbe_an73_state_machine()
903 netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n", in xgbe_an73_state_machine()
904 xgbe_state_as_string(pdata->an_result)); in xgbe_an73_state_machine()
907 if (cur_state != pdata->an_state) in xgbe_an73_state_machine()
910 if (pdata->an_int) in xgbe_an73_state_machine()
922 mutex_lock(&pdata->an_mutex); in xgbe_an_state_machine()
924 switch (pdata->an_mode) { in xgbe_an_state_machine()
938 if (pdata->vdata->irq_reissue_support) in xgbe_an_state_machine()
941 mutex_unlock(&pdata->an_mutex); in xgbe_an_state_machine()
949 pdata->phy_if.phy_impl.an_advertising(pdata, &lks); in xgbe_an37_init()
974 switch (pdata->an_mode) { in xgbe_an37_init()
989 netif_dbg(pdata, link, pdata->netdev, "CL37 AN (%s) initialized\n", in xgbe_an37_init()
990 (pdata->an_mode == XGBE_AN_MODE_CL37) ? "BaseX" : "SGMII"); in xgbe_an37_init()
998 pdata->phy_if.phy_impl.an_advertising(pdata, &lks); in xgbe_an73_init()
1041 netif_dbg(pdata, link, pdata->netdev, "CL73 AN initialized\n"); in xgbe_an73_init()
1047 pdata->an_mode = pdata->phy_if.phy_impl.an_mode(pdata); in xgbe_an_init()
1048 switch (pdata->an_mode) { in xgbe_an_init()
1064 if (pdata->tx_pause && pdata->rx_pause) in xgbe_phy_fc_string()
1066 else if (pdata->rx_pause) in xgbe_phy_fc_string()
1068 else if (pdata->tx_pause) in xgbe_phy_fc_string()
1094 if (pdata->phy.link) in xgbe_phy_print_status()
1095 netdev_info(pdata->netdev, in xgbe_phy_print_status()
1096 "Link is Up - %s/%s - flow control %s\n", in xgbe_phy_print_status()
1097 xgbe_phy_speed_string(pdata->phy.speed), in xgbe_phy_print_status()
1098 pdata->phy.duplex == DUPLEX_FULL ? "Full" : "Half", in xgbe_phy_print_status()
1101 netdev_info(pdata->netdev, "Link is Down\n"); in xgbe_phy_print_status()
1108 if (pdata->phy.link) { in xgbe_phy_adjust_link()
1110 pdata->pause_autoneg = pdata->phy.pause_autoneg; in xgbe_phy_adjust_link()
1112 if (pdata->tx_pause != pdata->phy.tx_pause) { in xgbe_phy_adjust_link()
1114 pdata->tx_pause = pdata->phy.tx_pause; in xgbe_phy_adjust_link()
1115 pdata->hw_if.config_tx_flow_control(pdata); in xgbe_phy_adjust_link()
1118 if (pdata->rx_pause != pdata->phy.rx_pause) { in xgbe_phy_adjust_link()
1120 pdata->rx_pause = pdata->phy.rx_pause; in xgbe_phy_adjust_link()
1121 pdata->hw_if.config_rx_flow_control(pdata); in xgbe_phy_adjust_link()
1125 if (pdata->phy_speed != pdata->phy.speed) { in xgbe_phy_adjust_link()
1127 pdata->phy_speed = pdata->phy.speed; in xgbe_phy_adjust_link()
1130 if (pdata->phy_link != pdata->phy.link) { in xgbe_phy_adjust_link()
1132 pdata->phy_link = pdata->phy.link; in xgbe_phy_adjust_link()
1134 } else if (pdata->phy_link) { in xgbe_phy_adjust_link()
1136 pdata->phy_link = 0; in xgbe_phy_adjust_link()
1137 pdata->phy_speed = SPEED_UNKNOWN; in xgbe_phy_adjust_link()
1146 return pdata->phy_if.phy_impl.valid_speed(pdata, speed); in xgbe_phy_valid_speed()
1153 netif_dbg(pdata, link, pdata->netdev, "fixed PHY configuration\n"); in xgbe_phy_config_fixed()
1155 /* Disable auto-negotiation */ in xgbe_phy_config_fixed()
1159 mode = pdata->phy_if.phy_impl.get_mode(pdata, pdata->phy.speed); in xgbe_phy_config_fixed()
1171 return -EINVAL; in xgbe_phy_config_fixed()
1175 if (pdata->phy.duplex != DUPLEX_FULL) in xgbe_phy_config_fixed()
1176 return -EINVAL; in xgbe_phy_config_fixed()
1187 mutex_lock(&pdata->an_mutex); in __xgbe_phy_config_aneg()
1189 set_bit(XGBE_LINK_INIT, &pdata->dev_state); in __xgbe_phy_config_aneg()
1190 pdata->link_check = jiffies; in __xgbe_phy_config_aneg()
1192 ret = pdata->phy_if.phy_impl.an_config(pdata); in __xgbe_phy_config_aneg()
1196 if (pdata->phy.autoneg != AUTONEG_ENABLE) { in __xgbe_phy_config_aneg()
1198 if (ret || !pdata->kr_redrv) in __xgbe_phy_config_aneg()
1201 netif_dbg(pdata, link, pdata->netdev, "AN redriver support\n"); in __xgbe_phy_config_aneg()
1203 netif_dbg(pdata, link, pdata->netdev, "AN PHY configuration\n"); in __xgbe_phy_config_aneg()
1206 /* Disable auto-negotiation interrupt */ in __xgbe_phy_config_aneg()
1207 disable_irq(pdata->an_irq); in __xgbe_phy_config_aneg()
1210 /* Start auto-negotiation in a supported mode */ in __xgbe_phy_config_aneg()
1226 enable_irq(pdata->an_irq); in __xgbe_phy_config_aneg()
1227 ret = -EINVAL; in __xgbe_phy_config_aneg()
1232 /* Disable and stop any in progress auto-negotiation */ in __xgbe_phy_config_aneg()
1235 /* Clear any auto-negotitation interrupts */ in __xgbe_phy_config_aneg()
1238 pdata->an_result = XGBE_AN_READY; in __xgbe_phy_config_aneg()
1239 pdata->an_state = XGBE_AN_READY; in __xgbe_phy_config_aneg()
1240 pdata->kr_state = XGBE_RX_BPA; in __xgbe_phy_config_aneg()
1241 pdata->kx_state = XGBE_RX_BPA; in __xgbe_phy_config_aneg()
1243 /* Re-enable auto-negotiation interrupt */ in __xgbe_phy_config_aneg()
1244 enable_irq(pdata->an_irq); in __xgbe_phy_config_aneg()
1251 set_bit(XGBE_LINK_ERR, &pdata->dev_state); in __xgbe_phy_config_aneg()
1253 clear_bit(XGBE_LINK_ERR, &pdata->dev_state); in __xgbe_phy_config_aneg()
1255 mutex_unlock(&pdata->an_mutex); in __xgbe_phy_config_aneg()
1272 return (pdata->an_result == XGBE_AN_COMPLETE); in xgbe_phy_aneg_done()
1279 link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ); in xgbe_check_link_timeout()
1281 netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n"); in xgbe_check_link_timeout()
1288 return pdata->phy_if.phy_impl.an_outcome(pdata); in xgbe_phy_status_aneg()
1293 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_phy_status_result()
1298 if ((pdata->phy.autoneg != AUTONEG_ENABLE) || pdata->parallel_detect) in xgbe_phy_status_result()
1305 pdata->phy.speed = SPEED_100; in xgbe_phy_status_result()
1310 pdata->phy.speed = SPEED_1000; in xgbe_phy_status_result()
1313 pdata->phy.speed = SPEED_2500; in xgbe_phy_status_result()
1317 pdata->phy.speed = SPEED_10000; in xgbe_phy_status_result()
1321 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_status_result()
1324 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_status_result()
1326 if (xgbe_set_mode(pdata, mode) && pdata->an_again) in xgbe_phy_status_result()
1335 if (test_bit(XGBE_LINK_ERR, &pdata->dev_state)) { in xgbe_phy_status()
1336 netif_carrier_off(pdata->netdev); in xgbe_phy_status()
1338 pdata->phy.link = 0; in xgbe_phy_status()
1342 link_aneg = (pdata->phy.autoneg == AUTONEG_ENABLE); in xgbe_phy_status()
1344 pdata->phy.link = pdata->phy_if.phy_impl.link_status(pdata, in xgbe_phy_status()
1351 if (pdata->phy.link) { in xgbe_phy_status()
1359 if (test_bit(XGBE_LINK_INIT, &pdata->dev_state)) in xgbe_phy_status()
1360 clear_bit(XGBE_LINK_INIT, &pdata->dev_state); in xgbe_phy_status()
1362 netif_carrier_on(pdata->netdev); in xgbe_phy_status()
1364 if (test_bit(XGBE_LINK_INIT, &pdata->dev_state)) { in xgbe_phy_status()
1373 netif_carrier_off(pdata->netdev); in xgbe_phy_status()
1382 netif_dbg(pdata, link, pdata->netdev, "stopping PHY\n"); in xgbe_phy_stop()
1384 if (!pdata->phy_started) in xgbe_phy_stop()
1388 pdata->phy_started = 0; in xgbe_phy_stop()
1390 /* Disable auto-negotiation */ in xgbe_phy_stop()
1393 if (pdata->dev_irq != pdata->an_irq) in xgbe_phy_stop()
1394 devm_free_irq(pdata->dev, pdata->an_irq, pdata); in xgbe_phy_stop()
1396 pdata->phy_if.phy_impl.stop(pdata); in xgbe_phy_stop()
1398 pdata->phy.link = 0; in xgbe_phy_stop()
1405 struct net_device *netdev = pdata->netdev; in xgbe_phy_start()
1408 netif_dbg(pdata, link, pdata->netdev, "starting PHY\n"); in xgbe_phy_start()
1410 ret = pdata->phy_if.phy_impl.start(pdata); in xgbe_phy_start()
1415 if (pdata->dev_irq != pdata->an_irq) { in xgbe_phy_start()
1416 tasklet_setup(&pdata->tasklet_an, xgbe_an_isr_task); in xgbe_phy_start()
1418 ret = devm_request_irq(pdata->dev, pdata->an_irq, in xgbe_phy_start()
1419 xgbe_an_isr, 0, pdata->an_name, in xgbe_phy_start()
1427 /* Set initial mode - call the mode setting routines in xgbe_phy_start()
1445 ret = -EINVAL; in xgbe_phy_start()
1450 pdata->phy_started = 1; in xgbe_phy_start()
1458 if (pdata->dev_irq != pdata->an_irq) in xgbe_phy_start()
1459 devm_free_irq(pdata->dev, pdata->an_irq, pdata); in xgbe_phy_start()
1462 pdata->phy_if.phy_impl.stop(pdata); in xgbe_phy_start()
1471 ret = pdata->phy_if.phy_impl.reset(pdata); in xgbe_phy_reset()
1475 /* Disable auto-negotiation for now */ in xgbe_phy_reset()
1478 /* Clear auto-negotiation interrupts */ in xgbe_phy_reset()
1486 struct device *dev = pdata->dev; in xgbe_dump_phy_registers()
1503 dev_dbg(dev, "Auto-Neg Control Reg (%#06x) = %#06x\n", MDIO_CTRL1, in xgbe_dump_phy_registers()
1505 dev_dbg(dev, "Auto-Neg Status Reg (%#06x) = %#06x\n", MDIO_STAT1, in xgbe_dump_phy_registers()
1507 dev_dbg(dev, "Auto-Neg Ad Reg 1 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1510 dev_dbg(dev, "Auto-Neg Ad Reg 2 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1513 dev_dbg(dev, "Auto-Neg Ad Reg 3 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1516 dev_dbg(dev, "Auto-Neg Completion Reg (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
1525 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_phy_best_advertised_speed()
1547 pdata->phy_if.phy_impl.exit(pdata); in xgbe_phy_exit()
1552 struct ethtool_link_ksettings *lks = &pdata->phy.lks; in xgbe_phy_init()
1555 mutex_init(&pdata->an_mutex); in xgbe_phy_init()
1556 INIT_WORK(&pdata->an_irq_work, xgbe_an_irq_work); in xgbe_phy_init()
1557 INIT_WORK(&pdata->an_work, xgbe_an_state_machine); in xgbe_phy_init()
1558 pdata->mdio_mmd = MDIO_MMD_PCS; in xgbe_phy_init()
1561 pdata->fec_ability = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, in xgbe_phy_init()
1563 pdata->fec_ability &= (MDIO_PMA_10GBR_FECABLE_ABLE | in xgbe_phy_init()
1567 ret = pdata->phy_if.phy_impl.init(pdata); in xgbe_phy_init()
1574 pdata->phy.address = 0; in xgbe_phy_init()
1577 pdata->phy.autoneg = AUTONEG_ENABLE; in xgbe_phy_init()
1578 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_init()
1579 pdata->phy.duplex = DUPLEX_UNKNOWN; in xgbe_phy_init()
1581 pdata->phy.autoneg = AUTONEG_DISABLE; in xgbe_phy_init()
1582 pdata->phy.speed = xgbe_phy_best_advertised_speed(pdata); in xgbe_phy_init()
1583 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_init()
1586 pdata->phy.link = 0; in xgbe_phy_init()
1588 pdata->phy.pause_autoneg = pdata->pause_autoneg; in xgbe_phy_init()
1589 pdata->phy.tx_pause = pdata->tx_pause; in xgbe_phy_init()
1590 pdata->phy.rx_pause = pdata->rx_pause; in xgbe_phy_init()
1596 if (pdata->rx_pause) { in xgbe_phy_init()
1601 if (pdata->tx_pause) { in xgbe_phy_init()
1617 phy_if->phy_init = xgbe_phy_init; in xgbe_init_function_ptrs_phy()
1618 phy_if->phy_exit = xgbe_phy_exit; in xgbe_init_function_ptrs_phy()
1620 phy_if->phy_reset = xgbe_phy_reset; in xgbe_init_function_ptrs_phy()
1621 phy_if->phy_start = xgbe_phy_start; in xgbe_init_function_ptrs_phy()
1622 phy_if->phy_stop = xgbe_phy_stop; in xgbe_init_function_ptrs_phy()
1624 phy_if->phy_status = xgbe_phy_status; in xgbe_init_function_ptrs_phy()
1625 phy_if->phy_config_aneg = xgbe_phy_config_aneg; in xgbe_init_function_ptrs_phy()
1627 phy_if->phy_valid_speed = xgbe_phy_valid_speed; in xgbe_init_function_ptrs_phy()
1629 phy_if->an_isr = xgbe_an_combined_isr; in xgbe_init_function_ptrs_phy()
1631 phy_if->module_info = xgbe_phy_module_info; in xgbe_init_function_ptrs_phy()
1632 phy_if->module_eeprom = xgbe_phy_module_eeprom; in xgbe_init_function_ptrs_phy()