Lines Matching +full:hw +full:- +full:flow +full:- +full:ctrl
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
7 static s32 e1000_wait_autoneg(struct e1000_hw *hw);
8 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
11 static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
37 * e1000e_check_reset_block_generic - Check if PHY reset is blocked
38 * @hw: pointer to the HW structure
44 s32 e1000e_check_reset_block_generic(struct e1000_hw *hw) in e1000e_check_reset_block_generic() argument
54 * e1000e_get_phy_id - Retrieve the PHY ID and revision
55 * @hw: pointer to the HW structure
60 s32 e1000e_get_phy_id(struct e1000_hw *hw) in e1000e_get_phy_id() argument
62 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_id()
67 if (!phy->ops.read_reg) in e1000e_get_phy_id()
71 ret_val = e1e_rphy(hw, MII_PHYSID1, &phy_id); in e1000e_get_phy_id()
75 phy->id = (u32)(phy_id << 16); in e1000e_get_phy_id()
77 ret_val = e1e_rphy(hw, MII_PHYSID2, &phy_id); in e1000e_get_phy_id()
81 phy->id |= (u32)(phy_id & PHY_REVISION_MASK); in e1000e_get_phy_id()
82 phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); in e1000e_get_phy_id()
84 if (phy->id != 0 && phy->id != PHY_REVISION_MASK) in e1000e_get_phy_id()
94 * e1000e_phy_reset_dsp - Reset PHY DSP
95 * @hw: pointer to the HW structure
99 s32 e1000e_phy_reset_dsp(struct e1000_hw *hw) in e1000e_phy_reset_dsp() argument
103 ret_val = e1e_wphy(hw, M88E1000_PHY_GEN_CONTROL, 0xC1); in e1000e_phy_reset_dsp()
107 return e1e_wphy(hw, M88E1000_PHY_GEN_CONTROL, 0); in e1000e_phy_reset_dsp()
110 void e1000e_disable_phy_retry(struct e1000_hw *hw) in e1000e_disable_phy_retry() argument
112 hw->phy.retry_enabled = false; in e1000e_disable_phy_retry()
115 void e1000e_enable_phy_retry(struct e1000_hw *hw) in e1000e_enable_phy_retry() argument
117 hw->phy.retry_enabled = true; in e1000e_enable_phy_retry()
121 * e1000e_read_phy_reg_mdic - Read MDI control register
122 * @hw: pointer to the HW structure
129 s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_mdic() argument
132 struct e1000_phy_info *phy = &hw->phy; in e1000e_read_phy_reg_mdic()
137 return -E1000_ERR_PARAM; in e1000e_read_phy_reg_mdic()
140 retry_max = phy->retry_enabled ? phy->retry_count : 0; in e1000e_read_phy_reg_mdic()
142 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_read_phy_reg_mdic()
150 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_read_phy_reg_mdic()
175 e_dbg("MDI Read offset error - requested %d, returned %d\n", in e1000e_read_phy_reg_mdic()
183 if (hw->mac.type == e1000_pch2lan) in e1000e_read_phy_reg_mdic()
197 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
201 * e1000e_write_phy_reg_mdic - Write MDI control register
202 * @hw: pointer to the HW structure
208 s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_mdic() argument
211 struct e1000_phy_info *phy = &hw->phy; in e1000e_write_phy_reg_mdic()
216 return -E1000_ERR_PARAM; in e1000e_write_phy_reg_mdic()
219 retry_max = phy->retry_enabled ? phy->retry_count : 0; in e1000e_write_phy_reg_mdic()
221 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_write_phy_reg_mdic()
230 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_write_phy_reg_mdic()
255 e_dbg("MDI Write offset error - requested %d, returned %d\n", in e1000e_write_phy_reg_mdic()
263 if (hw->mac.type == e1000_pch2lan) in e1000e_write_phy_reg_mdic()
275 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
279 * e1000e_read_phy_reg_m88 - Read m88 PHY register
280 * @hw: pointer to the HW structure
288 s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_m88() argument
292 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_m88()
296 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_m88()
299 hw->phy.ops.release(hw); in e1000e_read_phy_reg_m88()
305 * e1000e_write_phy_reg_m88 - Write m88 PHY register
306 * @hw: pointer to the HW structure
313 s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_m88() argument
317 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_m88()
321 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_m88()
324 hw->phy.ops.release(hw); in e1000e_write_phy_reg_m88()
330 * e1000_set_page_igp - Set page as on IGP-like PHY(s)
331 * @hw: pointer to the HW structure
338 s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page) in e1000_set_page_igp() argument
342 hw->phy.addr = 1; in e1000_set_page_igp()
344 return e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, page); in e1000_set_page_igp()
348 * __e1000e_read_phy_reg_igp - Read igp PHY register
349 * @hw: pointer to the HW structure
358 static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000e_read_phy_reg_igp() argument
364 if (!hw->phy.ops.acquire) in __e1000e_read_phy_reg_igp()
367 ret_val = hw->phy.ops.acquire(hw); in __e1000e_read_phy_reg_igp()
373 ret_val = e1000e_write_phy_reg_mdic(hw, in __e1000e_read_phy_reg_igp()
377 ret_val = e1000e_read_phy_reg_mdic(hw, in __e1000e_read_phy_reg_igp()
381 hw->phy.ops.release(hw); in __e1000e_read_phy_reg_igp()
387 * e1000e_read_phy_reg_igp - Read igp PHY register
388 * @hw: pointer to the HW structure
396 s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp() argument
398 return __e1000e_read_phy_reg_igp(hw, offset, data, false); in e1000e_read_phy_reg_igp()
402 * e1000e_read_phy_reg_igp_locked - Read igp PHY register
403 * @hw: pointer to the HW structure
410 s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp_locked() argument
412 return __e1000e_read_phy_reg_igp(hw, offset, data, true); in e1000e_read_phy_reg_igp_locked()
416 * __e1000e_write_phy_reg_igp - Write igp PHY register
417 * @hw: pointer to the HW structure
425 static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data, in __e1000e_write_phy_reg_igp() argument
431 if (!hw->phy.ops.acquire) in __e1000e_write_phy_reg_igp()
434 ret_val = hw->phy.ops.acquire(hw); in __e1000e_write_phy_reg_igp()
440 ret_val = e1000e_write_phy_reg_mdic(hw, in __e1000e_write_phy_reg_igp()
444 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & in __e1000e_write_phy_reg_igp()
447 hw->phy.ops.release(hw); in __e1000e_write_phy_reg_igp()
453 * e1000e_write_phy_reg_igp - Write igp PHY register
454 * @hw: pointer to the HW structure
461 s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp() argument
463 return __e1000e_write_phy_reg_igp(hw, offset, data, false); in e1000e_write_phy_reg_igp()
467 * e1000e_write_phy_reg_igp_locked - Write igp PHY register
468 * @hw: pointer to the HW structure
475 s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp_locked() argument
477 return __e1000e_write_phy_reg_igp(hw, offset, data, true); in e1000e_write_phy_reg_igp_locked()
481 * __e1000_read_kmrn_reg - Read kumeran register
482 * @hw: pointer to the HW structure
491 static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_kmrn_reg() argument
499 if (!hw->phy.ops.acquire) in __e1000_read_kmrn_reg()
502 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_kmrn_reg()
518 hw->phy.ops.release(hw); in __e1000_read_kmrn_reg()
524 * e1000e_read_kmrn_reg - Read kumeran register
525 * @hw: pointer to the HW structure
533 s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg() argument
535 return __e1000_read_kmrn_reg(hw, offset, data, false); in e1000e_read_kmrn_reg()
539 * e1000e_read_kmrn_reg_locked - Read kumeran register
540 * @hw: pointer to the HW structure
548 s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg_locked() argument
550 return __e1000_read_kmrn_reg(hw, offset, data, true); in e1000e_read_kmrn_reg_locked()
554 * __e1000_write_kmrn_reg - Write kumeran register
555 * @hw: pointer to the HW structure
564 static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_kmrn_reg() argument
572 if (!hw->phy.ops.acquire) in __e1000_write_kmrn_reg()
575 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_kmrn_reg()
587 hw->phy.ops.release(hw); in __e1000_write_kmrn_reg()
593 * e1000e_write_kmrn_reg - Write kumeran register
594 * @hw: pointer to the HW structure
601 s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg() argument
603 return __e1000_write_kmrn_reg(hw, offset, data, false); in e1000e_write_kmrn_reg()
607 * e1000e_write_kmrn_reg_locked - Write kumeran register
608 * @hw: pointer to the HW structure
615 s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg_locked() argument
617 return __e1000_write_kmrn_reg(hw, offset, data, true); in e1000e_write_kmrn_reg_locked()
621 * e1000_set_master_slave_mode - Setup PHY for Master/slave mode
622 * @hw: pointer to the HW structure
626 static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) in e1000_set_master_slave_mode() argument
632 ret_val = e1e_rphy(hw, MII_CTRL1000, &phy_data); in e1000_set_master_slave_mode()
637 hw->phy.original_ms_type = (phy_data & CTL1000_ENABLE_MASTER) ? in e1000_set_master_slave_mode()
641 switch (hw->phy.ms_type) { in e1000_set_master_slave_mode()
656 return e1e_wphy(hw, MII_CTRL1000, phy_data); in e1000_set_master_slave_mode()
660 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
661 * @hw: pointer to the HW structure
663 * Sets up Carrier-sense on Transmit and downshift values.
665 s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) in e1000_copper_link_setup_82577() argument
670 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000_copper_link_setup_82577()
671 ret_val = e1e_rphy(hw, I82577_CFG_REG, &phy_data); in e1000_copper_link_setup_82577()
680 ret_val = e1e_wphy(hw, I82577_CFG_REG, phy_data); in e1000_copper_link_setup_82577()
685 ret_val = e1e_rphy(hw, I82577_PHY_CTRL_2, &phy_data); in e1000_copper_link_setup_82577()
690 * 0 - Auto (default) in e1000_copper_link_setup_82577()
691 * 1 - MDI mode in e1000_copper_link_setup_82577()
692 * 2 - MDI-X mode in e1000_copper_link_setup_82577()
694 switch (hw->phy.mdix) { in e1000_copper_link_setup_82577()
705 ret_val = e1e_wphy(hw, I82577_PHY_CTRL_2, phy_data); in e1000_copper_link_setup_82577()
709 return e1000_set_master_slave_mode(hw); in e1000_copper_link_setup_82577()
713 * e1000e_copper_link_setup_m88 - Setup m88 PHY's for copper link
714 * @hw: pointer to the HW structure
716 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
719 s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) in e1000e_copper_link_setup_m88() argument
721 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_m88()
725 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000e_copper_link_setup_m88()
726 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
731 if (phy->type != e1000_phy_bm) in e1000e_copper_link_setup_m88()
735 * MDI/MDI-X = 0 (default) in e1000e_copper_link_setup_m88()
736 * 0 - Auto for all speeds in e1000e_copper_link_setup_m88()
737 * 1 - MDI mode in e1000e_copper_link_setup_m88()
738 * 2 - MDI-X mode in e1000e_copper_link_setup_m88()
739 * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) in e1000e_copper_link_setup_m88()
743 switch (phy->mdix) { in e1000e_copper_link_setup_m88()
762 * 0 - Disabled in e1000e_copper_link_setup_m88()
763 * 1 - Enabled in e1000e_copper_link_setup_m88()
766 if (phy->disable_polarity_correction) in e1000e_copper_link_setup_m88()
770 if (phy->type == e1000_phy_bm) { in e1000e_copper_link_setup_m88()
772 if (phy->id == BME1000_E_PHY_ID_R2) { in e1000e_copper_link_setup_m88()
774 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, in e1000e_copper_link_setup_m88()
779 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
789 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
793 if ((phy->type == e1000_phy_m88) && in e1000e_copper_link_setup_m88()
794 (phy->revision < E1000_REVISION_4) && in e1000e_copper_link_setup_m88()
795 (phy->id != BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
799 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
805 if ((phy->revision == 2) && (phy->id == M88E1111_I_PHY_ID)) { in e1000e_copper_link_setup_m88()
806 /* 82573L PHY - set the downshift counter to 5x. */ in e1000e_copper_link_setup_m88()
816 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
821 if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
823 ret_val = e1e_wphy(hw, 29, 0x0003); in e1000e_copper_link_setup_m88()
828 ret_val = e1e_wphy(hw, 30, 0x0000); in e1000e_copper_link_setup_m88()
834 if (phy->ops.commit) { in e1000e_copper_link_setup_m88()
835 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
842 if (phy->type == e1000_phy_82578) { in e1000e_copper_link_setup_m88()
843 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
847 /* 82578 PHY - set the downshift count to 1x. */ in e1000e_copper_link_setup_m88()
850 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
859 * e1000e_copper_link_setup_igp - Setup igp PHY's for copper link
860 * @hw: pointer to the HW structure
862 * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
865 s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw) in e1000e_copper_link_setup_igp() argument
867 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_igp()
871 ret_val = e1000_phy_hw_reset(hw); in e1000e_copper_link_setup_igp()
883 if (hw->phy.ops.set_d0_lplu_state) { in e1000e_copper_link_setup_igp()
884 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); in e1000e_copper_link_setup_igp()
890 /* Configure mdi-mdix settings */ in e1000e_copper_link_setup_igp()
891 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &data); in e1000e_copper_link_setup_igp()
897 switch (phy->mdix) { in e1000e_copper_link_setup_igp()
909 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CTRL, data); in e1000e_copper_link_setup_igp()
913 /* set auto-master slave resolution settings */ in e1000e_copper_link_setup_igp()
914 if (hw->mac.autoneg) { in e1000e_copper_link_setup_igp()
919 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000e_copper_link_setup_igp()
921 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_copper_link_setup_igp()
927 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_copper_link_setup_igp()
933 ret_val = e1e_rphy(hw, MII_CTRL1000, &data); in e1000e_copper_link_setup_igp()
938 ret_val = e1e_wphy(hw, MII_CTRL1000, data); in e1000e_copper_link_setup_igp()
943 ret_val = e1000_set_master_slave_mode(hw); in e1000e_copper_link_setup_igp()
950 * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation
951 * @hw: pointer to the HW structure
953 * Reads the MII auto-neg advertisement register and/or the 1000T control
954 * register and if the PHY is already setup for auto-negotiation, then
955 * return successful. Otherwise, setup advertisement and flow control to
956 * the appropriate values for the wanted auto-negotiation.
958 static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) in e1000_phy_setup_autoneg() argument
960 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_setup_autoneg()
965 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_phy_setup_autoneg()
967 /* Read the MII Auto-Neg Advertisement Register (Address 4). */ in e1000_phy_setup_autoneg()
968 ret_val = e1e_rphy(hw, MII_ADVERTISE, &mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
972 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
973 /* Read the MII 1000Base-T Control Register (Address 9). */ in e1000_phy_setup_autoneg()
974 ret_val = e1e_rphy(hw, MII_CTRL1000, &mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
986 /* First we clear all the 10/100 mb speed bits in the Auto-Neg in e1000_phy_setup_autoneg()
988 * the 1000Base-T Control Register (Address 9). in e1000_phy_setup_autoneg()
995 e_dbg("autoneg_advertised %x\n", phy->autoneg_advertised); in e1000_phy_setup_autoneg()
998 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
1004 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
1010 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
1016 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
1022 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in e1000_phy_setup_autoneg()
1026 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
1031 /* Check for a software override of the flow control settings, and in e1000_phy_setup_autoneg()
1033 * auto-negotiation is enabled, then software will have to set the in e1000_phy_setup_autoneg()
1034 * "PAUSE" bits to the correct value in the Auto-Negotiation in e1000_phy_setup_autoneg()
1035 * Advertisement Register (MII_ADVERTISE) and re-start auto- in e1000_phy_setup_autoneg()
1039 * 0: Flow control is completely disabled in e1000_phy_setup_autoneg()
1040 * 1: Rx flow control is enabled (we can receive pause frames in e1000_phy_setup_autoneg()
1042 * 2: Tx flow control is enabled (we can send pause frames in e1000_phy_setup_autoneg()
1044 * 3: Both Rx and Tx flow control (symmetric) are enabled. in e1000_phy_setup_autoneg()
1045 * other: No software override. The flow control configuration in e1000_phy_setup_autoneg()
1048 switch (hw->fc.current_mode) { in e1000_phy_setup_autoneg()
1050 /* Flow control (Rx & Tx) is completely disabled by a in e1000_phy_setup_autoneg()
1051 * software over-ride. in e1000_phy_setup_autoneg()
1055 phy->autoneg_advertised &= in e1000_phy_setup_autoneg()
1059 /* Rx Flow control is enabled, and Tx Flow control is in e1000_phy_setup_autoneg()
1060 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1066 * hw's ability to send PAUSE frames. in e1000_phy_setup_autoneg()
1070 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1074 /* Tx Flow control is enabled, and Rx Flow control is in e1000_phy_setup_autoneg()
1075 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1079 phy->autoneg_advertised |= ADVERTISED_Asym_Pause; in e1000_phy_setup_autoneg()
1080 phy->autoneg_advertised &= ~ADVERTISED_Pause; in e1000_phy_setup_autoneg()
1083 /* Flow control (both Rx and Tx) is enabled by a software in e1000_phy_setup_autoneg()
1084 * over-ride. in e1000_phy_setup_autoneg()
1088 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1092 e_dbg("Flow control param set incorrectly\n"); in e1000_phy_setup_autoneg()
1093 return -E1000_ERR_CONFIG; in e1000_phy_setup_autoneg()
1096 ret_val = e1e_wphy(hw, MII_ADVERTISE, mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1100 e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1102 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in e1000_phy_setup_autoneg()
1103 ret_val = e1e_wphy(hw, MII_CTRL1000, mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
1109 * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link
1110 * @hw: pointer to the HW structure
1117 static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) in e1000_copper_link_autoneg() argument
1119 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_autoneg()
1126 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_copper_link_autoneg()
1131 if (!phy->autoneg_advertised) in e1000_copper_link_autoneg()
1132 phy->autoneg_advertised = phy->autoneg_mask; in e1000_copper_link_autoneg()
1134 e_dbg("Reconfiguring auto-neg advertisement params\n"); in e1000_copper_link_autoneg()
1135 ret_val = e1000_phy_setup_autoneg(hw); in e1000_copper_link_autoneg()
1137 e_dbg("Error Setting up Auto-Negotiation\n"); in e1000_copper_link_autoneg()
1140 e_dbg("Restarting Auto-Neg\n"); in e1000_copper_link_autoneg()
1142 /* Restart auto-negotiation by setting the Auto Neg Enable bit and in e1000_copper_link_autoneg()
1145 ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl); in e1000_copper_link_autoneg()
1150 ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl); in e1000_copper_link_autoneg()
1154 /* Does the user want to wait for Auto-Neg to complete here, or in e1000_copper_link_autoneg()
1157 if (phy->autoneg_wait_to_complete) { in e1000_copper_link_autoneg()
1158 ret_val = e1000_wait_autoneg(hw); in e1000_copper_link_autoneg()
1165 hw->mac.get_link_status = true; in e1000_copper_link_autoneg()
1171 * e1000e_setup_copper_link - Configure copper link settings
1172 * @hw: pointer to the HW structure
1174 * Calls the appropriate function to configure the link for auto-neg or forced
1176 * to configure collision distance and flow control are called. If link is
1177 * not established, we return -E1000_ERR_PHY (-2).
1179 s32 e1000e_setup_copper_link(struct e1000_hw *hw) in e1000e_setup_copper_link() argument
1184 if (hw->mac.autoneg) { in e1000e_setup_copper_link()
1185 /* Setup autoneg and flow control advertisement and perform in e1000e_setup_copper_link()
1188 ret_val = e1000_copper_link_autoneg(hw); in e1000e_setup_copper_link()
1196 ret_val = hw->phy.ops.force_speed_duplex(hw); in e1000e_setup_copper_link()
1206 ret_val = e1000e_phy_has_link_generic(hw, COPPER_LINK_UP_LIMIT, 10, in e1000e_setup_copper_link()
1213 hw->mac.ops.config_collision_dist(hw); in e1000e_setup_copper_link()
1214 ret_val = e1000e_config_fc_after_link_up(hw); in e1000e_setup_copper_link()
1223 * e1000e_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
1224 * @hw: pointer to the HW structure
1227 * auto-crossover to force MDI manually. Waits for link and returns
1228 * successful if link up is successful, else -E1000_ERR_PHY (-2).
1230 s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw) in e1000e_phy_force_speed_duplex_igp() argument
1232 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_igp()
1237 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1241 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1243 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000e_phy_force_speed_duplex_igp()
1247 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI in e1000e_phy_force_speed_duplex_igp()
1250 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1257 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000e_phy_force_speed_duplex_igp()
1265 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_igp()
1268 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_igp()
1277 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_igp()
1285 * e1000e_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
1286 * @hw: pointer to the HW structure
1289 * auto-crossover to force MDI manually. Resets the PHY to commit the
1294 s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) in e1000e_phy_force_speed_duplex_m88() argument
1296 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_m88()
1301 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI in e1000e_phy_force_speed_duplex_m88()
1304 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1309 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1315 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1319 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1321 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000e_phy_force_speed_duplex_m88()
1326 if (hw->phy.ops.commit) { in e1000e_phy_force_speed_duplex_m88()
1327 ret_val = hw->phy.ops.commit(hw); in e1000e_phy_force_speed_duplex_m88()
1332 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_m88()
1335 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_m88()
1341 if (hw->phy.type != e1000_phy_m88) { in e1000e_phy_force_speed_duplex_m88()
1347 ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, in e1000e_phy_force_speed_duplex_m88()
1351 ret_val = e1000e_phy_reset_dsp(hw); in e1000e_phy_force_speed_duplex_m88()
1358 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_m88()
1364 if (hw->phy.type != e1000_phy_m88) in e1000e_phy_force_speed_duplex_m88()
1367 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1371 /* Resetting the phy means we need to re-force TX_CLK in the in e1000e_phy_force_speed_duplex_m88()
1376 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1380 /* In addition, we must re-enable CRS on Tx for both half and full in e1000e_phy_force_speed_duplex_m88()
1383 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1388 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1394 * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex
1395 * @hw: pointer to the HW structure
1401 s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw) in e1000_phy_force_speed_duplex_ife() argument
1403 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_ife()
1408 ret_val = e1e_rphy(hw, MII_BMCR, &data); in e1000_phy_force_speed_duplex_ife()
1412 e1000e_phy_force_speed_duplex_setup(hw, &data); in e1000_phy_force_speed_duplex_ife()
1414 ret_val = e1e_wphy(hw, MII_BMCR, data); in e1000_phy_force_speed_duplex_ife()
1418 /* Disable MDI-X support for 10/100 */ in e1000_phy_force_speed_duplex_ife()
1419 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_phy_force_speed_duplex_ife()
1426 ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data); in e1000_phy_force_speed_duplex_ife()
1434 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_ife()
1437 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_ife()
1446 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_ife()
1456 * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
1457 * @hw: pointer to the HW structure
1460 * Forces speed and duplex on the PHY by doing the following: disable flow
1462 * disable auto-negotiation, configure duplex, configure speed, configure
1463 * the collision distance, write configuration to CTRL register. The
1467 void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) in e1000e_phy_force_speed_duplex_setup() argument
1469 struct e1000_mac_info *mac = &hw->mac; in e1000e_phy_force_speed_duplex_setup()
1470 u32 ctrl; in e1000e_phy_force_speed_duplex_setup() local
1472 /* Turn off flow control when forcing speed/duplex */ in e1000e_phy_force_speed_duplex_setup()
1473 hw->fc.current_mode = e1000_fc_none; in e1000e_phy_force_speed_duplex_setup()
1476 ctrl = er32(CTRL); in e1000e_phy_force_speed_duplex_setup()
1477 ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); in e1000e_phy_force_speed_duplex_setup()
1478 ctrl &= ~E1000_CTRL_SPD_SEL; in e1000e_phy_force_speed_duplex_setup()
1481 ctrl &= ~E1000_CTRL_ASDE; in e1000e_phy_force_speed_duplex_setup()
1487 if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) { in e1000e_phy_force_speed_duplex_setup()
1488 ctrl &= ~E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1492 ctrl |= E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1498 if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) { in e1000e_phy_force_speed_duplex_setup()
1499 ctrl |= E1000_CTRL_SPD_100; in e1000e_phy_force_speed_duplex_setup()
1504 ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); in e1000e_phy_force_speed_duplex_setup()
1509 hw->mac.ops.config_collision_dist(hw); in e1000e_phy_force_speed_duplex_setup()
1511 ew32(CTRL, ctrl); in e1000e_phy_force_speed_duplex_setup()
1515 * e1000e_set_d3_lplu_state - Sets low power link up state for D3
1516 * @hw: pointer to the HW structure
1528 s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active) in e1000e_set_d3_lplu_state() argument
1530 struct e1000_phy_info *phy = &hw->phy; in e1000e_set_d3_lplu_state()
1534 ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data); in e1000e_set_d3_lplu_state()
1540 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000e_set_d3_lplu_state()
1548 if (phy->smart_speed == e1000_smart_speed_on) { in e1000e_set_d3_lplu_state()
1549 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1555 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1559 } else if (phy->smart_speed == e1000_smart_speed_off) { in e1000e_set_d3_lplu_state()
1560 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1566 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1571 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in e1000e_set_d3_lplu_state()
1572 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || in e1000e_set_d3_lplu_state()
1573 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { in e1000e_set_d3_lplu_state()
1575 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000e_set_d3_lplu_state()
1580 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); in e1000e_set_d3_lplu_state()
1585 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); in e1000e_set_d3_lplu_state()
1592 * e1000e_check_downshift - Checks whether a downshift in speed occurred
1593 * @hw: pointer to the HW structure
1599 s32 e1000e_check_downshift(struct e1000_hw *hw) in e1000e_check_downshift() argument
1601 struct e1000_phy_info *phy = &hw->phy; in e1000e_check_downshift()
1605 switch (phy->type) { in e1000e_check_downshift()
1620 phy->speed_downgraded = false; in e1000e_check_downshift()
1624 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000e_check_downshift()
1627 phy->speed_downgraded = !!(phy_data & mask); in e1000e_check_downshift()
1633 * e1000_check_polarity_m88 - Checks the polarity.
1634 * @hw: pointer to the HW structure
1636 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1640 s32 e1000_check_polarity_m88(struct e1000_hw *hw) in e1000_check_polarity_m88() argument
1642 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_m88()
1646 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &data); in e1000_check_polarity_m88()
1649 phy->cable_polarity = ((data & M88E1000_PSSR_REV_POLARITY) in e1000_check_polarity_m88()
1657 * e1000_check_polarity_igp - Checks the polarity.
1658 * @hw: pointer to the HW structure
1660 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1665 s32 e1000_check_polarity_igp(struct e1000_hw *hw) in e1000_check_polarity_igp() argument
1667 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_igp()
1674 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000_check_polarity_igp()
1690 ret_val = e1e_rphy(hw, offset, &data); in e1000_check_polarity_igp()
1693 phy->cable_polarity = ((data & mask) in e1000_check_polarity_igp()
1701 * e1000_check_polarity_ife - Check cable polarity for IFE PHY
1702 * @hw: pointer to the HW structure
1706 s32 e1000_check_polarity_ife(struct e1000_hw *hw) in e1000_check_polarity_ife() argument
1708 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_ife()
1714 if (phy->polarity_correction) { in e1000_check_polarity_ife()
1722 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000_check_polarity_ife()
1725 phy->cable_polarity = ((phy_data & mask) in e1000_check_polarity_ife()
1733 * e1000_wait_autoneg - Wait for auto-neg completion
1734 * @hw: pointer to the HW structure
1736 * Waits for auto-negotiation to complete or for the auto-negotiation time
1739 static s32 e1000_wait_autoneg(struct e1000_hw *hw) in e1000_wait_autoneg() argument
1745 for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { in e1000_wait_autoneg()
1746 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000_wait_autoneg()
1749 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000_wait_autoneg()
1757 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation in e1000_wait_autoneg()
1764 * e1000e_phy_has_link_generic - Polls PHY for link
1765 * @hw: pointer to the HW structure
1772 s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, in e1000e_phy_has_link_generic() argument
1784 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000e_phy_has_link_generic()
1795 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000e_phy_has_link_generic()
1812 * e1000e_get_cable_length_m88 - Determine cable length for m88 PHY
1813 * @hw: pointer to the HW structure
1821 * 1 50 - 80 meters
1822 * 2 80 - 110 meters
1823 * 3 110 - 140 meters
1826 s32 e1000e_get_cable_length_m88(struct e1000_hw *hw) in e1000e_get_cable_length_m88() argument
1828 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_m88()
1832 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000e_get_cable_length_m88()
1838 if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) in e1000e_get_cable_length_m88()
1839 return -E1000_ERR_PHY; in e1000e_get_cable_length_m88()
1841 phy->min_cable_length = e1000_m88_cable_length_table[index]; in e1000e_get_cable_length_m88()
1842 phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; in e1000e_get_cable_length_m88()
1844 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_m88()
1850 * e1000e_get_cable_length_igp_2 - Determine cable length for igp2 PHY
1851 * @hw: pointer to the HW structure
1860 s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw) in e1000e_get_cable_length_igp_2() argument
1862 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_igp_2()
1866 u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1; in e1000e_get_cable_length_igp_2()
1876 ret_val = e1e_rphy(hw, agc_reg_array[i], &phy_data); in e1000e_get_cable_length_igp_2()
1891 return -E1000_ERR_PHY; in e1000e_get_cable_length_igp_2()
1904 agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + in e1000e_get_cable_length_igp_2()
1906 agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); in e1000e_get_cable_length_igp_2()
1908 /* Calculate cable length with the error range of +/- 10 meters. */ in e1000e_get_cable_length_igp_2()
1909 phy->min_cable_length = (((agc_value - IGP02E1000_AGC_RANGE) > 0) ? in e1000e_get_cable_length_igp_2()
1910 (agc_value - IGP02E1000_AGC_RANGE) : 0); in e1000e_get_cable_length_igp_2()
1911 phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE; in e1000e_get_cable_length_igp_2()
1913 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_igp_2()
1919 * e1000e_get_phy_info_m88 - Retrieve PHY information
1920 * @hw: pointer to the HW structure
1924 * determine the polarity and 10base-T extended distance. Read the PHY
1928 s32 e1000e_get_phy_info_m88(struct e1000_hw *hw) in e1000e_get_phy_info_m88() argument
1930 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_m88()
1935 if (phy->media_type != e1000_media_type_copper) { in e1000e_get_phy_info_m88()
1937 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1940 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000e_get_phy_info_m88()
1946 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1949 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_get_phy_info_m88()
1953 phy->polarity_correction = !!(phy_data & in e1000e_get_phy_info_m88()
1956 ret_val = e1000_check_polarity_m88(hw); in e1000e_get_phy_info_m88()
1960 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000e_get_phy_info_m88()
1964 phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX); in e1000e_get_phy_info_m88()
1967 ret_val = hw->phy.ops.get_cable_length(hw); in e1000e_get_phy_info_m88()
1971 ret_val = e1e_rphy(hw, MII_STAT1000, &phy_data); in e1000e_get_phy_info_m88()
1975 phy->local_rx = (phy_data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_m88()
1978 phy->remote_rx = (phy_data & LPA_1000REMRXOK) in e1000e_get_phy_info_m88()
1982 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_m88()
1983 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1984 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1991 * e1000e_get_phy_info_igp - Retrieve igp PHY information
1992 * @hw: pointer to the HW structure
1995 * set/determine 10base-T extended distance and polarity correction. Read
1999 s32 e1000e_get_phy_info_igp(struct e1000_hw *hw) in e1000e_get_phy_info_igp() argument
2001 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_igp()
2006 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000e_get_phy_info_igp()
2012 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_igp()
2015 phy->polarity_correction = true; in e1000e_get_phy_info_igp()
2017 ret_val = e1000_check_polarity_igp(hw); in e1000e_get_phy_info_igp()
2021 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000e_get_phy_info_igp()
2025 phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX); in e1000e_get_phy_info_igp()
2029 ret_val = phy->ops.get_cable_length(hw); in e1000e_get_phy_info_igp()
2033 ret_val = e1e_rphy(hw, MII_STAT1000, &data); in e1000e_get_phy_info_igp()
2037 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_igp()
2040 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000e_get_phy_info_igp()
2043 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_igp()
2044 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2045 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2052 * e1000_get_phy_info_ife - Retrieves various IFE PHY states
2053 * @hw: pointer to the HW structure
2057 s32 e1000_get_phy_info_ife(struct e1000_hw *hw) in e1000_get_phy_info_ife() argument
2059 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_ife()
2064 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000_get_phy_info_ife()
2070 return -E1000_ERR_CONFIG; in e1000_get_phy_info_ife()
2073 ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data); in e1000_get_phy_info_ife()
2076 phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE); in e1000_get_phy_info_ife()
2078 if (phy->polarity_correction) { in e1000_get_phy_info_ife()
2079 ret_val = e1000_check_polarity_ife(hw); in e1000_get_phy_info_ife()
2084 phy->cable_polarity = ((data & IFE_PSC_FORCE_POLARITY) in e1000_get_phy_info_ife()
2089 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_get_phy_info_ife()
2093 phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS); in e1000_get_phy_info_ife()
2096 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_ife()
2097 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2098 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2104 * e1000e_phy_sw_reset - PHY software reset
2105 * @hw: pointer to the HW structure
2110 s32 e1000e_phy_sw_reset(struct e1000_hw *hw) in e1000e_phy_sw_reset() argument
2115 ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl); in e1000e_phy_sw_reset()
2120 ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl); in e1000e_phy_sw_reset()
2130 * e1000e_phy_hw_reset_generic - PHY hardware reset
2131 * @hw: pointer to the HW structure
2138 s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw) in e1000e_phy_hw_reset_generic() argument
2140 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_hw_reset_generic()
2142 u32 ctrl; in e1000e_phy_hw_reset_generic() local
2144 if (phy->ops.check_reset_block) { in e1000e_phy_hw_reset_generic()
2145 ret_val = phy->ops.check_reset_block(hw); in e1000e_phy_hw_reset_generic()
2150 ret_val = phy->ops.acquire(hw); in e1000e_phy_hw_reset_generic()
2154 ctrl = er32(CTRL); in e1000e_phy_hw_reset_generic()
2155 ew32(CTRL, ctrl | E1000_CTRL_PHY_RST); in e1000e_phy_hw_reset_generic()
2158 udelay(phy->reset_delay_us); in e1000e_phy_hw_reset_generic()
2160 ew32(CTRL, ctrl); in e1000e_phy_hw_reset_generic()
2165 phy->ops.release(hw); in e1000e_phy_hw_reset_generic()
2167 return phy->ops.get_cfg_done(hw); in e1000e_phy_hw_reset_generic()
2171 * e1000e_get_cfg_done_generic - Generic configuration done
2172 * @hw: pointer to the HW structure
2174 * Generic function to wait 10 milli-seconds for configuration to complete
2177 s32 e1000e_get_cfg_done_generic(struct e1000_hw __always_unused *hw) in e1000e_get_cfg_done_generic() argument
2185 * e1000e_phy_init_script_igp3 - Inits the IGP3 PHY
2186 * @hw: pointer to the HW structure
2190 s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw) in e1000e_phy_init_script_igp3() argument
2195 /* Enable rise/fall, 10-mode work in class-A */ in e1000e_phy_init_script_igp3()
2196 e1e_wphy(hw, 0x2F5B, 0x9018); in e1000e_phy_init_script_igp3()
2198 e1e_wphy(hw, 0x2F52, 0x0000); in e1000e_phy_init_script_igp3()
2200 e1e_wphy(hw, 0x2FB1, 0x8B24); in e1000e_phy_init_script_igp3()
2202 e1e_wphy(hw, 0x2FB2, 0xF8F0); in e1000e_phy_init_script_igp3()
2204 e1e_wphy(hw, 0x2010, 0x10B0); in e1000e_phy_init_script_igp3()
2206 e1e_wphy(hw, 0x2011, 0x0000); in e1000e_phy_init_script_igp3()
2208 e1e_wphy(hw, 0x20DD, 0x249A); in e1000e_phy_init_script_igp3()
2210 e1e_wphy(hw, 0x20DE, 0x00D3); in e1000e_phy_init_script_igp3()
2212 e1e_wphy(hw, 0x28B4, 0x04CE); in e1000e_phy_init_script_igp3()
2214 e1e_wphy(hw, 0x2F70, 0x29E4); in e1000e_phy_init_script_igp3()
2216 e1e_wphy(hw, 0x0000, 0x0140); in e1000e_phy_init_script_igp3()
2218 e1e_wphy(hw, 0x1F30, 0x1606); in e1000e_phy_init_script_igp3()
2220 e1e_wphy(hw, 0x1F31, 0xB814); in e1000e_phy_init_script_igp3()
2222 e1e_wphy(hw, 0x1F35, 0x002A); in e1000e_phy_init_script_igp3()
2224 e1e_wphy(hw, 0x1F3E, 0x0067); in e1000e_phy_init_script_igp3()
2226 e1e_wphy(hw, 0x1F54, 0x0065); in e1000e_phy_init_script_igp3()
2228 e1e_wphy(hw, 0x1F55, 0x002A); in e1000e_phy_init_script_igp3()
2230 e1e_wphy(hw, 0x1F56, 0x002A); in e1000e_phy_init_script_igp3()
2232 e1e_wphy(hw, 0x1F72, 0x3FB0); in e1000e_phy_init_script_igp3()
2234 e1e_wphy(hw, 0x1F76, 0xC0FF); in e1000e_phy_init_script_igp3()
2236 e1e_wphy(hw, 0x1F77, 0x1DEC); in e1000e_phy_init_script_igp3()
2238 e1e_wphy(hw, 0x1F78, 0xF9EF); in e1000e_phy_init_script_igp3()
2240 e1e_wphy(hw, 0x1F79, 0x0210); in e1000e_phy_init_script_igp3()
2242 e1e_wphy(hw, 0x1895, 0x0003); in e1000e_phy_init_script_igp3()
2244 e1e_wphy(hw, 0x1796, 0x0008); in e1000e_phy_init_script_igp3()
2246 e1e_wphy(hw, 0x1798, 0xD008); in e1000e_phy_init_script_igp3()
2250 e1e_wphy(hw, 0x1898, 0xD918); in e1000e_phy_init_script_igp3()
2252 e1e_wphy(hw, 0x187A, 0x0800); in e1000e_phy_init_script_igp3()
2253 /* Enable LPLU and disable AN to 1000 in non-D0a states, in e1000e_phy_init_script_igp3()
2256 e1e_wphy(hw, 0x0019, 0x008D); in e1000e_phy_init_script_igp3()
2258 e1e_wphy(hw, 0x001B, 0x2080); in e1000e_phy_init_script_igp3()
2260 e1e_wphy(hw, 0x0014, 0x0045); in e1000e_phy_init_script_igp3()
2262 e1e_wphy(hw, 0x0000, 0x1340); in e1000e_phy_init_script_igp3()
2268 * e1000e_get_phy_type_from_id - Get PHY type from id
2322 * e1000e_determine_phy_address - Determines PHY address.
2323 * @hw: pointer to the HW structure
2329 s32 e1000e_determine_phy_address(struct e1000_hw *hw) in e1000e_determine_phy_address() argument
2335 hw->phy.id = phy_type; in e1000e_determine_phy_address()
2338 hw->phy.addr = phy_addr; in e1000e_determine_phy_address()
2342 e1000e_get_phy_id(hw); in e1000e_determine_phy_address()
2343 phy_type = e1000e_get_phy_type_from_id(hw->phy.id); in e1000e_determine_phy_address()
2345 /* If phy_type is valid, break - we found our in e1000e_determine_phy_address()
2356 return -E1000_ERR_PHY_TYPE; in e1000e_determine_phy_address()
2360 * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address
2377 * e1000e_write_phy_reg_bm - Write BM PHY register
2378 * @hw: pointer to the HW structure
2385 s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm() argument
2390 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm()
2396 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm()
2401 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_write_phy_reg_bm()
2410 if (hw->phy.addr == 1) { in e1000e_write_phy_reg_bm()
2419 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, in e1000e_write_phy_reg_bm()
2425 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm()
2429 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm()
2434 * e1000e_read_phy_reg_bm - Read BM PHY register
2435 * @hw: pointer to the HW structure
2443 s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm() argument
2448 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm()
2454 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm()
2459 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_read_phy_reg_bm()
2468 if (hw->phy.addr == 1) { in e1000e_read_phy_reg_bm()
2477 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, in e1000e_read_phy_reg_bm()
2483 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm()
2486 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm()
2491 * e1000e_read_phy_reg_bm2 - Read BM PHY register
2492 * @hw: pointer to the HW structure
2500 s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm2() argument
2505 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm2()
2511 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm2()
2516 hw->phy.addr = 1; in e1000e_read_phy_reg_bm2()
2520 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, in e1000e_read_phy_reg_bm2()
2527 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm2()
2530 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm2()
2535 * e1000e_write_phy_reg_bm2 - Write BM PHY register
2536 * @hw: pointer to the HW structure
2543 s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm2() argument
2548 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm2()
2554 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm2()
2559 hw->phy.addr = 1; in e1000e_write_phy_reg_bm2()
2563 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, in e1000e_write_phy_reg_bm2()
2570 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm2()
2574 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm2()
2579 * e1000_enable_phy_wakeup_reg_access_bm - enable access to BM wakeup registers
2580 * @hw: pointer to the HW structure
2586 s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) in e1000_enable_phy_wakeup_reg_access_bm() argument
2591 /* All page select, port ctrl and wakeup registers use phy address 1 */ in e1000_enable_phy_wakeup_reg_access_bm()
2592 hw->phy.addr = 1; in e1000_enable_phy_wakeup_reg_access_bm()
2595 ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); in e1000_enable_phy_wakeup_reg_access_bm()
2601 ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); in e1000_enable_phy_wakeup_reg_access_bm()
2615 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, temp); in e1000_enable_phy_wakeup_reg_access_bm()
2622 /* Select Host Wakeup Registers page - caller now able to write in e1000_enable_phy_wakeup_reg_access_bm()
2625 return e1000_set_page_igp(hw, (BM_WUC_PAGE << IGP_PAGE_SHIFT)); in e1000_enable_phy_wakeup_reg_access_bm()
2629 * e1000_disable_phy_wakeup_reg_access_bm - disable access to BM wakeup regs
2630 * @hw: pointer to the HW structure
2639 s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) in e1000_disable_phy_wakeup_reg_access_bm() argument
2644 ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); in e1000_disable_phy_wakeup_reg_access_bm()
2651 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, *phy_reg); in e1000_disable_phy_wakeup_reg_access_bm()
2660 * e1000_access_phy_wakeup_reg_bm - Read/write BM PHY wakeup register
2661 * @hw: pointer to the HW structure
2684 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, in e1000_access_phy_wakeup_reg_bm() argument
2693 if ((hw->mac.type == e1000_pchlan) && in e1000_access_phy_wakeup_reg_bm()
2700 ret_val = e1000_enable_phy_wakeup_reg_access_bm(hw, &phy_reg); in e1000_access_phy_wakeup_reg_bm()
2710 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ADDRESS_OPCODE, reg); in e1000_access_phy_wakeup_reg_bm()
2718 ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, in e1000_access_phy_wakeup_reg_bm()
2722 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, in e1000_access_phy_wakeup_reg_bm()
2732 ret_val = e1000_disable_phy_wakeup_reg_access_bm(hw, &phy_reg); in e1000_access_phy_wakeup_reg_bm()
2738 * e1000_power_up_phy_copper - Restore copper link in case of PHY power down
2739 * @hw: pointer to the HW structure
2745 void e1000_power_up_phy_copper(struct e1000_hw *hw) in e1000_power_up_phy_copper() argument
2751 ret = e1e_rphy(hw, MII_BMCR, &mii_reg); in e1000_power_up_phy_copper()
2757 e1e_wphy(hw, MII_BMCR, mii_reg); in e1000_power_up_phy_copper()
2761 * e1000_power_down_phy_copper - Restore copper link in case of PHY power down
2762 * @hw: pointer to the HW structure
2768 void e1000_power_down_phy_copper(struct e1000_hw *hw) in e1000_power_down_phy_copper() argument
2774 ret = e1e_rphy(hw, MII_BMCR, &mii_reg); in e1000_power_down_phy_copper()
2780 e1e_wphy(hw, MII_BMCR, mii_reg); in e1000_power_down_phy_copper()
2785 * __e1000_read_phy_reg_hv - Read HV PHY register
2786 * @hw: pointer to the HW structure
2796 static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_phy_reg_hv() argument
2802 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_read_phy_reg_hv()
2805 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_phy_reg_hv()
2812 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in __e1000_read_phy_reg_hv()
2818 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_read_phy_reg_hv()
2829 ret_val = e1000_set_page_igp(hw, in __e1000_read_phy_reg_hv()
2832 hw->phy.addr = phy_addr; in __e1000_read_phy_reg_hv()
2842 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, data); in __e1000_read_phy_reg_hv()
2845 hw->phy.ops.release(hw); in __e1000_read_phy_reg_hv()
2851 * e1000_read_phy_reg_hv - Read HV PHY register
2852 * @hw: pointer to the HW structure
2860 s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv() argument
2862 return __e1000_read_phy_reg_hv(hw, offset, data, false, false); in e1000_read_phy_reg_hv()
2866 * e1000_read_phy_reg_hv_locked - Read HV PHY register
2867 * @hw: pointer to the HW structure
2874 s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv_locked() argument
2876 return __e1000_read_phy_reg_hv(hw, offset, data, true, false); in e1000_read_phy_reg_hv_locked()
2880 * e1000_read_phy_reg_page_hv - Read HV PHY register
2881 * @hw: pointer to the HW structure
2888 s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_page_hv() argument
2890 return __e1000_read_phy_reg_hv(hw, offset, data, true, true); in e1000_read_phy_reg_page_hv()
2894 * __e1000_write_phy_reg_hv - Write HV PHY register
2895 * @hw: pointer to the HW structure
2904 static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_phy_reg_hv() argument
2910 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_write_phy_reg_hv()
2913 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_phy_reg_hv()
2920 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in __e1000_write_phy_reg_hv()
2926 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_write_phy_reg_hv()
2938 if ((hw->phy.type == e1000_phy_82578) && in __e1000_write_phy_reg_hv()
2939 (hw->phy.revision >= 1) && in __e1000_write_phy_reg_hv()
2940 (hw->phy.addr == 2) && in __e1000_write_phy_reg_hv()
2944 ret_val = e1000_access_phy_debug_regs_hv(hw, in __e1000_write_phy_reg_hv()
2953 ret_val = e1000_set_page_igp(hw, in __e1000_write_phy_reg_hv()
2956 hw->phy.addr = phy_addr; in __e1000_write_phy_reg_hv()
2966 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, in __e1000_write_phy_reg_hv()
2971 hw->phy.ops.release(hw); in __e1000_write_phy_reg_hv()
2977 * e1000_write_phy_reg_hv - Write HV PHY register
2978 * @hw: pointer to the HW structure
2985 s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv() argument
2987 return __e1000_write_phy_reg_hv(hw, offset, data, false, false); in e1000_write_phy_reg_hv()
2991 * e1000_write_phy_reg_hv_locked - Write HV PHY register
2992 * @hw: pointer to the HW structure
2999 s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv_locked() argument
3001 return __e1000_write_phy_reg_hv(hw, offset, data, true, false); in e1000_write_phy_reg_hv_locked()
3005 * e1000_write_phy_reg_page_hv - Write HV PHY register
3006 * @hw: pointer to the HW structure
3013 s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_page_hv() argument
3015 return __e1000_write_phy_reg_hv(hw, offset, data, true, true); in e1000_write_phy_reg_page_hv()
3019 * e1000_get_phy_addr_for_hv_page - Get PHY address based on page
3033 * e1000_access_phy_debug_regs_hv - Read HV PHY vendor specific high registers
3034 * @hw: pointer to the HW structure
3044 static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, in e1000_access_phy_debug_regs_hv() argument
3052 addr_reg = ((hw->phy.type == e1000_phy_82578) ? in e1000_access_phy_debug_regs_hv()
3057 hw->phy.addr = 2; in e1000_access_phy_debug_regs_hv()
3060 ret_val = e1000e_write_phy_reg_mdic(hw, addr_reg, (u16)offset & 0x3F); in e1000_access_phy_debug_regs_hv()
3068 ret_val = e1000e_read_phy_reg_mdic(hw, data_reg, data); in e1000_access_phy_debug_regs_hv()
3070 ret_val = e1000e_write_phy_reg_mdic(hw, data_reg, *data); in e1000_access_phy_debug_regs_hv()
3079 * e1000_link_stall_workaround_hv - Si workaround
3080 * @hw: pointer to the HW structure
3089 s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) in e1000_link_stall_workaround_hv() argument
3094 if (hw->phy.type != e1000_phy_82578) in e1000_link_stall_workaround_hv()
3098 ret_val = e1e_rphy(hw, MII_BMCR, &data); in e1000_link_stall_workaround_hv()
3107 ret_val = e1e_rphy(hw, BM_CS_STATUS, &data); in e1000_link_stall_workaround_hv()
3121 ret_val = e1e_wphy(hw, HV_MUX_DATA_CTRL, in e1000_link_stall_workaround_hv()
3127 return e1e_wphy(hw, HV_MUX_DATA_CTRL, HV_MUX_DATA_CTRL_GEN_TO_MAC); in e1000_link_stall_workaround_hv()
3131 * e1000_check_polarity_82577 - Checks the polarity.
3132 * @hw: pointer to the HW structure
3134 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
3138 s32 e1000_check_polarity_82577(struct e1000_hw *hw) in e1000_check_polarity_82577() argument
3140 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_82577()
3144 ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); in e1000_check_polarity_82577()
3147 phy->cable_polarity = ((data & I82577_PHY_STATUS2_REV_POLARITY) in e1000_check_polarity_82577()
3155 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY
3156 * @hw: pointer to the HW structure
3160 s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw) in e1000_phy_force_speed_duplex_82577() argument
3162 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_82577()
3167 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000_phy_force_speed_duplex_82577()
3171 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000_phy_force_speed_duplex_82577()
3173 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000_phy_force_speed_duplex_82577()
3179 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_82577()
3182 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_82577()
3191 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_82577()
3199 * e1000_get_phy_info_82577 - Retrieve I82577 PHY information
3200 * @hw: pointer to the HW structure
3203 * set/determine 10base-T extended distance and polarity correction. Read
3207 s32 e1000_get_phy_info_82577(struct e1000_hw *hw) in e1000_get_phy_info_82577() argument
3209 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_82577()
3214 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000_get_phy_info_82577()
3220 return -E1000_ERR_CONFIG; in e1000_get_phy_info_82577()
3223 phy->polarity_correction = true; in e1000_get_phy_info_82577()
3225 ret_val = e1000_check_polarity_82577(hw); in e1000_get_phy_info_82577()
3229 ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); in e1000_get_phy_info_82577()
3233 phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX); in e1000_get_phy_info_82577()
3237 ret_val = hw->phy.ops.get_cable_length(hw); in e1000_get_phy_info_82577()
3241 ret_val = e1e_rphy(hw, MII_STAT1000, &data); in e1000_get_phy_info_82577()
3245 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000_get_phy_info_82577()
3248 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000_get_phy_info_82577()
3251 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_82577()
3252 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3253 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3260 * e1000_get_cable_length_82577 - Determine cable length for 82577 PHY
3261 * @hw: pointer to the HW structure
3266 s32 e1000_get_cable_length_82577(struct e1000_hw *hw) in e1000_get_cable_length_82577() argument
3268 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_82577()
3272 ret_val = e1e_rphy(hw, I82577_PHY_DIAG_STATUS, &phy_data); in e1000_get_cable_length_82577()
3279 return -E1000_ERR_PHY; in e1000_get_cable_length_82577()
3281 phy->cable_length = length; in e1000_get_cable_length_82577()