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()
111 * e1000e_read_phy_reg_mdic - Read MDI control register
112 * @hw: pointer to the HW structure
119 s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_mdic() argument
121 struct e1000_phy_info *phy = &hw->phy; in e1000e_read_phy_reg_mdic()
126 return -E1000_ERR_PARAM; in e1000e_read_phy_reg_mdic()
129 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_read_phy_reg_mdic()
134 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_read_phy_reg_mdic()
151 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
155 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
158 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()
173 * e1000e_write_phy_reg_mdic - Write MDI control register
174 * @hw: pointer to the HW structure
180 s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_mdic() argument
182 struct e1000_phy_info *phy = &hw->phy; in e1000e_write_phy_reg_mdic()
187 return -E1000_ERR_PARAM; in e1000e_write_phy_reg_mdic()
190 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_write_phy_reg_mdic()
196 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_write_phy_reg_mdic()
213 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
217 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
220 e_dbg("MDI Write offset error - requested %d, returned %d\n", in e1000e_write_phy_reg_mdic()
222 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
228 if (hw->mac.type == e1000_pch2lan) in e1000e_write_phy_reg_mdic()
235 * e1000e_read_phy_reg_m88 - Read m88 PHY register
236 * @hw: pointer to the HW structure
244 s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_m88() argument
248 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_m88()
252 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_m88()
255 hw->phy.ops.release(hw); in e1000e_read_phy_reg_m88()
261 * e1000e_write_phy_reg_m88 - Write m88 PHY register
262 * @hw: pointer to the HW structure
269 s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_m88() argument
273 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_m88()
277 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_m88()
280 hw->phy.ops.release(hw); in e1000e_write_phy_reg_m88()
286 * e1000_set_page_igp - Set page as on IGP-like PHY(s)
287 * @hw: pointer to the HW structure
294 s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page) in e1000_set_page_igp() argument
298 hw->phy.addr = 1; in e1000_set_page_igp()
300 return e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, page); in e1000_set_page_igp()
304 * __e1000e_read_phy_reg_igp - Read igp PHY register
305 * @hw: pointer to the HW structure
314 static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000e_read_phy_reg_igp() argument
320 if (!hw->phy.ops.acquire) in __e1000e_read_phy_reg_igp()
323 ret_val = hw->phy.ops.acquire(hw); in __e1000e_read_phy_reg_igp()
329 ret_val = e1000e_write_phy_reg_mdic(hw, in __e1000e_read_phy_reg_igp()
333 ret_val = e1000e_read_phy_reg_mdic(hw, in __e1000e_read_phy_reg_igp()
337 hw->phy.ops.release(hw); in __e1000e_read_phy_reg_igp()
343 * e1000e_read_phy_reg_igp - Read igp PHY register
344 * @hw: pointer to the HW structure
352 s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp() argument
354 return __e1000e_read_phy_reg_igp(hw, offset, data, false); in e1000e_read_phy_reg_igp()
358 * e1000e_read_phy_reg_igp_locked - Read igp PHY register
359 * @hw: pointer to the HW structure
366 s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp_locked() argument
368 return __e1000e_read_phy_reg_igp(hw, offset, data, true); in e1000e_read_phy_reg_igp_locked()
372 * __e1000e_write_phy_reg_igp - Write igp PHY register
373 * @hw: pointer to the HW structure
381 static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data, in __e1000e_write_phy_reg_igp() argument
387 if (!hw->phy.ops.acquire) in __e1000e_write_phy_reg_igp()
390 ret_val = hw->phy.ops.acquire(hw); in __e1000e_write_phy_reg_igp()
396 ret_val = e1000e_write_phy_reg_mdic(hw, in __e1000e_write_phy_reg_igp()
400 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & in __e1000e_write_phy_reg_igp()
403 hw->phy.ops.release(hw); in __e1000e_write_phy_reg_igp()
409 * e1000e_write_phy_reg_igp - Write igp PHY register
410 * @hw: pointer to the HW structure
417 s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp() argument
419 return __e1000e_write_phy_reg_igp(hw, offset, data, false); in e1000e_write_phy_reg_igp()
423 * e1000e_write_phy_reg_igp_locked - Write igp PHY register
424 * @hw: pointer to the HW structure
431 s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp_locked() argument
433 return __e1000e_write_phy_reg_igp(hw, offset, data, true); in e1000e_write_phy_reg_igp_locked()
437 * __e1000_read_kmrn_reg - Read kumeran register
438 * @hw: pointer to the HW structure
447 static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_kmrn_reg() argument
455 if (!hw->phy.ops.acquire) in __e1000_read_kmrn_reg()
458 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_kmrn_reg()
474 hw->phy.ops.release(hw); in __e1000_read_kmrn_reg()
480 * e1000e_read_kmrn_reg - Read kumeran register
481 * @hw: pointer to the HW structure
489 s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg() argument
491 return __e1000_read_kmrn_reg(hw, offset, data, false); in e1000e_read_kmrn_reg()
495 * e1000e_read_kmrn_reg_locked - Read kumeran register
496 * @hw: pointer to the HW structure
504 s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg_locked() argument
506 return __e1000_read_kmrn_reg(hw, offset, data, true); in e1000e_read_kmrn_reg_locked()
510 * __e1000_write_kmrn_reg - Write kumeran register
511 * @hw: pointer to the HW structure
520 static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_kmrn_reg() argument
528 if (!hw->phy.ops.acquire) in __e1000_write_kmrn_reg()
531 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_kmrn_reg()
543 hw->phy.ops.release(hw); in __e1000_write_kmrn_reg()
549 * e1000e_write_kmrn_reg - Write kumeran register
550 * @hw: pointer to the HW structure
557 s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg() argument
559 return __e1000_write_kmrn_reg(hw, offset, data, false); in e1000e_write_kmrn_reg()
563 * e1000e_write_kmrn_reg_locked - Write kumeran register
564 * @hw: pointer to the HW structure
571 s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg_locked() argument
573 return __e1000_write_kmrn_reg(hw, offset, data, true); in e1000e_write_kmrn_reg_locked()
577 * e1000_set_master_slave_mode - Setup PHY for Master/slave mode
578 * @hw: pointer to the HW structure
582 static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) in e1000_set_master_slave_mode() argument
588 ret_val = e1e_rphy(hw, MII_CTRL1000, &phy_data); in e1000_set_master_slave_mode()
593 hw->phy.original_ms_type = (phy_data & CTL1000_ENABLE_MASTER) ? in e1000_set_master_slave_mode()
597 switch (hw->phy.ms_type) { in e1000_set_master_slave_mode()
612 return e1e_wphy(hw, MII_CTRL1000, phy_data); in e1000_set_master_slave_mode()
616 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
617 * @hw: pointer to the HW structure
619 * Sets up Carrier-sense on Transmit and downshift values.
621 s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) in e1000_copper_link_setup_82577() argument
626 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000_copper_link_setup_82577()
627 ret_val = e1e_rphy(hw, I82577_CFG_REG, &phy_data); in e1000_copper_link_setup_82577()
636 ret_val = e1e_wphy(hw, I82577_CFG_REG, phy_data); in e1000_copper_link_setup_82577()
641 ret_val = e1e_rphy(hw, I82577_PHY_CTRL_2, &phy_data); in e1000_copper_link_setup_82577()
646 * 0 - Auto (default) in e1000_copper_link_setup_82577()
647 * 1 - MDI mode in e1000_copper_link_setup_82577()
648 * 2 - MDI-X mode in e1000_copper_link_setup_82577()
650 switch (hw->phy.mdix) { in e1000_copper_link_setup_82577()
661 ret_val = e1e_wphy(hw, I82577_PHY_CTRL_2, phy_data); in e1000_copper_link_setup_82577()
665 return e1000_set_master_slave_mode(hw); in e1000_copper_link_setup_82577()
669 * e1000e_copper_link_setup_m88 - Setup m88 PHY's for copper link
670 * @hw: pointer to the HW structure
672 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
675 s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) in e1000e_copper_link_setup_m88() argument
677 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_m88()
681 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000e_copper_link_setup_m88()
682 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
687 if (phy->type != e1000_phy_bm) in e1000e_copper_link_setup_m88()
691 * MDI/MDI-X = 0 (default) in e1000e_copper_link_setup_m88()
692 * 0 - Auto for all speeds in e1000e_copper_link_setup_m88()
693 * 1 - MDI mode in e1000e_copper_link_setup_m88()
694 * 2 - MDI-X mode in e1000e_copper_link_setup_m88()
695 * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) in e1000e_copper_link_setup_m88()
699 switch (phy->mdix) { in e1000e_copper_link_setup_m88()
718 * 0 - Disabled in e1000e_copper_link_setup_m88()
719 * 1 - Enabled in e1000e_copper_link_setup_m88()
722 if (phy->disable_polarity_correction) in e1000e_copper_link_setup_m88()
726 if (phy->type == e1000_phy_bm) { in e1000e_copper_link_setup_m88()
728 if (phy->id == BME1000_E_PHY_ID_R2) { in e1000e_copper_link_setup_m88()
730 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, in e1000e_copper_link_setup_m88()
735 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
745 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
749 if ((phy->type == e1000_phy_m88) && in e1000e_copper_link_setup_m88()
750 (phy->revision < E1000_REVISION_4) && in e1000e_copper_link_setup_m88()
751 (phy->id != BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
755 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_copper_link_setup_m88()
761 if ((phy->revision == 2) && (phy->id == M88E1111_I_PHY_ID)) { in e1000e_copper_link_setup_m88()
762 /* 82573L PHY - set the downshift counter to 5x. */ in e1000e_copper_link_setup_m88()
772 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
777 if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
779 ret_val = e1e_wphy(hw, 29, 0x0003); in e1000e_copper_link_setup_m88()
784 ret_val = e1e_wphy(hw, 30, 0x0000); in e1000e_copper_link_setup_m88()
790 if (phy->ops.commit) { in e1000e_copper_link_setup_m88()
791 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
798 if (phy->type == e1000_phy_82578) { 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()
803 /* 82578 PHY - set the downshift count to 1x. */ in e1000e_copper_link_setup_m88()
806 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_copper_link_setup_m88()
815 * e1000e_copper_link_setup_igp - Setup igp PHY's for copper link
816 * @hw: pointer to the HW structure
818 * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
821 s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw) in e1000e_copper_link_setup_igp() argument
823 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_igp()
827 ret_val = e1000_phy_hw_reset(hw); in e1000e_copper_link_setup_igp()
839 if (hw->phy.ops.set_d0_lplu_state) { in e1000e_copper_link_setup_igp()
840 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); in e1000e_copper_link_setup_igp()
846 /* Configure mdi-mdix settings */ in e1000e_copper_link_setup_igp()
847 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &data); in e1000e_copper_link_setup_igp()
853 switch (phy->mdix) { in e1000e_copper_link_setup_igp()
865 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CTRL, data); in e1000e_copper_link_setup_igp()
869 /* set auto-master slave resolution settings */ in e1000e_copper_link_setup_igp()
870 if (hw->mac.autoneg) { in e1000e_copper_link_setup_igp()
875 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000e_copper_link_setup_igp()
877 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_copper_link_setup_igp()
883 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_copper_link_setup_igp()
889 ret_val = e1e_rphy(hw, MII_CTRL1000, &data); in e1000e_copper_link_setup_igp()
894 ret_val = e1e_wphy(hw, MII_CTRL1000, data); in e1000e_copper_link_setup_igp()
899 ret_val = e1000_set_master_slave_mode(hw); in e1000e_copper_link_setup_igp()
906 * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation
907 * @hw: pointer to the HW structure
909 * Reads the MII auto-neg advertisement register and/or the 1000T control
910 * register and if the PHY is already setup for auto-negotiation, then
911 * return successful. Otherwise, setup advertisement and flow control to
912 * the appropriate values for the wanted auto-negotiation.
914 static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) in e1000_phy_setup_autoneg() argument
916 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_setup_autoneg()
921 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_phy_setup_autoneg()
923 /* Read the MII Auto-Neg Advertisement Register (Address 4). */ in e1000_phy_setup_autoneg()
924 ret_val = e1e_rphy(hw, MII_ADVERTISE, &mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
928 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
929 /* Read the MII 1000Base-T Control Register (Address 9). */ in e1000_phy_setup_autoneg()
930 ret_val = e1e_rphy(hw, MII_CTRL1000, &mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
942 /* First we clear all the 10/100 mb speed bits in the Auto-Neg in e1000_phy_setup_autoneg()
944 * the 1000Base-T Control Register (Address 9). in e1000_phy_setup_autoneg()
951 e_dbg("autoneg_advertised %x\n", phy->autoneg_advertised); in e1000_phy_setup_autoneg()
954 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
960 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
966 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
972 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
978 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in e1000_phy_setup_autoneg()
982 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
987 /* Check for a software override of the flow control settings, and in e1000_phy_setup_autoneg()
989 * auto-negotiation is enabled, then software will have to set the in e1000_phy_setup_autoneg()
990 * "PAUSE" bits to the correct value in the Auto-Negotiation in e1000_phy_setup_autoneg()
991 * Advertisement Register (MII_ADVERTISE) and re-start auto- in e1000_phy_setup_autoneg()
995 * 0: Flow control is completely disabled in e1000_phy_setup_autoneg()
996 * 1: Rx flow control is enabled (we can receive pause frames in e1000_phy_setup_autoneg()
998 * 2: Tx flow control is enabled (we can send pause frames in e1000_phy_setup_autoneg()
1000 * 3: Both Rx and Tx flow control (symmetric) are enabled. in e1000_phy_setup_autoneg()
1001 * other: No software override. The flow control configuration in e1000_phy_setup_autoneg()
1004 switch (hw->fc.current_mode) { in e1000_phy_setup_autoneg()
1006 /* Flow control (Rx & Tx) is completely disabled by a in e1000_phy_setup_autoneg()
1007 * software over-ride. in e1000_phy_setup_autoneg()
1011 phy->autoneg_advertised &= in e1000_phy_setup_autoneg()
1015 /* Rx Flow control is enabled, and Tx Flow control is in e1000_phy_setup_autoneg()
1016 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1022 * hw's ability to send PAUSE frames. in e1000_phy_setup_autoneg()
1026 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1030 /* Tx Flow control is enabled, and Rx Flow control is in e1000_phy_setup_autoneg()
1031 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1035 phy->autoneg_advertised |= ADVERTISED_Asym_Pause; in e1000_phy_setup_autoneg()
1036 phy->autoneg_advertised &= ~ADVERTISED_Pause; in e1000_phy_setup_autoneg()
1039 /* Flow control (both Rx and Tx) is enabled by a software in e1000_phy_setup_autoneg()
1040 * over-ride. in e1000_phy_setup_autoneg()
1044 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1048 e_dbg("Flow control param set incorrectly\n"); in e1000_phy_setup_autoneg()
1049 return -E1000_ERR_CONFIG; in e1000_phy_setup_autoneg()
1052 ret_val = e1e_wphy(hw, MII_ADVERTISE, mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1056 e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1058 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in e1000_phy_setup_autoneg()
1059 ret_val = e1e_wphy(hw, MII_CTRL1000, mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
1065 * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link
1066 * @hw: pointer to the HW structure
1073 static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) in e1000_copper_link_autoneg() argument
1075 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_autoneg()
1082 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_copper_link_autoneg()
1087 if (!phy->autoneg_advertised) in e1000_copper_link_autoneg()
1088 phy->autoneg_advertised = phy->autoneg_mask; in e1000_copper_link_autoneg()
1090 e_dbg("Reconfiguring auto-neg advertisement params\n"); in e1000_copper_link_autoneg()
1091 ret_val = e1000_phy_setup_autoneg(hw); in e1000_copper_link_autoneg()
1093 e_dbg("Error Setting up Auto-Negotiation\n"); in e1000_copper_link_autoneg()
1096 e_dbg("Restarting Auto-Neg\n"); in e1000_copper_link_autoneg()
1098 /* Restart auto-negotiation by setting the Auto Neg Enable bit and in e1000_copper_link_autoneg()
1101 ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl); in e1000_copper_link_autoneg()
1106 ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl); in e1000_copper_link_autoneg()
1110 /* Does the user want to wait for Auto-Neg to complete here, or in e1000_copper_link_autoneg()
1113 if (phy->autoneg_wait_to_complete) { in e1000_copper_link_autoneg()
1114 ret_val = e1000_wait_autoneg(hw); in e1000_copper_link_autoneg()
1121 hw->mac.get_link_status = true; in e1000_copper_link_autoneg()
1127 * e1000e_setup_copper_link - Configure copper link settings
1128 * @hw: pointer to the HW structure
1130 * Calls the appropriate function to configure the link for auto-neg or forced
1132 * to configure collision distance and flow control are called. If link is
1133 * not established, we return -E1000_ERR_PHY (-2).
1135 s32 e1000e_setup_copper_link(struct e1000_hw *hw) in e1000e_setup_copper_link() argument
1140 if (hw->mac.autoneg) { in e1000e_setup_copper_link()
1141 /* Setup autoneg and flow control advertisement and perform in e1000e_setup_copper_link()
1144 ret_val = e1000_copper_link_autoneg(hw); in e1000e_setup_copper_link()
1152 ret_val = hw->phy.ops.force_speed_duplex(hw); in e1000e_setup_copper_link()
1162 ret_val = e1000e_phy_has_link_generic(hw, COPPER_LINK_UP_LIMIT, 10, in e1000e_setup_copper_link()
1169 hw->mac.ops.config_collision_dist(hw); in e1000e_setup_copper_link()
1170 ret_val = e1000e_config_fc_after_link_up(hw); in e1000e_setup_copper_link()
1179 * e1000e_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
1180 * @hw: pointer to the HW structure
1183 * auto-crossover to force MDI manually. Waits for link and returns
1184 * successful if link up is successful, else -E1000_ERR_PHY (-2).
1186 s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw) in e1000e_phy_force_speed_duplex_igp() argument
1188 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_igp()
1193 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1197 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1199 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000e_phy_force_speed_duplex_igp()
1203 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI in e1000e_phy_force_speed_duplex_igp()
1206 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_igp()
1213 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000e_phy_force_speed_duplex_igp()
1221 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_igp()
1224 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_igp()
1233 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_igp()
1241 * e1000e_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
1242 * @hw: pointer to the HW structure
1245 * auto-crossover to force MDI manually. Resets the PHY to commit the
1250 s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) in e1000e_phy_force_speed_duplex_m88() argument
1252 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_m88()
1257 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI in e1000e_phy_force_speed_duplex_m88()
1260 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1265 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1271 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1275 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1277 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000e_phy_force_speed_duplex_m88()
1282 if (hw->phy.ops.commit) { in e1000e_phy_force_speed_duplex_m88()
1283 ret_val = hw->phy.ops.commit(hw); in e1000e_phy_force_speed_duplex_m88()
1288 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_m88()
1291 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_m88()
1297 if (hw->phy.type != e1000_phy_m88) { in e1000e_phy_force_speed_duplex_m88()
1303 ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, in e1000e_phy_force_speed_duplex_m88()
1307 ret_val = e1000e_phy_reset_dsp(hw); in e1000e_phy_force_speed_duplex_m88()
1314 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000e_phy_force_speed_duplex_m88()
1320 if (hw->phy.type != e1000_phy_m88) in e1000e_phy_force_speed_duplex_m88()
1323 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1327 /* Resetting the phy means we need to re-force TX_CLK in the in e1000e_phy_force_speed_duplex_m88()
1332 ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1336 /* In addition, we must re-enable CRS on Tx for both half and full in e1000e_phy_force_speed_duplex_m88()
1339 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_phy_force_speed_duplex_m88()
1344 ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000e_phy_force_speed_duplex_m88()
1350 * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex
1351 * @hw: pointer to the HW structure
1357 s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw) in e1000_phy_force_speed_duplex_ife() argument
1359 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_ife()
1364 ret_val = e1e_rphy(hw, MII_BMCR, &data); in e1000_phy_force_speed_duplex_ife()
1368 e1000e_phy_force_speed_duplex_setup(hw, &data); in e1000_phy_force_speed_duplex_ife()
1370 ret_val = e1e_wphy(hw, MII_BMCR, data); in e1000_phy_force_speed_duplex_ife()
1374 /* Disable MDI-X support for 10/100 */ in e1000_phy_force_speed_duplex_ife()
1375 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_phy_force_speed_duplex_ife()
1382 ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data); in e1000_phy_force_speed_duplex_ife()
1390 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_ife()
1393 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_ife()
1402 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_ife()
1412 * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
1413 * @hw: pointer to the HW structure
1416 * Forces speed and duplex on the PHY by doing the following: disable flow
1418 * disable auto-negotiation, configure duplex, configure speed, configure
1419 * the collision distance, write configuration to CTRL register. The
1423 void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) in e1000e_phy_force_speed_duplex_setup() argument
1425 struct e1000_mac_info *mac = &hw->mac; in e1000e_phy_force_speed_duplex_setup()
1426 u32 ctrl; in e1000e_phy_force_speed_duplex_setup() local
1428 /* Turn off flow control when forcing speed/duplex */ in e1000e_phy_force_speed_duplex_setup()
1429 hw->fc.current_mode = e1000_fc_none; in e1000e_phy_force_speed_duplex_setup()
1432 ctrl = er32(CTRL); in e1000e_phy_force_speed_duplex_setup()
1433 ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); in e1000e_phy_force_speed_duplex_setup()
1434 ctrl &= ~E1000_CTRL_SPD_SEL; in e1000e_phy_force_speed_duplex_setup()
1437 ctrl &= ~E1000_CTRL_ASDE; in e1000e_phy_force_speed_duplex_setup()
1443 if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) { in e1000e_phy_force_speed_duplex_setup()
1444 ctrl &= ~E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1448 ctrl |= E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1454 if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) { in e1000e_phy_force_speed_duplex_setup()
1455 ctrl |= E1000_CTRL_SPD_100; in e1000e_phy_force_speed_duplex_setup()
1460 ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); in e1000e_phy_force_speed_duplex_setup()
1465 hw->mac.ops.config_collision_dist(hw); in e1000e_phy_force_speed_duplex_setup()
1467 ew32(CTRL, ctrl); in e1000e_phy_force_speed_duplex_setup()
1471 * e1000e_set_d3_lplu_state - Sets low power link up state for D3
1472 * @hw: pointer to the HW structure
1484 s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active) in e1000e_set_d3_lplu_state() argument
1486 struct e1000_phy_info *phy = &hw->phy; in e1000e_set_d3_lplu_state()
1490 ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data); in e1000e_set_d3_lplu_state()
1496 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000e_set_d3_lplu_state()
1504 if (phy->smart_speed == e1000_smart_speed_on) { in e1000e_set_d3_lplu_state()
1505 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1511 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1515 } else if (phy->smart_speed == e1000_smart_speed_off) { in e1000e_set_d3_lplu_state()
1516 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1522 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000e_set_d3_lplu_state()
1527 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in e1000e_set_d3_lplu_state()
1528 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || in e1000e_set_d3_lplu_state()
1529 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { in e1000e_set_d3_lplu_state()
1531 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000e_set_d3_lplu_state()
1536 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); in e1000e_set_d3_lplu_state()
1541 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); in e1000e_set_d3_lplu_state()
1548 * e1000e_check_downshift - Checks whether a downshift in speed occurred
1549 * @hw: pointer to the HW structure
1555 s32 e1000e_check_downshift(struct e1000_hw *hw) in e1000e_check_downshift() argument
1557 struct e1000_phy_info *phy = &hw->phy; in e1000e_check_downshift()
1561 switch (phy->type) { in e1000e_check_downshift()
1576 phy->speed_downgraded = false; in e1000e_check_downshift()
1580 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000e_check_downshift()
1583 phy->speed_downgraded = !!(phy_data & mask); in e1000e_check_downshift()
1589 * e1000_check_polarity_m88 - Checks the polarity.
1590 * @hw: pointer to the HW structure
1592 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1596 s32 e1000_check_polarity_m88(struct e1000_hw *hw) in e1000_check_polarity_m88() argument
1598 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_m88()
1602 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &data); in e1000_check_polarity_m88()
1605 phy->cable_polarity = ((data & M88E1000_PSSR_REV_POLARITY) in e1000_check_polarity_m88()
1613 * e1000_check_polarity_igp - Checks the polarity.
1614 * @hw: pointer to the HW structure
1616 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1621 s32 e1000_check_polarity_igp(struct e1000_hw *hw) in e1000_check_polarity_igp() argument
1623 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_igp()
1630 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000_check_polarity_igp()
1646 ret_val = e1e_rphy(hw, offset, &data); in e1000_check_polarity_igp()
1649 phy->cable_polarity = ((data & mask) in e1000_check_polarity_igp()
1657 * e1000_check_polarity_ife - Check cable polarity for IFE PHY
1658 * @hw: pointer to the HW structure
1662 s32 e1000_check_polarity_ife(struct e1000_hw *hw) in e1000_check_polarity_ife() argument
1664 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_ife()
1670 if (phy->polarity_correction) { in e1000_check_polarity_ife()
1678 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000_check_polarity_ife()
1681 phy->cable_polarity = ((phy_data & mask) in e1000_check_polarity_ife()
1689 * e1000_wait_autoneg - Wait for auto-neg completion
1690 * @hw: pointer to the HW structure
1692 * Waits for auto-negotiation to complete or for the auto-negotiation time
1695 static s32 e1000_wait_autoneg(struct e1000_hw *hw) in e1000_wait_autoneg() argument
1701 for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { in e1000_wait_autoneg()
1702 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000_wait_autoneg()
1705 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000_wait_autoneg()
1713 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation in e1000_wait_autoneg()
1720 * e1000e_phy_has_link_generic - Polls PHY for link
1721 * @hw: pointer to the HW structure
1728 s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, in e1000e_phy_has_link_generic() argument
1740 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000e_phy_has_link_generic()
1751 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); in e1000e_phy_has_link_generic()
1768 * e1000e_get_cable_length_m88 - Determine cable length for m88 PHY
1769 * @hw: pointer to the HW structure
1777 * 1 50 - 80 meters
1778 * 2 80 - 110 meters
1779 * 3 110 - 140 meters
1782 s32 e1000e_get_cable_length_m88(struct e1000_hw *hw) in e1000e_get_cable_length_m88() argument
1784 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_m88()
1788 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000e_get_cable_length_m88()
1794 if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) in e1000e_get_cable_length_m88()
1795 return -E1000_ERR_PHY; in e1000e_get_cable_length_m88()
1797 phy->min_cable_length = e1000_m88_cable_length_table[index]; in e1000e_get_cable_length_m88()
1798 phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; in e1000e_get_cable_length_m88()
1800 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_m88()
1806 * e1000e_get_cable_length_igp_2 - Determine cable length for igp2 PHY
1807 * @hw: pointer to the HW structure
1816 s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw) in e1000e_get_cable_length_igp_2() argument
1818 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_igp_2()
1822 u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1; in e1000e_get_cable_length_igp_2()
1832 ret_val = e1e_rphy(hw, agc_reg_array[i], &phy_data); in e1000e_get_cable_length_igp_2()
1847 return -E1000_ERR_PHY; in e1000e_get_cable_length_igp_2()
1860 agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + in e1000e_get_cable_length_igp_2()
1862 agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); in e1000e_get_cable_length_igp_2()
1864 /* Calculate cable length with the error range of +/- 10 meters. */ in e1000e_get_cable_length_igp_2()
1865 phy->min_cable_length = (((agc_value - IGP02E1000_AGC_RANGE) > 0) ? in e1000e_get_cable_length_igp_2()
1866 (agc_value - IGP02E1000_AGC_RANGE) : 0); in e1000e_get_cable_length_igp_2()
1867 phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE; in e1000e_get_cable_length_igp_2()
1869 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_igp_2()
1875 * e1000e_get_phy_info_m88 - Retrieve PHY information
1876 * @hw: pointer to the HW structure
1880 * determine the polarity and 10base-T extended distance. Read the PHY
1884 s32 e1000e_get_phy_info_m88(struct e1000_hw *hw) in e1000e_get_phy_info_m88() argument
1886 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_m88()
1891 if (phy->media_type != e1000_media_type_copper) { in e1000e_get_phy_info_m88()
1893 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1896 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000e_get_phy_info_m88()
1902 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1905 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000e_get_phy_info_m88()
1909 phy->polarity_correction = !!(phy_data & in e1000e_get_phy_info_m88()
1912 ret_val = e1000_check_polarity_m88(hw); in e1000e_get_phy_info_m88()
1916 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000e_get_phy_info_m88()
1920 phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX); in e1000e_get_phy_info_m88()
1923 ret_val = hw->phy.ops.get_cable_length(hw); in e1000e_get_phy_info_m88()
1927 ret_val = e1e_rphy(hw, MII_STAT1000, &phy_data); in e1000e_get_phy_info_m88()
1931 phy->local_rx = (phy_data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_m88()
1934 phy->remote_rx = (phy_data & LPA_1000REMRXOK) in e1000e_get_phy_info_m88()
1938 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_m88()
1939 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1940 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1947 * e1000e_get_phy_info_igp - Retrieve igp PHY information
1948 * @hw: pointer to the HW structure
1951 * set/determine 10base-T extended distance and polarity correction. Read
1955 s32 e1000e_get_phy_info_igp(struct e1000_hw *hw) in e1000e_get_phy_info_igp() argument
1957 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_igp()
1962 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000e_get_phy_info_igp()
1968 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_igp()
1971 phy->polarity_correction = true; in e1000e_get_phy_info_igp()
1973 ret_val = e1000_check_polarity_igp(hw); in e1000e_get_phy_info_igp()
1977 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000e_get_phy_info_igp()
1981 phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX); in e1000e_get_phy_info_igp()
1985 ret_val = phy->ops.get_cable_length(hw); in e1000e_get_phy_info_igp()
1989 ret_val = e1e_rphy(hw, MII_STAT1000, &data); in e1000e_get_phy_info_igp()
1993 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_igp()
1996 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000e_get_phy_info_igp()
1999 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_igp()
2000 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2001 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2008 * e1000_get_phy_info_ife - Retrieves various IFE PHY states
2009 * @hw: pointer to the HW structure
2013 s32 e1000_get_phy_info_ife(struct e1000_hw *hw) in e1000_get_phy_info_ife() argument
2015 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_ife()
2020 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000_get_phy_info_ife()
2026 return -E1000_ERR_CONFIG; in e1000_get_phy_info_ife()
2029 ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data); in e1000_get_phy_info_ife()
2032 phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE); in e1000_get_phy_info_ife()
2034 if (phy->polarity_correction) { in e1000_get_phy_info_ife()
2035 ret_val = e1000_check_polarity_ife(hw); in e1000_get_phy_info_ife()
2040 phy->cable_polarity = ((data & IFE_PSC_FORCE_POLARITY) in e1000_get_phy_info_ife()
2045 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_get_phy_info_ife()
2049 phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS); in e1000_get_phy_info_ife()
2052 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_ife()
2053 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2054 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2060 * e1000e_phy_sw_reset - PHY software reset
2061 * @hw: pointer to the HW structure
2066 s32 e1000e_phy_sw_reset(struct e1000_hw *hw) in e1000e_phy_sw_reset() argument
2071 ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl); in e1000e_phy_sw_reset()
2076 ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl); in e1000e_phy_sw_reset()
2086 * e1000e_phy_hw_reset_generic - PHY hardware reset
2087 * @hw: pointer to the HW structure
2094 s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw) in e1000e_phy_hw_reset_generic() argument
2096 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_hw_reset_generic()
2098 u32 ctrl; in e1000e_phy_hw_reset_generic() local
2100 if (phy->ops.check_reset_block) { in e1000e_phy_hw_reset_generic()
2101 ret_val = phy->ops.check_reset_block(hw); in e1000e_phy_hw_reset_generic()
2106 ret_val = phy->ops.acquire(hw); in e1000e_phy_hw_reset_generic()
2110 ctrl = er32(CTRL); in e1000e_phy_hw_reset_generic()
2111 ew32(CTRL, ctrl | E1000_CTRL_PHY_RST); in e1000e_phy_hw_reset_generic()
2114 udelay(phy->reset_delay_us); in e1000e_phy_hw_reset_generic()
2116 ew32(CTRL, ctrl); in e1000e_phy_hw_reset_generic()
2121 phy->ops.release(hw); in e1000e_phy_hw_reset_generic()
2123 return phy->ops.get_cfg_done(hw); in e1000e_phy_hw_reset_generic()
2127 * e1000e_get_cfg_done_generic - Generic configuration done
2128 * @hw: pointer to the HW structure
2130 * Generic function to wait 10 milli-seconds for configuration to complete
2133 s32 e1000e_get_cfg_done_generic(struct e1000_hw __always_unused *hw) in e1000e_get_cfg_done_generic() argument
2141 * e1000e_phy_init_script_igp3 - Inits the IGP3 PHY
2142 * @hw: pointer to the HW structure
2146 s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw) in e1000e_phy_init_script_igp3() argument
2151 /* Enable rise/fall, 10-mode work in class-A */ in e1000e_phy_init_script_igp3()
2152 e1e_wphy(hw, 0x2F5B, 0x9018); in e1000e_phy_init_script_igp3()
2154 e1e_wphy(hw, 0x2F52, 0x0000); in e1000e_phy_init_script_igp3()
2156 e1e_wphy(hw, 0x2FB1, 0x8B24); in e1000e_phy_init_script_igp3()
2158 e1e_wphy(hw, 0x2FB2, 0xF8F0); in e1000e_phy_init_script_igp3()
2160 e1e_wphy(hw, 0x2010, 0x10B0); in e1000e_phy_init_script_igp3()
2162 e1e_wphy(hw, 0x2011, 0x0000); in e1000e_phy_init_script_igp3()
2164 e1e_wphy(hw, 0x20DD, 0x249A); in e1000e_phy_init_script_igp3()
2166 e1e_wphy(hw, 0x20DE, 0x00D3); in e1000e_phy_init_script_igp3()
2168 e1e_wphy(hw, 0x28B4, 0x04CE); in e1000e_phy_init_script_igp3()
2170 e1e_wphy(hw, 0x2F70, 0x29E4); in e1000e_phy_init_script_igp3()
2172 e1e_wphy(hw, 0x0000, 0x0140); in e1000e_phy_init_script_igp3()
2174 e1e_wphy(hw, 0x1F30, 0x1606); in e1000e_phy_init_script_igp3()
2176 e1e_wphy(hw, 0x1F31, 0xB814); in e1000e_phy_init_script_igp3()
2178 e1e_wphy(hw, 0x1F35, 0x002A); in e1000e_phy_init_script_igp3()
2180 e1e_wphy(hw, 0x1F3E, 0x0067); in e1000e_phy_init_script_igp3()
2182 e1e_wphy(hw, 0x1F54, 0x0065); in e1000e_phy_init_script_igp3()
2184 e1e_wphy(hw, 0x1F55, 0x002A); in e1000e_phy_init_script_igp3()
2186 e1e_wphy(hw, 0x1F56, 0x002A); in e1000e_phy_init_script_igp3()
2188 e1e_wphy(hw, 0x1F72, 0x3FB0); in e1000e_phy_init_script_igp3()
2190 e1e_wphy(hw, 0x1F76, 0xC0FF); in e1000e_phy_init_script_igp3()
2192 e1e_wphy(hw, 0x1F77, 0x1DEC); in e1000e_phy_init_script_igp3()
2194 e1e_wphy(hw, 0x1F78, 0xF9EF); in e1000e_phy_init_script_igp3()
2196 e1e_wphy(hw, 0x1F79, 0x0210); in e1000e_phy_init_script_igp3()
2198 e1e_wphy(hw, 0x1895, 0x0003); in e1000e_phy_init_script_igp3()
2200 e1e_wphy(hw, 0x1796, 0x0008); in e1000e_phy_init_script_igp3()
2202 e1e_wphy(hw, 0x1798, 0xD008); in e1000e_phy_init_script_igp3()
2206 e1e_wphy(hw, 0x1898, 0xD918); in e1000e_phy_init_script_igp3()
2208 e1e_wphy(hw, 0x187A, 0x0800); in e1000e_phy_init_script_igp3()
2209 /* Enable LPLU and disable AN to 1000 in non-D0a states, in e1000e_phy_init_script_igp3()
2212 e1e_wphy(hw, 0x0019, 0x008D); in e1000e_phy_init_script_igp3()
2214 e1e_wphy(hw, 0x001B, 0x2080); in e1000e_phy_init_script_igp3()
2216 e1e_wphy(hw, 0x0014, 0x0045); in e1000e_phy_init_script_igp3()
2218 e1e_wphy(hw, 0x0000, 0x1340); in e1000e_phy_init_script_igp3()
2224 * e1000e_get_phy_type_from_id - Get PHY type from id
2278 * e1000e_determine_phy_address - Determines PHY address.
2279 * @hw: pointer to the HW structure
2285 s32 e1000e_determine_phy_address(struct e1000_hw *hw) in e1000e_determine_phy_address() argument
2291 hw->phy.id = phy_type; in e1000e_determine_phy_address()
2294 hw->phy.addr = phy_addr; in e1000e_determine_phy_address()
2298 e1000e_get_phy_id(hw); in e1000e_determine_phy_address()
2299 phy_type = e1000e_get_phy_type_from_id(hw->phy.id); in e1000e_determine_phy_address()
2301 /* If phy_type is valid, break - we found our in e1000e_determine_phy_address()
2312 return -E1000_ERR_PHY_TYPE; in e1000e_determine_phy_address()
2316 * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address
2333 * e1000e_write_phy_reg_bm - Write BM PHY register
2334 * @hw: pointer to the HW structure
2341 s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm() argument
2346 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm()
2352 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm()
2357 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_write_phy_reg_bm()
2366 if (hw->phy.addr == 1) { in e1000e_write_phy_reg_bm()
2375 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, in e1000e_write_phy_reg_bm()
2381 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm()
2385 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm()
2390 * e1000e_read_phy_reg_bm - Read BM PHY register
2391 * @hw: pointer to the HW structure
2399 s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm() argument
2404 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm()
2410 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm()
2415 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_read_phy_reg_bm()
2424 if (hw->phy.addr == 1) { in e1000e_read_phy_reg_bm()
2433 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, in e1000e_read_phy_reg_bm()
2439 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm()
2442 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm()
2447 * e1000e_read_phy_reg_bm2 - Read BM PHY register
2448 * @hw: pointer to the HW structure
2456 s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm2() argument
2461 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm2()
2467 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm2()
2472 hw->phy.addr = 1; in e1000e_read_phy_reg_bm2()
2476 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, in e1000e_read_phy_reg_bm2()
2483 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm2()
2486 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm2()
2491 * e1000e_write_phy_reg_bm2 - Write BM PHY register
2492 * @hw: pointer to the HW structure
2499 s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm2() argument
2504 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm2()
2510 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm2()
2515 hw->phy.addr = 1; in e1000e_write_phy_reg_bm2()
2519 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, in e1000e_write_phy_reg_bm2()
2526 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm2()
2530 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm2()
2535 * e1000_enable_phy_wakeup_reg_access_bm - enable access to BM wakeup registers
2536 * @hw: pointer to the HW structure
2542 s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) in e1000_enable_phy_wakeup_reg_access_bm() argument
2547 /* All page select, port ctrl and wakeup registers use phy address 1 */ in e1000_enable_phy_wakeup_reg_access_bm()
2548 hw->phy.addr = 1; in e1000_enable_phy_wakeup_reg_access_bm()
2551 ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); in e1000_enable_phy_wakeup_reg_access_bm()
2557 ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); in e1000_enable_phy_wakeup_reg_access_bm()
2571 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, temp); in e1000_enable_phy_wakeup_reg_access_bm()
2578 /* Select Host Wakeup Registers page - caller now able to write in e1000_enable_phy_wakeup_reg_access_bm()
2581 return e1000_set_page_igp(hw, (BM_WUC_PAGE << IGP_PAGE_SHIFT)); in e1000_enable_phy_wakeup_reg_access_bm()
2585 * e1000_disable_phy_wakeup_reg_access_bm - disable access to BM wakeup regs
2586 * @hw: pointer to the HW structure
2595 s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) in e1000_disable_phy_wakeup_reg_access_bm() argument
2600 ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); in e1000_disable_phy_wakeup_reg_access_bm()
2607 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, *phy_reg); in e1000_disable_phy_wakeup_reg_access_bm()
2616 * e1000_access_phy_wakeup_reg_bm - Read/write BM PHY wakeup register
2617 * @hw: pointer to the HW structure
2640 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, in e1000_access_phy_wakeup_reg_bm() argument
2649 if ((hw->mac.type == e1000_pchlan) && in e1000_access_phy_wakeup_reg_bm()
2656 ret_val = e1000_enable_phy_wakeup_reg_access_bm(hw, &phy_reg); in e1000_access_phy_wakeup_reg_bm()
2666 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ADDRESS_OPCODE, reg); in e1000_access_phy_wakeup_reg_bm()
2674 ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, in e1000_access_phy_wakeup_reg_bm()
2678 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, in e1000_access_phy_wakeup_reg_bm()
2688 ret_val = e1000_disable_phy_wakeup_reg_access_bm(hw, &phy_reg); in e1000_access_phy_wakeup_reg_bm()
2694 * e1000_power_up_phy_copper - Restore copper link in case of PHY power down
2695 * @hw: pointer to the HW structure
2701 void e1000_power_up_phy_copper(struct e1000_hw *hw) in e1000_power_up_phy_copper() argument
2707 ret = e1e_rphy(hw, MII_BMCR, &mii_reg); in e1000_power_up_phy_copper()
2713 e1e_wphy(hw, MII_BMCR, mii_reg); in e1000_power_up_phy_copper()
2717 * e1000_power_down_phy_copper - Restore copper link in case of PHY power down
2718 * @hw: pointer to the HW structure
2724 void e1000_power_down_phy_copper(struct e1000_hw *hw) in e1000_power_down_phy_copper() argument
2730 ret = e1e_rphy(hw, MII_BMCR, &mii_reg); in e1000_power_down_phy_copper()
2736 e1e_wphy(hw, MII_BMCR, mii_reg); in e1000_power_down_phy_copper()
2741 * __e1000_read_phy_reg_hv - Read HV PHY register
2742 * @hw: pointer to the HW structure
2752 static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_phy_reg_hv() argument
2758 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_read_phy_reg_hv()
2761 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_phy_reg_hv()
2768 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in __e1000_read_phy_reg_hv()
2774 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_read_phy_reg_hv()
2785 ret_val = e1000_set_page_igp(hw, in __e1000_read_phy_reg_hv()
2788 hw->phy.addr = phy_addr; in __e1000_read_phy_reg_hv()
2798 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, data); in __e1000_read_phy_reg_hv()
2801 hw->phy.ops.release(hw); in __e1000_read_phy_reg_hv()
2807 * e1000_read_phy_reg_hv - Read HV PHY register
2808 * @hw: pointer to the HW structure
2816 s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv() argument
2818 return __e1000_read_phy_reg_hv(hw, offset, data, false, false); in e1000_read_phy_reg_hv()
2822 * e1000_read_phy_reg_hv_locked - Read HV PHY register
2823 * @hw: pointer to the HW structure
2830 s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv_locked() argument
2832 return __e1000_read_phy_reg_hv(hw, offset, data, true, false); in e1000_read_phy_reg_hv_locked()
2836 * e1000_read_phy_reg_page_hv - Read HV PHY register
2837 * @hw: pointer to the HW structure
2844 s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_page_hv() argument
2846 return __e1000_read_phy_reg_hv(hw, offset, data, true, true); in e1000_read_phy_reg_page_hv()
2850 * __e1000_write_phy_reg_hv - Write HV PHY register
2851 * @hw: pointer to the HW structure
2860 static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_phy_reg_hv() argument
2866 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_write_phy_reg_hv()
2869 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_phy_reg_hv()
2876 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in __e1000_write_phy_reg_hv()
2882 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_write_phy_reg_hv()
2894 if ((hw->phy.type == e1000_phy_82578) && in __e1000_write_phy_reg_hv()
2895 (hw->phy.revision >= 1) && in __e1000_write_phy_reg_hv()
2896 (hw->phy.addr == 2) && in __e1000_write_phy_reg_hv()
2900 ret_val = e1000_access_phy_debug_regs_hv(hw, in __e1000_write_phy_reg_hv()
2909 ret_val = e1000_set_page_igp(hw, in __e1000_write_phy_reg_hv()
2912 hw->phy.addr = phy_addr; in __e1000_write_phy_reg_hv()
2922 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, in __e1000_write_phy_reg_hv()
2927 hw->phy.ops.release(hw); in __e1000_write_phy_reg_hv()
2933 * e1000_write_phy_reg_hv - Write HV PHY register
2934 * @hw: pointer to the HW structure
2941 s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv() argument
2943 return __e1000_write_phy_reg_hv(hw, offset, data, false, false); in e1000_write_phy_reg_hv()
2947 * e1000_write_phy_reg_hv_locked - Write HV PHY register
2948 * @hw: pointer to the HW structure
2955 s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv_locked() argument
2957 return __e1000_write_phy_reg_hv(hw, offset, data, true, false); in e1000_write_phy_reg_hv_locked()
2961 * e1000_write_phy_reg_page_hv - Write HV PHY register
2962 * @hw: pointer to the HW structure
2969 s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_page_hv() argument
2971 return __e1000_write_phy_reg_hv(hw, offset, data, true, true); in e1000_write_phy_reg_page_hv()
2975 * e1000_get_phy_addr_for_hv_page - Get PHY address based on page
2989 * e1000_access_phy_debug_regs_hv - Read HV PHY vendor specific high registers
2990 * @hw: pointer to the HW structure
3000 static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, in e1000_access_phy_debug_regs_hv() argument
3008 addr_reg = ((hw->phy.type == e1000_phy_82578) ? in e1000_access_phy_debug_regs_hv()
3013 hw->phy.addr = 2; in e1000_access_phy_debug_regs_hv()
3016 ret_val = e1000e_write_phy_reg_mdic(hw, addr_reg, (u16)offset & 0x3F); in e1000_access_phy_debug_regs_hv()
3024 ret_val = e1000e_read_phy_reg_mdic(hw, data_reg, data); in e1000_access_phy_debug_regs_hv()
3026 ret_val = e1000e_write_phy_reg_mdic(hw, data_reg, *data); in e1000_access_phy_debug_regs_hv()
3035 * e1000_link_stall_workaround_hv - Si workaround
3036 * @hw: pointer to the HW structure
3045 s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) in e1000_link_stall_workaround_hv() argument
3050 if (hw->phy.type != e1000_phy_82578) in e1000_link_stall_workaround_hv()
3054 ret_val = e1e_rphy(hw, MII_BMCR, &data); in e1000_link_stall_workaround_hv()
3063 ret_val = e1e_rphy(hw, BM_CS_STATUS, &data); in e1000_link_stall_workaround_hv()
3077 ret_val = e1e_wphy(hw, HV_MUX_DATA_CTRL, in e1000_link_stall_workaround_hv()
3083 return e1e_wphy(hw, HV_MUX_DATA_CTRL, HV_MUX_DATA_CTRL_GEN_TO_MAC); in e1000_link_stall_workaround_hv()
3087 * e1000_check_polarity_82577 - Checks the polarity.
3088 * @hw: pointer to the HW structure
3090 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
3094 s32 e1000_check_polarity_82577(struct e1000_hw *hw) in e1000_check_polarity_82577() argument
3096 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_82577()
3100 ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); in e1000_check_polarity_82577()
3103 phy->cable_polarity = ((data & I82577_PHY_STATUS2_REV_POLARITY) in e1000_check_polarity_82577()
3111 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY
3112 * @hw: pointer to the HW structure
3116 s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw) in e1000_phy_force_speed_duplex_82577() argument
3118 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_82577()
3123 ret_val = e1e_rphy(hw, MII_BMCR, &phy_data); in e1000_phy_force_speed_duplex_82577()
3127 e1000e_phy_force_speed_duplex_setup(hw, &phy_data); in e1000_phy_force_speed_duplex_82577()
3129 ret_val = e1e_wphy(hw, MII_BMCR, phy_data); in e1000_phy_force_speed_duplex_82577()
3135 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_82577()
3138 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_82577()
3147 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, in e1000_phy_force_speed_duplex_82577()
3155 * e1000_get_phy_info_82577 - Retrieve I82577 PHY information
3156 * @hw: pointer to the HW structure
3159 * set/determine 10base-T extended distance and polarity correction. Read
3163 s32 e1000_get_phy_info_82577(struct e1000_hw *hw) in e1000_get_phy_info_82577() argument
3165 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_82577()
3170 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); in e1000_get_phy_info_82577()
3176 return -E1000_ERR_CONFIG; in e1000_get_phy_info_82577()
3179 phy->polarity_correction = true; in e1000_get_phy_info_82577()
3181 ret_val = e1000_check_polarity_82577(hw); in e1000_get_phy_info_82577()
3185 ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); in e1000_get_phy_info_82577()
3189 phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX); in e1000_get_phy_info_82577()
3193 ret_val = hw->phy.ops.get_cable_length(hw); in e1000_get_phy_info_82577()
3197 ret_val = e1e_rphy(hw, MII_STAT1000, &data); in e1000_get_phy_info_82577()
3201 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000_get_phy_info_82577()
3204 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000_get_phy_info_82577()
3207 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_82577()
3208 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3209 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3216 * e1000_get_cable_length_82577 - Determine cable length for 82577 PHY
3217 * @hw: pointer to the HW structure
3222 s32 e1000_get_cable_length_82577(struct e1000_hw *hw) in e1000_get_cable_length_82577() argument
3224 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_82577()
3228 ret_val = e1e_rphy(hw, I82577_PHY_DIAG_STATUS, &phy_data); in e1000_get_cable_length_82577()
3235 return -E1000_ERR_PHY; in e1000_get_cable_length_82577()
3237 phy->cable_length = length; in e1000_get_cable_length_82577()