Lines Matching +full:hw +full:- +full:flow +full:- +full:ctrl
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
6 static s32 e1000_wait_autoneg(struct e1000_hw *hw);
7 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
10 static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
36 * e1000e_check_reset_block_generic - Check if PHY reset is blocked
37 * @hw: pointer to the HW structure
43 s32 e1000e_check_reset_block_generic(struct e1000_hw *hw) in e1000e_check_reset_block_generic() argument
53 * e1000e_get_phy_id - Retrieve the PHY ID and revision
54 * @hw: pointer to the HW structure
59 s32 e1000e_get_phy_id(struct e1000_hw *hw) in e1000e_get_phy_id() argument
61 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_id()
66 if (!phy->ops.read_reg) in e1000e_get_phy_id()
70 ret_val = e1e_rphy(hw, MII_PHYSID1, &phy_id); in e1000e_get_phy_id()
74 phy->id = (u32)(phy_id << 16); in e1000e_get_phy_id()
76 ret_val = e1e_rphy(hw, MII_PHYSID2, &phy_id); in e1000e_get_phy_id()
80 phy->id |= (u32)(phy_id & PHY_REVISION_MASK); in e1000e_get_phy_id()
81 phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); in e1000e_get_phy_id()
83 if (phy->id != 0 && phy->id != PHY_REVISION_MASK) in e1000e_get_phy_id()
93 * e1000e_phy_reset_dsp - Reset PHY DSP
94 * @hw: pointer to the HW structure
98 s32 e1000e_phy_reset_dsp(struct e1000_hw *hw) in e1000e_phy_reset_dsp() argument
102 ret_val = e1e_wphy(hw, M88E1000_PHY_GEN_CONTROL, 0xC1); in e1000e_phy_reset_dsp()
106 return e1e_wphy(hw, M88E1000_PHY_GEN_CONTROL, 0); in e1000e_phy_reset_dsp()
110 * e1000e_read_phy_reg_mdic - Read MDI control register
111 * @hw: pointer to the HW structure
118 s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_mdic() argument
120 struct e1000_phy_info *phy = &hw->phy; in e1000e_read_phy_reg_mdic()
125 return -E1000_ERR_PARAM; in e1000e_read_phy_reg_mdic()
128 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_read_phy_reg_mdic()
133 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_read_phy_reg_mdic()
150 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
154 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
157 e_dbg("MDI Read offset error - requested %d, returned %d\n", in e1000e_read_phy_reg_mdic()
160 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
167 if (hw->mac.type == e1000_pch2lan) in e1000e_read_phy_reg_mdic()
174 * e1000e_write_phy_reg_mdic - Write MDI control register
175 * @hw: pointer to the HW structure
181 s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_mdic() argument
183 struct e1000_phy_info *phy = &hw->phy; in e1000e_write_phy_reg_mdic()
188 return -E1000_ERR_PARAM; in e1000e_write_phy_reg_mdic()
191 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_write_phy_reg_mdic()
197 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_write_phy_reg_mdic()
214 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
218 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
221 e_dbg("MDI Write offset error - requested %d, returned %d\n", in e1000e_write_phy_reg_mdic()
224 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
230 if (hw->mac.type == e1000_pch2lan) in e1000e_write_phy_reg_mdic()
237 * e1000e_read_phy_reg_m88 - Read m88 PHY register
238 * @hw: pointer to the HW structure
246 s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_m88() argument
250 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_m88()
254 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_m88()
257 hw->phy.ops.release(hw); in e1000e_read_phy_reg_m88()
263 * e1000e_write_phy_reg_m88 - Write m88 PHY register
264 * @hw: pointer to the HW structure
271 s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_m88() argument
275 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_m88()
279 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_m88()
282 hw->phy.ops.release(hw); in e1000e_write_phy_reg_m88()
288 * e1000_set_page_igp - Set page as on IGP-like PHY(s)
289 * @hw: pointer to the HW structure
296 s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page) in e1000_set_page_igp() argument
300 hw->phy.addr = 1; in e1000_set_page_igp()
302 return e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, page); in e1000_set_page_igp()
306 * __e1000e_read_phy_reg_igp - Read igp PHY register
307 * @hw: pointer to the HW structure
316 static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000e_read_phy_reg_igp() argument
322 if (!hw->phy.ops.acquire) in __e1000e_read_phy_reg_igp()
325 ret_val = hw->phy.ops.acquire(hw); in __e1000e_read_phy_reg_igp()
331 ret_val = e1000e_write_phy_reg_mdic(hw, in __e1000e_read_phy_reg_igp()
335 ret_val = e1000e_read_phy_reg_mdic(hw, in __e1000e_read_phy_reg_igp()
339 hw->phy.ops.release(hw); in __e1000e_read_phy_reg_igp()
345 * e1000e_read_phy_reg_igp - Read igp PHY register
346 * @hw: pointer to the HW structure
354 s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp() argument
356 return __e1000e_read_phy_reg_igp(hw, offset, data, false); in e1000e_read_phy_reg_igp()
360 * e1000e_read_phy_reg_igp_locked - Read igp PHY register
361 * @hw: pointer to the HW structure
368 s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp_locked() argument
370 return __e1000e_read_phy_reg_igp(hw, offset, data, true); in e1000e_read_phy_reg_igp_locked()
374 * e1000e_write_phy_reg_igp - Write igp PHY register
375 * @hw: pointer to the HW structure
383 static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data, in __e1000e_write_phy_reg_igp() argument
389 if (!hw->phy.ops.acquire) in __e1000e_write_phy_reg_igp()
392 ret_val = hw->phy.ops.acquire(hw); in __e1000e_write_phy_reg_igp()
398 ret_val = e1000e_write_phy_reg_mdic(hw, in __e1000e_write_phy_reg_igp()
402 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & in __e1000e_write_phy_reg_igp()
405 hw->phy.ops.release(hw); in __e1000e_write_phy_reg_igp()
411 * e1000e_write_phy_reg_igp - Write igp PHY register
412 * @hw: pointer to the HW structure
419 s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp() argument
421 return __e1000e_write_phy_reg_igp(hw, offset, data, false); in e1000e_write_phy_reg_igp()
425 * e1000e_write_phy_reg_igp_locked - Write igp PHY register
426 * @hw: pointer to the HW structure
433 s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp_locked() argument
435 return __e1000e_write_phy_reg_igp(hw, offset, data, true); in e1000e_write_phy_reg_igp_locked()
439 * __e1000_read_kmrn_reg - Read kumeran register
440 * @hw: pointer to the HW structure
449 static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_kmrn_reg() argument
457 if (!hw->phy.ops.acquire) in __e1000_read_kmrn_reg()
460 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_kmrn_reg()
476 hw->phy.ops.release(hw); in __e1000_read_kmrn_reg()
482 * e1000e_read_kmrn_reg - Read kumeran register
483 * @hw: pointer to the HW structure
491 s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg() argument
493 return __e1000_read_kmrn_reg(hw, offset, data, false); in e1000e_read_kmrn_reg()
497 * e1000e_read_kmrn_reg_locked - Read kumeran register
498 * @hw: pointer to the HW structure
506 s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg_locked() argument
508 return __e1000_read_kmrn_reg(hw, offset, data, true); in e1000e_read_kmrn_reg_locked()
512 * __e1000_write_kmrn_reg - Write kumeran register
513 * @hw: pointer to the HW structure
522 static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_kmrn_reg() argument
530 if (!hw->phy.ops.acquire) in __e1000_write_kmrn_reg()
533 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_kmrn_reg()
546 hw->phy.ops.release(hw); in __e1000_write_kmrn_reg()
552 * e1000e_write_kmrn_reg - Write kumeran register
553 * @hw: pointer to the HW structure
560 s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg() argument
562 return __e1000_write_kmrn_reg(hw, offset, data, false); in e1000e_write_kmrn_reg()
566 * e1000e_write_kmrn_reg_locked - Write kumeran register
567 * @hw: pointer to the HW structure
574 s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg_locked() argument
576 return __e1000_write_kmrn_reg(hw, offset, data, true); in e1000e_write_kmrn_reg_locked()
580 * e1000_set_master_slave_mode - Setup PHY for Master/slave mode
581 * @hw: pointer to the HW structure
585 static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) in e1000_set_master_slave_mode() argument
591 ret_val = e1e_rphy(hw, MII_CTRL1000, &phy_data); in e1000_set_master_slave_mode()
596 hw->phy.original_ms_type = (phy_data & CTL1000_ENABLE_MASTER) ? in e1000_set_master_slave_mode()
600 switch (hw->phy.ms_type) { in e1000_set_master_slave_mode()
615 return e1e_wphy(hw, MII_CTRL1000, phy_data); in e1000_set_master_slave_mode()
619 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
620 * @hw: pointer to the HW structure
622 * Sets up Carrier-sense on Transmit and downshift values.
624 s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) in e1000_copper_link_setup_82577() argument
629 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000_copper_link_setup_82577()
630 ret_val = e1e_rphy(hw, I82577_CFG_REG, &phy_data); in e1000_copper_link_setup_82577()
639 ret_val = e1e_wphy(hw, I82577_CFG_REG, phy_data); in e1000_copper_link_setup_82577()
644 ret_val = e1e_rphy(hw, I82577_PHY_CTRL_2, &phy_data); in e1000_copper_link_setup_82577()
649 * 0 - Auto (default) in e1000_copper_link_setup_82577()
650 * 1 - MDI mode in e1000_copper_link_setup_82577()
651 * 2 - MDI-X mode in e1000_copper_link_setup_82577()
653 switch (hw->phy.mdix) { in e1000_copper_link_setup_82577()
664 ret_val = e1e_wphy(hw, I82577_PHY_CTRL_2, phy_data); in e1000_copper_link_setup_82577()
668 return e1000_set_master_slave_mode(hw); in e1000_copper_link_setup_82577()
672 * e1000e_copper_link_setup_m88 - Setup m88 PHY's for copper link
673 * @hw: pointer to the HW structure
675 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
678 s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) in e1000e_copper_link_setup_m88() argument
680 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_m88()
684 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000e_copper_link_setup_m88()
685 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
690 if (phy->type != e1000_phy_bm) in e1000e_copper_link_setup_m88()
694 * MDI/MDI-X = 0 (default) in e1000e_copper_link_setup_m88()
695 * 0 - Auto for all speeds in e1000e_copper_link_setup_m88()
696 * 1 - MDI mode in e1000e_copper_link_setup_m88()
697 * 2 - MDI-X mode in e1000e_copper_link_setup_m88()
698 * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) in e1000e_copper_link_setup_m88()
702 switch (phy->mdix) { in e1000e_copper_link_setup_m88()
721 * 0 - Disabled in e1000e_copper_link_setup_m88()
722 * 1 - Enabled in e1000e_copper_link_setup_m88()
725 if (phy->disable_polarity_correction) in e1000e_copper_link_setup_m88()
729 if (phy->type == e1000_phy_bm) { in e1000e_copper_link_setup_m88()
731 if (phy->id == BME1000_E_PHY_ID_R2) { in e1000e_copper_link_setup_m88()
733 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, in e1000e_copper_link_setup_m88()
738 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
748 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
752 if ((phy->type == e1000_phy_m88) && in e1000e_copper_link_setup_m88()
753 (phy->revision < E1000_REVISION_4) && in e1000e_copper_link_setup_m88()
754 (phy->id != BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
758 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
764 if ((phy->revision == 2) && (phy->id == M88E1111_I_PHY_ID)) { in e1000e_copper_link_setup_m88()
765 /* 82573L PHY - set the downshift counter to 5x. */ in e1000e_copper_link_setup_m88()
775 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
780 if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
782 ret_val = e1e_wphy(hw, 29, 0x0003); in e1000e_copper_link_setup_m88()
787 ret_val = e1e_wphy(hw, 30, 0x0000); in e1000e_copper_link_setup_m88()
793 if (phy->ops.commit) { in e1000e_copper_link_setup_m88()
794 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
801 if (phy->type == e1000_phy_82578) { in e1000e_copper_link_setup_m88()
802 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
806 /* 82578 PHY - set the downshift count to 1x. */ in e1000e_copper_link_setup_m88()
809 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
818 * e1000e_copper_link_setup_igp - Setup igp PHY's for copper link
819 * @hw: pointer to the HW structure
821 * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
824 s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw) in e1000e_copper_link_setup_igp() argument
826 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_igp()
830 ret_val = e1000_phy_hw_reset(hw); in e1000e_copper_link_setup_igp()
842 if (hw->phy.ops.set_d0_lplu_state) { in e1000e_copper_link_setup_igp()
843 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); in e1000e_copper_link_setup_igp()
849 /* Configure mdi-mdix settings */ in e1000e_copper_link_setup_igp()
850 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &data); in e1000e_copper_link_setup_igp()
856 switch (phy->mdix) { in e1000e_copper_link_setup_igp()
868 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CTRL, data); in e1000e_copper_link_setup_igp()
872 /* set auto-master slave resolution settings */ in e1000e_copper_link_setup_igp()
873 if (hw->mac.autoneg) { in e1000e_copper_link_setup_igp()
878 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000e_copper_link_setup_igp()
880 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_copper_link_setup_igp()
886 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_copper_link_setup_igp()
892 ret_val = e1e_rphy(hw, MII_CTRL1000, &data); in e1000e_copper_link_setup_igp()
897 ret_val = e1e_wphy(hw, MII_CTRL1000, data); in e1000e_copper_link_setup_igp()
902 ret_val = e1000_set_master_slave_mode(hw); in e1000e_copper_link_setup_igp()
909 * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation
910 * @hw: pointer to the HW structure
912 * Reads the MII auto-neg advertisement register and/or the 1000T control
913 * register and if the PHY is already setup for auto-negotiation, then
914 * return successful. Otherwise, setup advertisement and flow control to
915 * the appropriate values for the wanted auto-negotiation.
917 static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) in e1000_phy_setup_autoneg() argument
919 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_setup_autoneg()
924 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_phy_setup_autoneg()
926 /* Read the MII Auto-Neg Advertisement Register (Address 4). */ in e1000_phy_setup_autoneg()
927 ret_val = e1e_rphy(hw, MII_ADVERTISE, &mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
931 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
932 /* Read the MII 1000Base-T Control Register (Address 9). */ in e1000_phy_setup_autoneg()
933 ret_val = e1e_rphy(hw, MII_CTRL1000, &mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
945 /* First we clear all the 10/100 mb speed bits in the Auto-Neg in e1000_phy_setup_autoneg()
947 * the 1000Base-T Control Register (Address 9). in e1000_phy_setup_autoneg()
954 e_dbg("autoneg_advertised %x\n", phy->autoneg_advertised); in e1000_phy_setup_autoneg()
957 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
963 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
969 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
975 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
981 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in e1000_phy_setup_autoneg()
985 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
990 /* Check for a software override of the flow control settings, and in e1000_phy_setup_autoneg()
992 * auto-negotiation is enabled, then software will have to set the in e1000_phy_setup_autoneg()
993 * "PAUSE" bits to the correct value in the Auto-Negotiation in e1000_phy_setup_autoneg()
994 * Advertisement Register (MII_ADVERTISE) and re-start auto- in e1000_phy_setup_autoneg()
998 * 0: Flow control is completely disabled in e1000_phy_setup_autoneg()
999 * 1: Rx flow control is enabled (we can receive pause frames in e1000_phy_setup_autoneg()
1001 * 2: Tx flow control is enabled (we can send pause frames in e1000_phy_setup_autoneg()
1003 * 3: Both Rx and Tx flow control (symmetric) are enabled. in e1000_phy_setup_autoneg()
1004 * other: No software override. The flow control configuration in e1000_phy_setup_autoneg()
1007 switch (hw->fc.current_mode) { in e1000_phy_setup_autoneg()
1009 /* Flow control (Rx & Tx) is completely disabled by a in e1000_phy_setup_autoneg()
1010 * software over-ride. in e1000_phy_setup_autoneg()
1016 /* Rx Flow control is enabled, and Tx Flow control is in e1000_phy_setup_autoneg()
1017 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1023 * hw's ability to send PAUSE frames. in e1000_phy_setup_autoneg()
1029 /* Tx Flow control is enabled, and Rx Flow control is in e1000_phy_setup_autoneg()
1030 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1036 /* Flow control (both Rx and Tx) is enabled by a software in e1000_phy_setup_autoneg()
1037 * over-ride. in e1000_phy_setup_autoneg()
1043 e_dbg("Flow control param set incorrectly\n"); in e1000_phy_setup_autoneg()
1044 return -E1000_ERR_CONFIG; in e1000_phy_setup_autoneg()
1047 ret_val = e1e_wphy(hw, MII_ADVERTISE, mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1051 e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1053 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in e1000_phy_setup_autoneg()
1054 ret_val = e1e_wphy(hw, MII_CTRL1000, mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
1060 * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link
1061 * @hw: pointer to the HW structure
1068 static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) in e1000_copper_link_autoneg() argument
1070 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_autoneg()
1077 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_copper_link_autoneg()
1082 if (!phy->autoneg_advertised) in e1000_copper_link_autoneg()
1083 phy->autoneg_advertised = phy->autoneg_mask; in e1000_copper_link_autoneg()
1085 e_dbg("Reconfiguring auto-neg advertisement params\n"); in e1000_copper_link_autoneg()
1086 ret_val = e1000_phy_setup_autoneg(hw); in e1000_copper_link_autoneg()
1088 e_dbg("Error Setting up Auto-Negotiation\n"); in e1000_copper_link_autoneg()
1091 e_dbg("Restarting Auto-Neg\n"); in e1000_copper_link_autoneg()
1093 /* Restart auto-negotiation by setting the Auto Neg Enable bit and in e1000_copper_link_autoneg()
1096 ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl); in e1000_copper_link_autoneg()
1101 ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl); in e1000_copper_link_autoneg()
1105 /* Does the user want to wait for Auto-Neg to complete here, or in e1000_copper_link_autoneg()
1108 if (phy->autoneg_wait_to_complete) { in e1000_copper_link_autoneg()
1109 ret_val = e1000_wait_autoneg(hw); in e1000_copper_link_autoneg()
1116 hw->mac.get_link_status = true; in e1000_copper_link_autoneg()
1122 * e1000e_setup_copper_link - Configure copper link settings
1123 * @hw: pointer to the HW structure
1125 * Calls the appropriate function to configure the link for auto-neg or forced
1127 * to configure collision distance and flow control are called. If link is
1128 * not established, we return -E1000_ERR_PHY (-2).
1130 s32 e1000e_setup_copper_link(struct e1000_hw *hw) in e1000e_setup_copper_link() argument
1135 if (hw->mac.autoneg) { in e1000e_setup_copper_link()
1136 /* Setup autoneg and flow control advertisement and perform in e1000e_setup_copper_link()
1139 ret_val = e1000_copper_link_autoneg(hw); in e1000e_setup_copper_link()
1147 ret_val = hw->phy.ops.force_speed_duplex(hw); in e1000e_setup_copper_link()
1157 ret_val = e1000e_phy_has_link_generic(hw, COPPER_LINK_UP_LIMIT, 10, in e1000e_setup_copper_link()
1164 hw->mac.ops.config_collision_dist(hw); in e1000e_setup_copper_link()
1165 ret_val = e1000e_config_fc_after_link_up(hw); in e1000e_setup_copper_link()
1174 * e1000e_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
1175 * @hw: pointer to the HW structure
1178 * auto-crossover to force MDI manually. Waits for link and returns
1179 * successful if link up is successful, else -E1000_ERR_PHY (-2).
1181 s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw) in e1000e_phy_force_speed_duplex_igp() argument
1183 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_igp()
1188 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1192 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1194 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000e_phy_force_speed_duplex_igp()
1198 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI in e1000e_phy_force_speed_duplex_igp()
1201 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1208 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000e_phy_force_speed_duplex_igp()
1216 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_igp()
1219 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_igp()
1228 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_igp()
1236 * e1000e_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
1237 * @hw: pointer to the HW structure
1240 * auto-crossover to force MDI manually. Resets the PHY to commit the
1245 s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) in e1000e_phy_force_speed_duplex_m88() argument
1247 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_m88()
1252 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI in e1000e_phy_force_speed_duplex_m88()
1255 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1260 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1266 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1270 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1272 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000e_phy_force_speed_duplex_m88()
1277 if (hw->phy.ops.commit) { in e1000e_phy_force_speed_duplex_m88()
1278 ret_val = hw->phy.ops.commit(hw); in e1000e_phy_force_speed_duplex_m88()
1283 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_m88()
1286 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_m88()
1292 if (hw->phy.type != e1000_phy_m88) { in e1000e_phy_force_speed_duplex_m88()
1298 ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, in e1000e_phy_force_speed_duplex_m88()
1302 ret_val = e1000e_phy_reset_dsp(hw); in e1000e_phy_force_speed_duplex_m88()
1309 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_m88()
1315 if (hw->phy.type != e1000_phy_m88) in e1000e_phy_force_speed_duplex_m88()
1318 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1322 /* Resetting the phy means we need to re-force TX_CLK in the in e1000e_phy_force_speed_duplex_m88()
1327 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1331 /* In addition, we must re-enable CRS on Tx for both half and full in e1000e_phy_force_speed_duplex_m88()
1334 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1339 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1345 * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex
1346 * @hw: pointer to the HW structure
1352 s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw) in e1000_phy_force_speed_duplex_ife() argument
1354 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_ife()
1359 ret_val = e1e_rphy(hw, MII_BMCR, &data); in e1000_phy_force_speed_duplex_ife()
1363 e1000e_phy_force_speed_duplex_setup(hw, &data); in e1000_phy_force_speed_duplex_ife()
1365 ret_val = e1e_wphy(hw, MII_BMCR, data); in e1000_phy_force_speed_duplex_ife()
1369 /* Disable MDI-X support for 10/100 */ in e1000_phy_force_speed_duplex_ife()
1370 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_phy_force_speed_duplex_ife()
1377 ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data); in e1000_phy_force_speed_duplex_ife()
1385 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_ife()
1388 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_ife()
1397 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_ife()
1407 * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
1408 * @hw: pointer to the HW structure
1411 * Forces speed and duplex on the PHY by doing the following: disable flow
1413 * disable auto-negotiation, configure duplex, configure speed, configure
1414 * the collision distance, write configuration to CTRL register. The
1418 void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) in e1000e_phy_force_speed_duplex_setup() argument
1420 struct e1000_mac_info *mac = &hw->mac; in e1000e_phy_force_speed_duplex_setup()
1421 u32 ctrl; in e1000e_phy_force_speed_duplex_setup() local
1423 /* Turn off flow control when forcing speed/duplex */ in e1000e_phy_force_speed_duplex_setup()
1424 hw->fc.current_mode = e1000_fc_none; in e1000e_phy_force_speed_duplex_setup()
1427 ctrl = er32(CTRL); in e1000e_phy_force_speed_duplex_setup()
1428 ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); in e1000e_phy_force_speed_duplex_setup()
1429 ctrl &= ~E1000_CTRL_SPD_SEL; in e1000e_phy_force_speed_duplex_setup()
1432 ctrl &= ~E1000_CTRL_ASDE; in e1000e_phy_force_speed_duplex_setup()
1438 if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) { in e1000e_phy_force_speed_duplex_setup()
1439 ctrl &= ~E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1443 ctrl |= E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1449 if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) { in e1000e_phy_force_speed_duplex_setup()
1450 ctrl |= E1000_CTRL_SPD_100; in e1000e_phy_force_speed_duplex_setup()
1455 ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); in e1000e_phy_force_speed_duplex_setup()
1460 hw->mac.ops.config_collision_dist(hw); in e1000e_phy_force_speed_duplex_setup()
1462 ew32(CTRL, ctrl); in e1000e_phy_force_speed_duplex_setup()
1466 * e1000e_set_d3_lplu_state - Sets low power link up state for D3
1467 * @hw: pointer to the HW structure
1479 s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active) in e1000e_set_d3_lplu_state() argument
1481 struct e1000_phy_info *phy = &hw->phy; in e1000e_set_d3_lplu_state()
1485 ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data); in e1000e_set_d3_lplu_state()
1491 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000e_set_d3_lplu_state()
1499 if (phy->smart_speed == e1000_smart_speed_on) { in e1000e_set_d3_lplu_state()
1500 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1506 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1510 } else if (phy->smart_speed == e1000_smart_speed_off) { in e1000e_set_d3_lplu_state()
1511 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1517 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1522 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in e1000e_set_d3_lplu_state()
1523 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || in e1000e_set_d3_lplu_state()
1524 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { in e1000e_set_d3_lplu_state()
1526 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000e_set_d3_lplu_state()
1531 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); in e1000e_set_d3_lplu_state()
1536 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); in e1000e_set_d3_lplu_state()
1543 * e1000e_check_downshift - Checks whether a downshift in speed occurred
1544 * @hw: pointer to the HW structure
1550 s32 e1000e_check_downshift(struct e1000_hw *hw) in e1000e_check_downshift() argument
1552 struct e1000_phy_info *phy = &hw->phy; in e1000e_check_downshift()
1556 switch (phy->type) { in e1000e_check_downshift()
1571 phy->speed_downgraded = false; in e1000e_check_downshift()
1575 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000e_check_downshift()
1578 phy->speed_downgraded = !!(phy_data & mask); in e1000e_check_downshift()
1584 * e1000_check_polarity_m88 - Checks the polarity.
1585 * @hw: pointer to the HW structure
1587 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1591 s32 e1000_check_polarity_m88(struct e1000_hw *hw) in e1000_check_polarity_m88() argument
1593 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_m88()
1597 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &data); in e1000_check_polarity_m88()
1600 phy->cable_polarity = ((data & M88E1000_PSSR_REV_POLARITY) in e1000_check_polarity_m88()
1608 * e1000_check_polarity_igp - Checks the polarity.
1609 * @hw: pointer to the HW structure
1611 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1616 s32 e1000_check_polarity_igp(struct e1000_hw *hw) in e1000_check_polarity_igp() argument
1618 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_igp()
1625 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000_check_polarity_igp()
1641 ret_val = e1e_rphy(hw, offset, &data); in e1000_check_polarity_igp()
1644 phy->cable_polarity = ((data & mask) in e1000_check_polarity_igp()
1652 * e1000_check_polarity_ife - Check cable polarity for IFE PHY
1653 * @hw: pointer to the HW structure
1657 s32 e1000_check_polarity_ife(struct e1000_hw *hw) in e1000_check_polarity_ife() argument
1659 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_ife()
1665 if (phy->polarity_correction) { in e1000_check_polarity_ife()
1673 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000_check_polarity_ife()
1676 phy->cable_polarity = ((phy_data & mask) in e1000_check_polarity_ife()
1684 * e1000_wait_autoneg - Wait for auto-neg completion
1685 * @hw: pointer to the HW structure
1687 * Waits for auto-negotiation to complete or for the auto-negotiation time
1690 static s32 e1000_wait_autoneg(struct e1000_hw *hw) in e1000_wait_autoneg() argument
1696 for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { in e1000_wait_autoneg()
1697 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000_wait_autoneg()
1700 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000_wait_autoneg()
1708 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation in e1000_wait_autoneg()
1715 * e1000e_phy_has_link_generic - Polls PHY for link
1716 * @hw: pointer to the HW structure
1723 s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, in e1000e_phy_has_link_generic() argument
1735 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000e_phy_has_link_generic()
1746 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000e_phy_has_link_generic()
1763 * e1000e_get_cable_length_m88 - Determine cable length for m88 PHY
1764 * @hw: pointer to the HW structure
1772 * 1 50 - 80 meters
1773 * 2 80 - 110 meters
1774 * 3 110 - 140 meters
1777 s32 e1000e_get_cable_length_m88(struct e1000_hw *hw) in e1000e_get_cable_length_m88() argument
1779 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_m88()
1783 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000e_get_cable_length_m88()
1790 if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) in e1000e_get_cable_length_m88()
1791 return -E1000_ERR_PHY; in e1000e_get_cable_length_m88()
1793 phy->min_cable_length = e1000_m88_cable_length_table[index]; in e1000e_get_cable_length_m88()
1794 phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; in e1000e_get_cable_length_m88()
1796 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_m88()
1802 * e1000e_get_cable_length_igp_2 - Determine cable length for igp2 PHY
1803 * @hw: pointer to the HW structure
1812 s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw) in e1000e_get_cable_length_igp_2() argument
1814 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_igp_2()
1818 u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1; in e1000e_get_cable_length_igp_2()
1828 ret_val = e1e_rphy(hw, agc_reg_array[i], &phy_data); in e1000e_get_cable_length_igp_2()
1843 return -E1000_ERR_PHY; in e1000e_get_cable_length_igp_2()
1856 agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + in e1000e_get_cable_length_igp_2()
1858 agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); in e1000e_get_cable_length_igp_2()
1860 /* Calculate cable length with the error range of +/- 10 meters. */ in e1000e_get_cable_length_igp_2()
1861 phy->min_cable_length = (((agc_value - IGP02E1000_AGC_RANGE) > 0) ? in e1000e_get_cable_length_igp_2()
1862 (agc_value - IGP02E1000_AGC_RANGE) : 0); in e1000e_get_cable_length_igp_2()
1863 phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE; in e1000e_get_cable_length_igp_2()
1865 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_igp_2()
1871 * e1000e_get_phy_info_m88 - Retrieve PHY information
1872 * @hw: pointer to the HW structure
1876 * determine the polarity and 10base-T extended distance. Read the PHY
1880 s32 e1000e_get_phy_info_m88(struct e1000_hw *hw) in e1000e_get_phy_info_m88() argument
1882 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_m88()
1887 if (phy->media_type != e1000_media_type_copper) { in e1000e_get_phy_info_m88()
1889 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1892 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000e_get_phy_info_m88()
1898 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1901 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_get_phy_info_m88()
1905 phy->polarity_correction = !!(phy_data & in e1000e_get_phy_info_m88()
1908 ret_val = e1000_check_polarity_m88(hw); in e1000e_get_phy_info_m88()
1912 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000e_get_phy_info_m88()
1916 phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX); in e1000e_get_phy_info_m88()
1919 ret_val = hw->phy.ops.get_cable_length(hw); in e1000e_get_phy_info_m88()
1923 ret_val = e1e_rphy(hw, MII_STAT1000, &phy_data); in e1000e_get_phy_info_m88()
1927 phy->local_rx = (phy_data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_m88()
1930 phy->remote_rx = (phy_data & LPA_1000REMRXOK) in e1000e_get_phy_info_m88()
1934 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_m88()
1935 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1936 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1943 * e1000e_get_phy_info_igp - Retrieve igp PHY information
1944 * @hw: pointer to the HW structure
1947 * set/determine 10base-T extended distance and polarity correction. Read
1951 s32 e1000e_get_phy_info_igp(struct e1000_hw *hw) in e1000e_get_phy_info_igp() argument
1953 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_igp()
1958 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000e_get_phy_info_igp()
1964 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_igp()
1967 phy->polarity_correction = true; in e1000e_get_phy_info_igp()
1969 ret_val = e1000_check_polarity_igp(hw); in e1000e_get_phy_info_igp()
1973 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000e_get_phy_info_igp()
1977 phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX); in e1000e_get_phy_info_igp()
1981 ret_val = phy->ops.get_cable_length(hw); in e1000e_get_phy_info_igp()
1985 ret_val = e1e_rphy(hw, MII_STAT1000, &data); in e1000e_get_phy_info_igp()
1989 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_igp()
1992 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000e_get_phy_info_igp()
1995 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_igp()
1996 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
1997 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2004 * e1000_get_phy_info_ife - Retrieves various IFE PHY states
2005 * @hw: pointer to the HW structure
2009 s32 e1000_get_phy_info_ife(struct e1000_hw *hw) in e1000_get_phy_info_ife() argument
2011 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_ife()
2016 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000_get_phy_info_ife()
2022 return -E1000_ERR_CONFIG; in e1000_get_phy_info_ife()
2025 ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data); in e1000_get_phy_info_ife()
2028 phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE); in e1000_get_phy_info_ife()
2030 if (phy->polarity_correction) { in e1000_get_phy_info_ife()
2031 ret_val = e1000_check_polarity_ife(hw); in e1000_get_phy_info_ife()
2036 phy->cable_polarity = ((data & IFE_PSC_FORCE_POLARITY) in e1000_get_phy_info_ife()
2041 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_get_phy_info_ife()
2045 phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS); in e1000_get_phy_info_ife()
2048 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_ife()
2049 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2050 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2056 * e1000e_phy_sw_reset - PHY software reset
2057 * @hw: pointer to the HW structure
2062 s32 e1000e_phy_sw_reset(struct e1000_hw *hw) in e1000e_phy_sw_reset() argument
2067 ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl); in e1000e_phy_sw_reset()
2072 ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl); in e1000e_phy_sw_reset()
2082 * e1000e_phy_hw_reset_generic - PHY hardware reset
2083 * @hw: pointer to the HW structure
2090 s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw) in e1000e_phy_hw_reset_generic() argument
2092 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_hw_reset_generic()
2094 u32 ctrl; in e1000e_phy_hw_reset_generic() local
2096 if (phy->ops.check_reset_block) { in e1000e_phy_hw_reset_generic()
2097 ret_val = phy->ops.check_reset_block(hw); in e1000e_phy_hw_reset_generic()
2102 ret_val = phy->ops.acquire(hw); in e1000e_phy_hw_reset_generic()
2106 ctrl = er32(CTRL); in e1000e_phy_hw_reset_generic()
2107 ew32(CTRL, ctrl | E1000_CTRL_PHY_RST); in e1000e_phy_hw_reset_generic()
2110 udelay(phy->reset_delay_us); in e1000e_phy_hw_reset_generic()
2112 ew32(CTRL, ctrl); in e1000e_phy_hw_reset_generic()
2117 phy->ops.release(hw); in e1000e_phy_hw_reset_generic()
2119 return phy->ops.get_cfg_done(hw); in e1000e_phy_hw_reset_generic()
2123 * e1000e_get_cfg_done_generic - Generic configuration done
2124 * @hw: pointer to the HW structure
2126 * Generic function to wait 10 milli-seconds for configuration to complete
2129 s32 e1000e_get_cfg_done_generic(struct e1000_hw __always_unused *hw) in e1000e_get_cfg_done_generic() argument
2137 * e1000e_phy_init_script_igp3 - Inits the IGP3 PHY
2138 * @hw: pointer to the HW structure
2142 s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw) in e1000e_phy_init_script_igp3() argument
2147 /* Enable rise/fall, 10-mode work in class-A */ in e1000e_phy_init_script_igp3()
2148 e1e_wphy(hw, 0x2F5B, 0x9018); in e1000e_phy_init_script_igp3()
2150 e1e_wphy(hw, 0x2F52, 0x0000); in e1000e_phy_init_script_igp3()
2152 e1e_wphy(hw, 0x2FB1, 0x8B24); in e1000e_phy_init_script_igp3()
2154 e1e_wphy(hw, 0x2FB2, 0xF8F0); in e1000e_phy_init_script_igp3()
2156 e1e_wphy(hw, 0x2010, 0x10B0); in e1000e_phy_init_script_igp3()
2158 e1e_wphy(hw, 0x2011, 0x0000); in e1000e_phy_init_script_igp3()
2160 e1e_wphy(hw, 0x20DD, 0x249A); in e1000e_phy_init_script_igp3()
2162 e1e_wphy(hw, 0x20DE, 0x00D3); in e1000e_phy_init_script_igp3()
2164 e1e_wphy(hw, 0x28B4, 0x04CE); in e1000e_phy_init_script_igp3()
2166 e1e_wphy(hw, 0x2F70, 0x29E4); in e1000e_phy_init_script_igp3()
2168 e1e_wphy(hw, 0x0000, 0x0140); in e1000e_phy_init_script_igp3()
2170 e1e_wphy(hw, 0x1F30, 0x1606); in e1000e_phy_init_script_igp3()
2172 e1e_wphy(hw, 0x1F31, 0xB814); in e1000e_phy_init_script_igp3()
2174 e1e_wphy(hw, 0x1F35, 0x002A); in e1000e_phy_init_script_igp3()
2176 e1e_wphy(hw, 0x1F3E, 0x0067); in e1000e_phy_init_script_igp3()
2178 e1e_wphy(hw, 0x1F54, 0x0065); in e1000e_phy_init_script_igp3()
2180 e1e_wphy(hw, 0x1F55, 0x002A); in e1000e_phy_init_script_igp3()
2182 e1e_wphy(hw, 0x1F56, 0x002A); in e1000e_phy_init_script_igp3()
2184 e1e_wphy(hw, 0x1F72, 0x3FB0); in e1000e_phy_init_script_igp3()
2186 e1e_wphy(hw, 0x1F76, 0xC0FF); in e1000e_phy_init_script_igp3()
2188 e1e_wphy(hw, 0x1F77, 0x1DEC); in e1000e_phy_init_script_igp3()
2190 e1e_wphy(hw, 0x1F78, 0xF9EF); in e1000e_phy_init_script_igp3()
2192 e1e_wphy(hw, 0x1F79, 0x0210); in e1000e_phy_init_script_igp3()
2194 e1e_wphy(hw, 0x1895, 0x0003); in e1000e_phy_init_script_igp3()
2196 e1e_wphy(hw, 0x1796, 0x0008); in e1000e_phy_init_script_igp3()
2198 e1e_wphy(hw, 0x1798, 0xD008); in e1000e_phy_init_script_igp3()
2202 e1e_wphy(hw, 0x1898, 0xD918); in e1000e_phy_init_script_igp3()
2204 e1e_wphy(hw, 0x187A, 0x0800); in e1000e_phy_init_script_igp3()
2205 /* Enable LPLU and disable AN to 1000 in non-D0a states, in e1000e_phy_init_script_igp3()
2208 e1e_wphy(hw, 0x0019, 0x008D); in e1000e_phy_init_script_igp3()
2210 e1e_wphy(hw, 0x001B, 0x2080); in e1000e_phy_init_script_igp3()
2212 e1e_wphy(hw, 0x0014, 0x0045); in e1000e_phy_init_script_igp3()
2214 e1e_wphy(hw, 0x0000, 0x1340); in e1000e_phy_init_script_igp3()
2220 * e1000e_get_phy_type_from_id - Get PHY type from id
2274 * e1000e_determine_phy_address - Determines PHY address.
2275 * @hw: pointer to the HW structure
2281 s32 e1000e_determine_phy_address(struct e1000_hw *hw) in e1000e_determine_phy_address() argument
2287 hw->phy.id = phy_type; in e1000e_determine_phy_address()
2290 hw->phy.addr = phy_addr; in e1000e_determine_phy_address()
2294 e1000e_get_phy_id(hw); in e1000e_determine_phy_address()
2295 phy_type = e1000e_get_phy_type_from_id(hw->phy.id); in e1000e_determine_phy_address()
2297 /* If phy_type is valid, break - we found our in e1000e_determine_phy_address()
2308 return -E1000_ERR_PHY_TYPE; in e1000e_determine_phy_address()
2312 * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address
2329 * e1000e_write_phy_reg_bm - Write BM PHY register
2330 * @hw: pointer to the HW structure
2337 s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm() argument
2342 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm()
2348 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm()
2353 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_write_phy_reg_bm()
2362 if (hw->phy.addr == 1) { in e1000e_write_phy_reg_bm()
2371 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, in e1000e_write_phy_reg_bm()
2377 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm()
2381 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm()
2386 * e1000e_read_phy_reg_bm - Read BM PHY register
2387 * @hw: pointer to the HW structure
2395 s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm() argument
2400 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm()
2406 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm()
2411 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_read_phy_reg_bm()
2420 if (hw->phy.addr == 1) { in e1000e_read_phy_reg_bm()
2429 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, in e1000e_read_phy_reg_bm()
2435 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm()
2438 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm()
2443 * e1000e_read_phy_reg_bm2 - Read BM PHY register
2444 * @hw: pointer to the HW structure
2452 s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm2() argument
2457 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm2()
2463 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm2()
2468 hw->phy.addr = 1; in e1000e_read_phy_reg_bm2()
2472 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, in e1000e_read_phy_reg_bm2()
2479 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm2()
2482 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm2()
2487 * e1000e_write_phy_reg_bm2 - Write BM PHY register
2488 * @hw: pointer to the HW structure
2495 s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm2() argument
2500 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm2()
2506 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm2()
2511 hw->phy.addr = 1; in e1000e_write_phy_reg_bm2()
2515 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, in e1000e_write_phy_reg_bm2()
2522 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm2()
2526 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm2()
2531 * e1000_enable_phy_wakeup_reg_access_bm - enable access to BM wakeup registers
2532 * @hw: pointer to the HW structure
2538 s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) in e1000_enable_phy_wakeup_reg_access_bm() argument
2543 /* All page select, port ctrl and wakeup registers use phy address 1 */ in e1000_enable_phy_wakeup_reg_access_bm()
2544 hw->phy.addr = 1; in e1000_enable_phy_wakeup_reg_access_bm()
2547 ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); in e1000_enable_phy_wakeup_reg_access_bm()
2553 ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); in e1000_enable_phy_wakeup_reg_access_bm()
2567 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, temp); in e1000_enable_phy_wakeup_reg_access_bm()
2574 /* Select Host Wakeup Registers page - caller now able to write in e1000_enable_phy_wakeup_reg_access_bm()
2577 return e1000_set_page_igp(hw, (BM_WUC_PAGE << IGP_PAGE_SHIFT)); in e1000_enable_phy_wakeup_reg_access_bm()
2581 * e1000_disable_phy_wakeup_reg_access_bm - disable access to BM wakeup regs
2582 * @hw: pointer to the HW structure
2591 s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) in e1000_disable_phy_wakeup_reg_access_bm() argument
2596 ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); in e1000_disable_phy_wakeup_reg_access_bm()
2603 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, *phy_reg); in e1000_disable_phy_wakeup_reg_access_bm()
2612 * e1000_access_phy_wakeup_reg_bm - Read/write BM PHY wakeup register
2613 * @hw: pointer to the HW structure
2636 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, in e1000_access_phy_wakeup_reg_bm() argument
2645 if ((hw->mac.type == e1000_pchlan) && in e1000_access_phy_wakeup_reg_bm()
2652 ret_val = e1000_enable_phy_wakeup_reg_access_bm(hw, &phy_reg); in e1000_access_phy_wakeup_reg_bm()
2662 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ADDRESS_OPCODE, reg); in e1000_access_phy_wakeup_reg_bm()
2670 ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, in e1000_access_phy_wakeup_reg_bm()
2674 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, in e1000_access_phy_wakeup_reg_bm()
2684 ret_val = e1000_disable_phy_wakeup_reg_access_bm(hw, &phy_reg); in e1000_access_phy_wakeup_reg_bm()
2690 * e1000_power_up_phy_copper - Restore copper link in case of PHY power down
2691 * @hw: pointer to the HW structure
2697 void e1000_power_up_phy_copper(struct e1000_hw *hw) in e1000_power_up_phy_copper() argument
2702 e1e_rphy(hw, MII_BMCR, &mii_reg); in e1000_power_up_phy_copper()
2704 e1e_wphy(hw, MII_BMCR, mii_reg); in e1000_power_up_phy_copper()
2708 * e1000_power_down_phy_copper - Restore copper link in case of PHY power down
2709 * @hw: pointer to the HW structure
2715 void e1000_power_down_phy_copper(struct e1000_hw *hw) in e1000_power_down_phy_copper() argument
2720 e1e_rphy(hw, MII_BMCR, &mii_reg); in e1000_power_down_phy_copper()
2722 e1e_wphy(hw, MII_BMCR, mii_reg); in e1000_power_down_phy_copper()
2727 * __e1000_read_phy_reg_hv - Read HV PHY register
2728 * @hw: pointer to the HW structure
2738 static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_phy_reg_hv() argument
2744 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_read_phy_reg_hv()
2747 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_phy_reg_hv()
2754 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in __e1000_read_phy_reg_hv()
2760 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_read_phy_reg_hv()
2771 ret_val = e1000_set_page_igp(hw, in __e1000_read_phy_reg_hv()
2774 hw->phy.addr = phy_addr; in __e1000_read_phy_reg_hv()
2784 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, data); in __e1000_read_phy_reg_hv()
2787 hw->phy.ops.release(hw); in __e1000_read_phy_reg_hv()
2793 * e1000_read_phy_reg_hv - Read HV PHY register
2794 * @hw: pointer to the HW structure
2802 s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv() argument
2804 return __e1000_read_phy_reg_hv(hw, offset, data, false, false); in e1000_read_phy_reg_hv()
2808 * e1000_read_phy_reg_hv_locked - Read HV PHY register
2809 * @hw: pointer to the HW structure
2816 s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv_locked() argument
2818 return __e1000_read_phy_reg_hv(hw, offset, data, true, false); in e1000_read_phy_reg_hv_locked()
2822 * e1000_read_phy_reg_page_hv - Read HV PHY register
2823 * @hw: pointer to the HW structure
2830 s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_page_hv() argument
2832 return __e1000_read_phy_reg_hv(hw, offset, data, true, true); in e1000_read_phy_reg_page_hv()
2836 * __e1000_write_phy_reg_hv - Write HV PHY register
2837 * @hw: pointer to the HW structure
2846 static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_phy_reg_hv() argument
2852 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_write_phy_reg_hv()
2855 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_phy_reg_hv()
2862 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in __e1000_write_phy_reg_hv()
2868 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_write_phy_reg_hv()
2880 if ((hw->phy.type == e1000_phy_82578) && in __e1000_write_phy_reg_hv()
2881 (hw->phy.revision >= 1) && in __e1000_write_phy_reg_hv()
2882 (hw->phy.addr == 2) && in __e1000_write_phy_reg_hv()
2886 ret_val = e1000_access_phy_debug_regs_hv(hw, in __e1000_write_phy_reg_hv()
2895 ret_val = e1000_set_page_igp(hw, in __e1000_write_phy_reg_hv()
2898 hw->phy.addr = phy_addr; in __e1000_write_phy_reg_hv()
2908 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, in __e1000_write_phy_reg_hv()
2913 hw->phy.ops.release(hw); in __e1000_write_phy_reg_hv()
2919 * e1000_write_phy_reg_hv - Write HV PHY register
2920 * @hw: pointer to the HW structure
2927 s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv() argument
2929 return __e1000_write_phy_reg_hv(hw, offset, data, false, false); in e1000_write_phy_reg_hv()
2933 * e1000_write_phy_reg_hv_locked - Write HV PHY register
2934 * @hw: pointer to the HW structure
2941 s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv_locked() argument
2943 return __e1000_write_phy_reg_hv(hw, offset, data, true, false); in e1000_write_phy_reg_hv_locked()
2947 * e1000_write_phy_reg_page_hv - Write HV PHY register
2948 * @hw: pointer to the HW structure
2955 s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_page_hv() argument
2957 return __e1000_write_phy_reg_hv(hw, offset, data, true, true); in e1000_write_phy_reg_page_hv()
2961 * e1000_get_phy_addr_for_hv_page - Get PHY address based on page
2975 * e1000_access_phy_debug_regs_hv - Read HV PHY vendor specific high registers
2976 * @hw: pointer to the HW structure
2986 static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, in e1000_access_phy_debug_regs_hv() argument
2994 addr_reg = ((hw->phy.type == e1000_phy_82578) ? in e1000_access_phy_debug_regs_hv()
2999 hw->phy.addr = 2; in e1000_access_phy_debug_regs_hv()
3002 ret_val = e1000e_write_phy_reg_mdic(hw, addr_reg, (u16)offset & 0x3F); in e1000_access_phy_debug_regs_hv()
3010 ret_val = e1000e_read_phy_reg_mdic(hw, data_reg, data); in e1000_access_phy_debug_regs_hv()
3012 ret_val = e1000e_write_phy_reg_mdic(hw, data_reg, *data); in e1000_access_phy_debug_regs_hv()
3021 * e1000_link_stall_workaround_hv - Si workaround
3022 * @hw: pointer to the HW structure
3031 s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) in e1000_link_stall_workaround_hv() argument
3036 if (hw->phy.type != e1000_phy_82578) in e1000_link_stall_workaround_hv()
3040 e1e_rphy(hw, MII_BMCR, &data); in e1000_link_stall_workaround_hv()
3045 ret_val = e1e_rphy(hw, BM_CS_STATUS, &data); in e1000_link_stall_workaround_hv()
3059 ret_val = e1e_wphy(hw, HV_MUX_DATA_CTRL, in e1000_link_stall_workaround_hv()
3065 return e1e_wphy(hw, HV_MUX_DATA_CTRL, HV_MUX_DATA_CTRL_GEN_TO_MAC); in e1000_link_stall_workaround_hv()
3069 * e1000_check_polarity_82577 - Checks the polarity.
3070 * @hw: pointer to the HW structure
3072 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
3076 s32 e1000_check_polarity_82577(struct e1000_hw *hw) in e1000_check_polarity_82577() argument
3078 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_82577()
3082 ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); in e1000_check_polarity_82577()
3085 phy->cable_polarity = ((data & I82577_PHY_STATUS2_REV_POLARITY) in e1000_check_polarity_82577()
3093 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY
3094 * @hw: pointer to the HW structure
3098 s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw) in e1000_phy_force_speed_duplex_82577() argument
3100 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_82577()
3105 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000_phy_force_speed_duplex_82577()
3109 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000_phy_force_speed_duplex_82577()
3111 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000_phy_force_speed_duplex_82577()
3117 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_82577()
3120 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_82577()
3129 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_82577()
3137 * e1000_get_phy_info_82577 - Retrieve I82577 PHY information
3138 * @hw: pointer to the HW structure
3141 * set/determine 10base-T extended distance and polarity correction. Read
3145 s32 e1000_get_phy_info_82577(struct e1000_hw *hw) in e1000_get_phy_info_82577() argument
3147 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_82577()
3152 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000_get_phy_info_82577()
3158 return -E1000_ERR_CONFIG; in e1000_get_phy_info_82577()
3161 phy->polarity_correction = true; in e1000_get_phy_info_82577()
3163 ret_val = e1000_check_polarity_82577(hw); in e1000_get_phy_info_82577()
3167 ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); in e1000_get_phy_info_82577()
3171 phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX); in e1000_get_phy_info_82577()
3175 ret_val = hw->phy.ops.get_cable_length(hw); in e1000_get_phy_info_82577()
3179 ret_val = e1e_rphy(hw, MII_STAT1000, &data); in e1000_get_phy_info_82577()
3183 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000_get_phy_info_82577()
3186 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000_get_phy_info_82577()
3189 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_82577()
3190 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3191 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3198 * e1000_get_cable_length_82577 - Determine cable length for 82577 PHY
3199 * @hw: pointer to the HW structure
3204 s32 e1000_get_cable_length_82577(struct e1000_hw *hw) in e1000_get_cable_length_82577() argument
3206 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_82577()
3210 ret_val = e1e_rphy(hw, I82577_PHY_DIAG_STATUS, &phy_data); in e1000_get_cable_length_82577()
3218 return -E1000_ERR_PHY; in e1000_get_cable_length_82577()
3220 phy->cable_length = length; in e1000_get_cable_length_82577()