Lines Matching +full:page +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
8 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
10 static u32 e1000_get_phy_addr_for_hv_page(u32 page);
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
54 * e1000e_get_phy_id - Retrieve the PHY ID and revision
62 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_id()
67 if (!phy->ops.read_reg) in e1000e_get_phy_id()
75 phy->id = (u32)(phy_id << 16); 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
112 hw->phy.retry_enabled = false; in e1000e_disable_phy_retry()
117 hw->phy.retry_enabled = true; in e1000e_enable_phy_retry()
121 * e1000e_read_phy_reg_mdic - Read MDI control register
123 * @offset: register offset to be read
126 * Reads the MDI control register in the PHY at offset and stores the
129 s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_mdic() argument
132 struct e1000_phy_info *phy = &hw->phy; in e1000e_read_phy_reg_mdic()
135 if (offset > MAX_PHY_REG_ADDRESS) { in e1000e_read_phy_reg_mdic()
136 e_dbg("PHY Address %d is out of range\n", offset); in e1000e_read_phy_reg_mdic()
137 return -E1000_ERR_PARAM; in e1000e_read_phy_reg_mdic()
140 retry_max = phy->retry_enabled ? phy->retry_count : 0; in e1000e_read_phy_reg_mdic()
142 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_read_phy_reg_mdic()
149 mdic = ((offset << E1000_MDIC_REG_SHIFT) | in e1000e_read_phy_reg_mdic()
150 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_read_phy_reg_mdic()
167 offset); in e1000e_read_phy_reg_mdic()
171 e_dbg("MDI Read PHY Reg Address %d Error\n", offset); in e1000e_read_phy_reg_mdic()
174 if (FIELD_GET(E1000_MDIC_REG_MASK, mdic) != offset) { in e1000e_read_phy_reg_mdic()
175 e_dbg("MDI Read offset error - requested %d, returned %d\n", in e1000e_read_phy_reg_mdic()
176 offset, FIELD_GET(E1000_MDIC_REG_MASK, mdic)); in e1000e_read_phy_reg_mdic()
183 if (hw->mac.type == e1000_pch2lan) in e1000e_read_phy_reg_mdic()
197 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
201 * e1000e_write_phy_reg_mdic - Write MDI control register
203 * @offset: register offset to write to
204 * @data: data to write to register at offset
206 * Writes data to MDI control register in the PHY at offset.
208 s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_mdic() argument
211 struct e1000_phy_info *phy = &hw->phy; in e1000e_write_phy_reg_mdic()
214 if (offset > MAX_PHY_REG_ADDRESS) { in e1000e_write_phy_reg_mdic()
215 e_dbg("PHY Address %d is out of range\n", offset); in e1000e_write_phy_reg_mdic()
216 return -E1000_ERR_PARAM; in e1000e_write_phy_reg_mdic()
219 retry_max = phy->retry_enabled ? phy->retry_count : 0; in e1000e_write_phy_reg_mdic()
221 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_write_phy_reg_mdic()
229 (offset << E1000_MDIC_REG_SHIFT) | in e1000e_write_phy_reg_mdic()
230 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_write_phy_reg_mdic()
247 offset); in e1000e_write_phy_reg_mdic()
251 e_dbg("MDI Write PHY Reg Address %d Error\n", offset); in e1000e_write_phy_reg_mdic()
254 if (FIELD_GET(E1000_MDIC_REG_MASK, mdic) != offset) { in e1000e_write_phy_reg_mdic()
255 e_dbg("MDI Write offset error - requested %d, returned %d\n", in e1000e_write_phy_reg_mdic()
256 offset, FIELD_GET(E1000_MDIC_REG_MASK, mdic)); in e1000e_write_phy_reg_mdic()
263 if (hw->mac.type == e1000_pch2lan) in e1000e_write_phy_reg_mdic()
275 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
279 * e1000e_read_phy_reg_m88 - Read m88 PHY register
281 * @offset: register offset to be read
284 * Acquires semaphore, if necessary, then reads the PHY register at offset
288 s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_m88() argument
292 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_m88()
296 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_m88()
299 hw->phy.ops.release(hw); in e1000e_read_phy_reg_m88()
305 * e1000e_write_phy_reg_m88 - Write m88 PHY register
307 * @offset: register offset to write to
308 * @data: data to write at register offset
311 * at the offset. Release any acquired semaphores before exiting.
313 s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_m88() argument
317 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_m88()
321 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_m88()
324 hw->phy.ops.release(hw); in e1000e_write_phy_reg_m88()
330 * e1000_set_page_igp - Set page as on IGP-like PHY(s)
332 * @page: page to set (shifted left when necessary)
334 * Sets PHY page required for PHY register access. Assumes semaphore is
338 s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page) in e1000_set_page_igp() argument
340 e_dbg("Setting page 0x%x\n", page); in e1000_set_page_igp()
342 hw->phy.addr = 1; in e1000_set_page_igp()
344 return e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, page); in e1000_set_page_igp()
348 * __e1000e_read_phy_reg_igp - Read igp PHY register
350 * @offset: register offset to be read
354 * Acquires semaphore, if necessary, then reads the PHY register at offset
358 static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000e_read_phy_reg_igp() argument
364 if (!hw->phy.ops.acquire) in __e1000e_read_phy_reg_igp()
367 ret_val = hw->phy.ops.acquire(hw); in __e1000e_read_phy_reg_igp()
372 if (offset > MAX_PHY_MULTI_PAGE_REG) in __e1000e_read_phy_reg_igp()
375 (u16)offset); in __e1000e_read_phy_reg_igp()
378 MAX_PHY_REG_ADDRESS & offset, in __e1000e_read_phy_reg_igp()
381 hw->phy.ops.release(hw); in __e1000e_read_phy_reg_igp()
387 * e1000e_read_phy_reg_igp - Read igp PHY register
389 * @offset: register offset to be read
392 * Acquires semaphore then reads the PHY register at offset and stores the
396 s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp() argument
398 return __e1000e_read_phy_reg_igp(hw, offset, data, false); in e1000e_read_phy_reg_igp()
402 * e1000e_read_phy_reg_igp_locked - Read igp PHY register
404 * @offset: register offset to be read
407 * Reads the PHY register at offset and stores the retrieved information
410 s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_igp_locked() argument
412 return __e1000e_read_phy_reg_igp(hw, offset, data, true); in e1000e_read_phy_reg_igp_locked()
416 * __e1000e_write_phy_reg_igp - Write igp PHY register
418 * @offset: register offset to write to
419 * @data: data to write at register offset
423 * at the offset. Release any acquired semaphores before exiting.
425 static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data, in __e1000e_write_phy_reg_igp() argument
431 if (!hw->phy.ops.acquire) in __e1000e_write_phy_reg_igp()
434 ret_val = hw->phy.ops.acquire(hw); in __e1000e_write_phy_reg_igp()
439 if (offset > MAX_PHY_MULTI_PAGE_REG) in __e1000e_write_phy_reg_igp()
442 (u16)offset); in __e1000e_write_phy_reg_igp()
445 offset, data); in __e1000e_write_phy_reg_igp()
447 hw->phy.ops.release(hw); in __e1000e_write_phy_reg_igp()
453 * e1000e_write_phy_reg_igp - Write igp PHY register
455 * @offset: register offset to write to
456 * @data: data to write at register offset
459 * at the offset. Release any acquired semaphores before exiting.
461 s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp() argument
463 return __e1000e_write_phy_reg_igp(hw, offset, data, false); in e1000e_write_phy_reg_igp()
467 * e1000e_write_phy_reg_igp_locked - Write igp PHY register
469 * @offset: register offset to write to
470 * @data: data to write at register offset
472 * Writes the data to PHY register at the offset.
475 s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_igp_locked() argument
477 return __e1000e_write_phy_reg_igp(hw, offset, data, true); in e1000e_write_phy_reg_igp_locked()
481 * __e1000_read_kmrn_reg - Read kumeran register
483 * @offset: register offset to be read
487 * Acquires semaphore, if necessary. Then reads the PHY register at offset
491 static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_kmrn_reg() argument
499 if (!hw->phy.ops.acquire) in __e1000_read_kmrn_reg()
502 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_kmrn_reg()
507 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & in __e1000_read_kmrn_reg()
518 hw->phy.ops.release(hw); in __e1000_read_kmrn_reg()
524 * e1000e_read_kmrn_reg - Read kumeran register
526 * @offset: register offset to be read
529 * Acquires semaphore then reads the PHY register at offset using the
533 s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg() argument
535 return __e1000_read_kmrn_reg(hw, offset, data, false); in e1000e_read_kmrn_reg()
539 * e1000e_read_kmrn_reg_locked - Read kumeran register
541 * @offset: register offset to be read
544 * Reads the PHY register at offset using the kumeran interface. The
548 s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_kmrn_reg_locked() argument
550 return __e1000_read_kmrn_reg(hw, offset, data, true); in e1000e_read_kmrn_reg_locked()
554 * __e1000_write_kmrn_reg - Write kumeran register
556 * @offset: register offset to write to
557 * @data: data to write at register offset
561 * at the offset using the kumeran interface. Release any acquired semaphores
564 static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_kmrn_reg() argument
572 if (!hw->phy.ops.acquire) in __e1000_write_kmrn_reg()
575 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_kmrn_reg()
580 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & in __e1000_write_kmrn_reg()
588 hw->phy.ops.release(hw); in __e1000_write_kmrn_reg()
594 * e1000e_write_kmrn_reg - Write kumeran register
596 * @offset: register offset to write to
597 * @data: data to write at register offset
599 * Acquires semaphore then writes the data to the PHY register at the offset
602 s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg() argument
604 return __e1000_write_kmrn_reg(hw, offset, data, false); in e1000e_write_kmrn_reg()
608 * e1000e_write_kmrn_reg_locked - Write kumeran register
610 * @offset: register offset to write to
611 * @data: data to write at register offset
613 * Write the data to PHY register at the offset using the kumeran interface.
616 s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_kmrn_reg_locked() argument
618 return __e1000_write_kmrn_reg(hw, offset, data, true); in e1000e_write_kmrn_reg_locked()
622 * e1000_set_master_slave_mode - Setup PHY for Master/slave mode
638 hw->phy.original_ms_type = (phy_data & CTL1000_ENABLE_MASTER) ? in e1000_set_master_slave_mode()
642 switch (hw->phy.ms_type) { in e1000_set_master_slave_mode()
661 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
664 * Sets up Carrier-sense on Transmit and downshift values.
671 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000_copper_link_setup_82577()
691 * 0 - Auto (default) in e1000_copper_link_setup_82577()
692 * 1 - MDI mode in e1000_copper_link_setup_82577()
693 * 2 - MDI-X mode in e1000_copper_link_setup_82577()
695 switch (hw->phy.mdix) { in e1000_copper_link_setup_82577()
714 * e1000e_copper_link_setup_m88 - Setup m88 PHY's for copper link
717 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
722 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_m88()
726 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000e_copper_link_setup_m88()
732 if (phy->type != e1000_phy_bm) in e1000e_copper_link_setup_m88()
736 * MDI/MDI-X = 0 (default) in e1000e_copper_link_setup_m88()
737 * 0 - Auto for all speeds in e1000e_copper_link_setup_m88()
738 * 1 - MDI mode in e1000e_copper_link_setup_m88()
739 * 2 - MDI-X mode in e1000e_copper_link_setup_m88()
740 * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) in e1000e_copper_link_setup_m88()
744 switch (phy->mdix) { in e1000e_copper_link_setup_m88()
763 * 0 - Disabled in e1000e_copper_link_setup_m88()
764 * 1 - Enabled in e1000e_copper_link_setup_m88()
767 if (phy->disable_polarity_correction) in e1000e_copper_link_setup_m88()
771 if (phy->type == e1000_phy_bm) { in e1000e_copper_link_setup_m88()
773 if (phy->id == BME1000_E_PHY_ID_R2) { in e1000e_copper_link_setup_m88()
780 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
794 if ((phy->type == e1000_phy_m88) && in e1000e_copper_link_setup_m88()
795 (phy->revision < E1000_REVISION_4) && in e1000e_copper_link_setup_m88()
796 (phy->id != BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
806 if ((phy->revision == 2) && (phy->id == M88E1111_I_PHY_ID)) { in e1000e_copper_link_setup_m88()
807 /* 82573L PHY - set the downshift counter to 5x. */ in e1000e_copper_link_setup_m88()
822 if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
823 /* Set PHY page 0, register 29 to 0x0003 */ in e1000e_copper_link_setup_m88()
828 /* Set PHY page 0, register 30 to 0x0000 */ in e1000e_copper_link_setup_m88()
835 if (phy->ops.commit) { in e1000e_copper_link_setup_m88()
836 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
843 if (phy->type == e1000_phy_82578) { in e1000e_copper_link_setup_m88()
848 /* 82578 PHY - set the downshift count to 1x. */ in e1000e_copper_link_setup_m88()
860 * e1000e_copper_link_setup_igp - Setup igp PHY's for copper link
863 * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
868 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_igp()
884 if (hw->phy.ops.set_d0_lplu_state) { in e1000e_copper_link_setup_igp()
885 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); in e1000e_copper_link_setup_igp()
891 /* Configure mdi-mdix settings */ in e1000e_copper_link_setup_igp()
898 switch (phy->mdix) { in e1000e_copper_link_setup_igp()
914 /* set auto-master slave resolution settings */ in e1000e_copper_link_setup_igp()
915 if (hw->mac.autoneg) { in e1000e_copper_link_setup_igp()
920 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000e_copper_link_setup_igp()
951 * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation
954 * Reads the MII auto-neg advertisement register and/or the 1000T control
955 * register and if the PHY is already setup for auto-negotiation, then
957 * the appropriate values for the wanted auto-negotiation.
961 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_setup_autoneg()
966 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_phy_setup_autoneg()
968 /* Read the MII Auto-Neg Advertisement Register (Address 4). */ in e1000_phy_setup_autoneg()
973 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
974 /* Read the MII 1000Base-T Control Register (Address 9). */ in e1000_phy_setup_autoneg()
987 /* First we clear all the 10/100 mb speed bits in the Auto-Neg in e1000_phy_setup_autoneg()
989 * the 1000Base-T Control Register (Address 9). in e1000_phy_setup_autoneg()
996 e_dbg("autoneg_advertised %x\n", phy->autoneg_advertised); in e1000_phy_setup_autoneg()
999 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
1005 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
1011 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
1017 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
1023 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in e1000_phy_setup_autoneg()
1027 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
1034 * auto-negotiation is enabled, then software will have to set the in e1000_phy_setup_autoneg()
1035 * "PAUSE" bits to the correct value in the Auto-Negotiation in e1000_phy_setup_autoneg()
1036 * Advertisement Register (MII_ADVERTISE) and re-start auto- in e1000_phy_setup_autoneg()
1049 switch (hw->fc.current_mode) { in e1000_phy_setup_autoneg()
1052 * software over-ride. in e1000_phy_setup_autoneg()
1056 phy->autoneg_advertised &= in e1000_phy_setup_autoneg()
1061 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1071 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1076 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1080 phy->autoneg_advertised |= ADVERTISED_Asym_Pause; in e1000_phy_setup_autoneg()
1081 phy->autoneg_advertised &= ~ADVERTISED_Pause; in e1000_phy_setup_autoneg()
1085 * over-ride. in e1000_phy_setup_autoneg()
1089 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1094 return -E1000_ERR_CONFIG; in e1000_phy_setup_autoneg()
1101 e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1103 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in e1000_phy_setup_autoneg()
1110 * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link
1120 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_autoneg()
1127 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_copper_link_autoneg()
1132 if (!phy->autoneg_advertised) in e1000_copper_link_autoneg()
1133 phy->autoneg_advertised = phy->autoneg_mask; in e1000_copper_link_autoneg()
1135 e_dbg("Reconfiguring auto-neg advertisement params\n"); in e1000_copper_link_autoneg()
1138 e_dbg("Error Setting up Auto-Negotiation\n"); in e1000_copper_link_autoneg()
1141 e_dbg("Restarting Auto-Neg\n"); in e1000_copper_link_autoneg()
1143 /* Restart auto-negotiation by setting the Auto Neg Enable bit and in e1000_copper_link_autoneg()
1155 /* Does the user want to wait for Auto-Neg to complete here, or in e1000_copper_link_autoneg()
1158 if (phy->autoneg_wait_to_complete) { in e1000_copper_link_autoneg()
1166 hw->mac.get_link_status = true; in e1000_copper_link_autoneg()
1172 * e1000e_setup_copper_link - Configure copper link settings
1175 * Calls the appropriate function to configure the link for auto-neg or forced
1178 * not established, we return -E1000_ERR_PHY (-2).
1185 if (hw->mac.autoneg) { in e1000e_setup_copper_link()
1197 ret_val = hw->phy.ops.force_speed_duplex(hw); in e1000e_setup_copper_link()
1214 hw->mac.ops.config_collision_dist(hw); in e1000e_setup_copper_link()
1224 * e1000e_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
1228 * auto-crossover to force MDI manually. Waits for link and returns
1229 * successful if link up is successful, else -E1000_ERR_PHY (-2).
1233 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_igp()
1248 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI in e1000e_phy_force_speed_duplex_igp()
1266 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_igp()
1286 * e1000e_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
1290 * auto-crossover to force MDI manually. Resets the PHY to commit the
1297 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_m88()
1302 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI in e1000e_phy_force_speed_duplex_m88()
1327 if (hw->phy.ops.commit) { in e1000e_phy_force_speed_duplex_m88()
1328 ret_val = hw->phy.ops.commit(hw); in e1000e_phy_force_speed_duplex_m88()
1333 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_m88()
1342 if (hw->phy.type != e1000_phy_m88) { in e1000e_phy_force_speed_duplex_m88()
1365 if (hw->phy.type != e1000_phy_m88) in e1000e_phy_force_speed_duplex_m88()
1372 /* Resetting the phy means we need to re-force TX_CLK in the in e1000e_phy_force_speed_duplex_m88()
1381 /* In addition, we must re-enable CRS on Tx for both half and full in e1000e_phy_force_speed_duplex_m88()
1395 * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex
1404 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_ife()
1419 /* Disable MDI-X support for 10/100 */ in e1000_phy_force_speed_duplex_ife()
1435 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_ife()
1457 * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
1463 * disable auto-negotiation, configure duplex, configure speed, configure
1470 struct e1000_mac_info *mac = &hw->mac; in e1000e_phy_force_speed_duplex_setup()
1474 hw->fc.current_mode = e1000_fc_none; in e1000e_phy_force_speed_duplex_setup()
1488 if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) { in e1000e_phy_force_speed_duplex_setup()
1499 if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) { in e1000e_phy_force_speed_duplex_setup()
1510 hw->mac.ops.config_collision_dist(hw); in e1000e_phy_force_speed_duplex_setup()
1516 * e1000e_set_d3_lplu_state - Sets low power link up state for D3
1531 struct e1000_phy_info *phy = &hw->phy; in e1000e_set_d3_lplu_state()
1549 if (phy->smart_speed == e1000_smart_speed_on) { in e1000e_set_d3_lplu_state()
1560 } else if (phy->smart_speed == e1000_smart_speed_off) { in e1000e_set_d3_lplu_state()
1572 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in e1000e_set_d3_lplu_state()
1573 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || in e1000e_set_d3_lplu_state()
1574 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { in e1000e_set_d3_lplu_state()
1593 * e1000e_check_downshift - Checks whether a downshift in speed occurred
1602 struct e1000_phy_info *phy = &hw->phy; in e1000e_check_downshift()
1604 u16 phy_data, offset, mask; in e1000e_check_downshift() local
1606 switch (phy->type) { in e1000e_check_downshift()
1611 offset = M88E1000_PHY_SPEC_STATUS; in e1000e_check_downshift()
1616 offset = IGP01E1000_PHY_LINK_HEALTH; in e1000e_check_downshift()
1621 phy->speed_downgraded = false; in e1000e_check_downshift()
1625 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000e_check_downshift()
1628 phy->speed_downgraded = !!(phy_data & mask); in e1000e_check_downshift()
1634 * e1000_check_polarity_m88 - Checks the polarity.
1637 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1643 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_m88()
1650 phy->cable_polarity = ((data & M88E1000_PSSR_REV_POLARITY) in e1000_check_polarity_m88()
1658 * e1000_check_polarity_igp - Checks the polarity.
1661 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1668 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_igp()
1670 u16 data, offset, mask; in e1000_check_polarity_igp() local
1681 offset = IGP01E1000_PHY_PCS_INIT_REG; in e1000_check_polarity_igp()
1687 offset = IGP01E1000_PHY_PORT_STATUS; in e1000_check_polarity_igp()
1691 ret_val = e1e_rphy(hw, offset, &data); in e1000_check_polarity_igp()
1694 phy->cable_polarity = ((data & mask) in e1000_check_polarity_igp()
1702 * e1000_check_polarity_ife - Check cable polarity for IFE PHY
1709 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_ife()
1711 u16 phy_data, offset, mask; in e1000_check_polarity_ife() local
1715 if (phy->polarity_correction) { in e1000_check_polarity_ife()
1716 offset = IFE_PHY_EXTENDED_STATUS_CONTROL; in e1000_check_polarity_ife()
1719 offset = IFE_PHY_SPECIAL_CONTROL; in e1000_check_polarity_ife()
1723 ret_val = e1e_rphy(hw, offset, &phy_data); in e1000_check_polarity_ife()
1726 phy->cable_polarity = ((phy_data & mask) in e1000_check_polarity_ife()
1734 * e1000_wait_autoneg - Wait for auto-neg completion
1737 * Waits for auto-negotiation to complete or for the auto-negotiation time
1746 for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { in e1000_wait_autoneg()
1758 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation in e1000_wait_autoneg()
1765 * e1000e_phy_has_link_generic - Polls PHY for link
1813 * e1000e_get_cable_length_m88 - Determine cable length for m88 PHY
1822 * 1 50 - 80 meters
1823 * 2 80 - 110 meters
1824 * 3 110 - 140 meters
1829 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_m88()
1839 if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) in e1000e_get_cable_length_m88()
1840 return -E1000_ERR_PHY; in e1000e_get_cable_length_m88()
1842 phy->min_cable_length = e1000_m88_cable_length_table[index]; in e1000e_get_cable_length_m88()
1843 phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; in e1000e_get_cable_length_m88()
1845 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_m88()
1851 * e1000e_get_cable_length_igp_2 - Determine cable length for igp2 PHY
1863 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_igp_2()
1867 u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1; in e1000e_get_cable_length_igp_2()
1892 return -E1000_ERR_PHY; in e1000e_get_cable_length_igp_2()
1905 agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + in e1000e_get_cable_length_igp_2()
1907 agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); in e1000e_get_cable_length_igp_2()
1909 /* Calculate cable length with the error range of +/- 10 meters. */ in e1000e_get_cable_length_igp_2()
1910 phy->min_cable_length = (((agc_value - IGP02E1000_AGC_RANGE) > 0) ? in e1000e_get_cable_length_igp_2()
1911 (agc_value - IGP02E1000_AGC_RANGE) : 0); in e1000e_get_cable_length_igp_2()
1912 phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE; in e1000e_get_cable_length_igp_2()
1914 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_igp_2()
1920 * e1000e_get_phy_info_m88 - Retrieve PHY information
1925 * determine the polarity and 10base-T extended distance. Read the PHY
1931 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_m88()
1936 if (phy->media_type != e1000_media_type_copper) { in e1000e_get_phy_info_m88()
1938 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1947 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1954 phy->polarity_correction = !!(phy_data & in e1000e_get_phy_info_m88()
1965 phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX); in e1000e_get_phy_info_m88()
1968 ret_val = hw->phy.ops.get_cable_length(hw); in e1000e_get_phy_info_m88()
1976 phy->local_rx = (phy_data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_m88()
1979 phy->remote_rx = (phy_data & LPA_1000REMRXOK) in e1000e_get_phy_info_m88()
1983 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_m88()
1984 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1985 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1992 * e1000e_get_phy_info_igp - Retrieve igp PHY information
1996 * set/determine 10base-T extended distance and polarity correction. Read
2002 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_igp()
2013 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_igp()
2016 phy->polarity_correction = true; in e1000e_get_phy_info_igp()
2026 phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX); in e1000e_get_phy_info_igp()
2030 ret_val = phy->ops.get_cable_length(hw); in e1000e_get_phy_info_igp()
2038 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_igp()
2041 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000e_get_phy_info_igp()
2044 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_igp()
2045 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2046 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2053 * e1000_get_phy_info_ife - Retrieves various IFE PHY states
2060 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_ife()
2071 return -E1000_ERR_CONFIG; in e1000_get_phy_info_ife()
2077 phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE); in e1000_get_phy_info_ife()
2079 if (phy->polarity_correction) { in e1000_get_phy_info_ife()
2085 phy->cable_polarity = ((data & IFE_PSC_FORCE_POLARITY) in e1000_get_phy_info_ife()
2094 phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS); in e1000_get_phy_info_ife()
2097 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_ife()
2098 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2099 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2105 * e1000e_phy_sw_reset - PHY software reset
2131 * e1000e_phy_hw_reset_generic - PHY hardware reset
2141 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_hw_reset_generic()
2145 if (phy->ops.check_reset_block) { in e1000e_phy_hw_reset_generic()
2146 ret_val = phy->ops.check_reset_block(hw); in e1000e_phy_hw_reset_generic()
2151 ret_val = phy->ops.acquire(hw); in e1000e_phy_hw_reset_generic()
2159 udelay(phy->reset_delay_us); in e1000e_phy_hw_reset_generic()
2166 phy->ops.release(hw); in e1000e_phy_hw_reset_generic()
2168 return phy->ops.get_cfg_done(hw); in e1000e_phy_hw_reset_generic()
2172 * e1000e_get_cfg_done_generic - Generic configuration done
2175 * Generic function to wait 10 milli-seconds for configuration to complete
2186 * e1000e_phy_init_script_igp3 - Inits the IGP3 PHY
2196 /* Enable rise/fall, 10-mode work in class-A */ in e1000e_phy_init_script_igp3()
2254 /* Enable LPLU and disable AN to 1000 in non-D0a states, in e1000e_phy_init_script_igp3()
2269 * e1000e_get_phy_type_from_id - Get PHY type from id
2323 * e1000e_determine_phy_address - Determines PHY address.
2336 hw->phy.id = phy_type; in e1000e_determine_phy_address()
2339 hw->phy.addr = phy_addr; in e1000e_determine_phy_address()
2344 phy_type = e1000e_get_phy_type_from_id(hw->phy.id); in e1000e_determine_phy_address()
2346 /* If phy_type is valid, break - we found our in e1000e_determine_phy_address()
2357 return -E1000_ERR_PHY_TYPE; in e1000e_determine_phy_address()
2361 * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address
2362 * @page: page to access
2365 * Returns the phy address for the page requested.
2367 static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg) in e1000_get_phy_addr_for_bm_page() argument
2371 if ((page >= 768) || (page == 0 && reg == 25) || (reg == 31)) in e1000_get_phy_addr_for_bm_page()
2378 * e1000e_write_phy_reg_bm - Write BM PHY register
2380 * @offset: register offset to write to
2381 * @data: data to write at register offset
2384 * at the offset. Release any acquired semaphores before exiting.
2386 s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm() argument
2389 u32 page = offset >> IGP_PAGE_SHIFT; in e1000e_write_phy_reg_bm() local
2391 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm()
2395 /* Page 800 works differently than the rest so it has its own func */ in e1000e_write_phy_reg_bm()
2396 if (page == BM_WUC_PAGE) { in e1000e_write_phy_reg_bm()
2397 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm()
2402 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_write_phy_reg_bm()
2404 if (offset > MAX_PHY_MULTI_PAGE_REG) { in e1000e_write_phy_reg_bm()
2407 /* Page select is register 31 for phy address 1 and 22 for in e1000e_write_phy_reg_bm()
2408 * phy address 2 and 3. Page select is shifted only for in e1000e_write_phy_reg_bm()
2411 if (hw->phy.addr == 1) { in e1000e_write_phy_reg_bm()
2419 /* Page is shifted left, PHY expects (page x 32) */ in e1000e_write_phy_reg_bm()
2421 (page << page_shift)); in e1000e_write_phy_reg_bm()
2426 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm()
2430 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm()
2435 * e1000e_read_phy_reg_bm - Read BM PHY register
2437 * @offset: register offset to be read
2440 * Acquires semaphore, if necessary, then reads the PHY register at offset
2444 s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm() argument
2447 u32 page = offset >> IGP_PAGE_SHIFT; in e1000e_read_phy_reg_bm() local
2449 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm()
2453 /* Page 800 works differently than the rest so it has its own func */ in e1000e_read_phy_reg_bm()
2454 if (page == BM_WUC_PAGE) { in e1000e_read_phy_reg_bm()
2455 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm()
2460 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_read_phy_reg_bm()
2462 if (offset > MAX_PHY_MULTI_PAGE_REG) { in e1000e_read_phy_reg_bm()
2465 /* Page select is register 31 for phy address 1 and 22 for in e1000e_read_phy_reg_bm()
2466 * phy address 2 and 3. Page select is shifted only for in e1000e_read_phy_reg_bm()
2469 if (hw->phy.addr == 1) { in e1000e_read_phy_reg_bm()
2477 /* Page is shifted left, PHY expects (page x 32) */ in e1000e_read_phy_reg_bm()
2479 (page << page_shift)); in e1000e_read_phy_reg_bm()
2484 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm()
2487 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm()
2492 * e1000e_read_phy_reg_bm2 - Read BM PHY register
2494 * @offset: register offset to be read
2497 * Acquires semaphore, if necessary, then reads the PHY register at offset
2501 s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) in e1000e_read_phy_reg_bm2() argument
2504 u16 page = (u16)(offset >> IGP_PAGE_SHIFT); in e1000e_read_phy_reg_bm2() local
2506 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm2()
2510 /* Page 800 works differently than the rest so it has its own func */ in e1000e_read_phy_reg_bm2()
2511 if (page == BM_WUC_PAGE) { in e1000e_read_phy_reg_bm2()
2512 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in e1000e_read_phy_reg_bm2()
2517 hw->phy.addr = 1; in e1000e_read_phy_reg_bm2()
2519 if (offset > MAX_PHY_MULTI_PAGE_REG) { in e1000e_read_phy_reg_bm2()
2520 /* Page is shifted left, PHY expects (page x 32) */ in e1000e_read_phy_reg_bm2()
2522 page); in e1000e_read_phy_reg_bm2()
2528 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_read_phy_reg_bm2()
2531 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm2()
2536 * e1000e_write_phy_reg_bm2 - Write BM PHY register
2538 * @offset: register offset to write to
2539 * @data: data to write at register offset
2542 * at the offset. Release any acquired semaphores before exiting.
2544 s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) in e1000e_write_phy_reg_bm2() argument
2547 u16 page = (u16)(offset >> IGP_PAGE_SHIFT); in e1000e_write_phy_reg_bm2() local
2549 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm2()
2553 /* Page 800 works differently than the rest so it has its own func */ in e1000e_write_phy_reg_bm2()
2554 if (page == BM_WUC_PAGE) { in e1000e_write_phy_reg_bm2()
2555 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in e1000e_write_phy_reg_bm2()
2560 hw->phy.addr = 1; in e1000e_write_phy_reg_bm2()
2562 if (offset > MAX_PHY_MULTI_PAGE_REG) { in e1000e_write_phy_reg_bm2()
2563 /* Page is shifted left, PHY expects (page x 32) */ in e1000e_write_phy_reg_bm2()
2565 page); in e1000e_write_phy_reg_bm2()
2571 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, in e1000e_write_phy_reg_bm2()
2575 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm2()
2580 * e1000_enable_phy_wakeup_reg_access_bm - enable access to BM wakeup registers
2592 /* All page select, port ctrl and wakeup registers use phy address 1 */ in e1000_enable_phy_wakeup_reg_access_bm()
2593 hw->phy.addr = 1; in e1000_enable_phy_wakeup_reg_access_bm()
2595 /* Select Port Control Registers page */ in e1000_enable_phy_wakeup_reg_access_bm()
2598 e_dbg("Could not set Port Control page\n"); in e1000_enable_phy_wakeup_reg_access_bm()
2609 /* Enable both PHY wakeup mode and Wakeup register page writes. in e1000_enable_phy_wakeup_reg_access_bm()
2623 /* Select Host Wakeup Registers page - caller now able to write in e1000_enable_phy_wakeup_reg_access_bm()
2624 * registers on the Wakeup registers page in e1000_enable_phy_wakeup_reg_access_bm()
2630 * e1000_disable_phy_wakeup_reg_access_bm - disable access to BM wakeup regs
2644 /* Select Port Control Registers page */ in e1000_disable_phy_wakeup_reg_access_bm()
2647 e_dbg("Could not set Port Control page\n"); in e1000_disable_phy_wakeup_reg_access_bm()
2661 * e1000_access_phy_wakeup_reg_bm - Read/write BM PHY wakeup register
2663 * @offset: register offset to be read or written
2668 * Read the PHY register at offset and store the retrieved information in
2669 * data, or write data to PHY register at offset. Note the procedure to
2672 * 1) Set 769.17.2 (page 769, register 17, bit 2) = 1
2673 * 2) Set page to 800 for host (801 if we were manageability)
2682 * the PHY page is set to BM_WUC_PAGE (i.e. a function in the call stack
2685 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, in e1000_access_phy_wakeup_reg_bm() argument
2689 u16 reg = BM_PHY_REG_NUM(offset); in e1000_access_phy_wakeup_reg_bm()
2690 u16 page = BM_PHY_REG_PAGE(offset); in e1000_access_phy_wakeup_reg_bm() local
2693 /* Gig must be disabled for MDIO accesses to Host Wakeup reg page */ in e1000_access_phy_wakeup_reg_bm()
2694 if ((hw->mac.type == e1000_pchlan) && in e1000_access_phy_wakeup_reg_bm()
2696 e_dbg("Attempting to access page %d while gig enabled.\n", in e1000_access_phy_wakeup_reg_bm()
2697 page); in e1000_access_phy_wakeup_reg_bm()
2708 e_dbg("Accessing PHY page %d reg 0x%x\n", page, reg); in e1000_access_phy_wakeup_reg_bm()
2710 /* Write the Wakeup register page offset value using opcode 0x11 */ in e1000_access_phy_wakeup_reg_bm()
2713 e_dbg("Could not write address opcode to page %d\n", page); in e1000_access_phy_wakeup_reg_bm()
2718 /* Read the Wakeup register page value using opcode 0x12 */ in e1000_access_phy_wakeup_reg_bm()
2722 /* Write the Wakeup register page value using opcode 0x12 */ in e1000_access_phy_wakeup_reg_bm()
2728 e_dbg("Could not access PHY reg %d.%d\n", page, reg); in e1000_access_phy_wakeup_reg_bm()
2739 * e1000_power_up_phy_copper - Restore copper link in case of PHY power down
2762 * e1000_power_down_phy_copper - Restore copper link in case of PHY power down
2786 * __e1000_read_phy_reg_hv - Read HV PHY register
2788 * @offset: register offset to be read
2793 * Acquires semaphore, if necessary, then reads the PHY register at offset
2797 static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, in __e1000_read_phy_reg_hv() argument
2801 u16 page = BM_PHY_REG_PAGE(offset); in __e1000_read_phy_reg_hv() local
2802 u16 reg = BM_PHY_REG_NUM(offset); in __e1000_read_phy_reg_hv()
2803 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_read_phy_reg_hv()
2806 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_phy_reg_hv()
2811 /* Page 800 works differently than the rest so it has its own func */ in __e1000_read_phy_reg_hv()
2812 if (page == BM_WUC_PAGE) { in __e1000_read_phy_reg_hv()
2813 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, in __e1000_read_phy_reg_hv()
2818 if (page > 0 && page < HV_INTC_FC_PAGE_START) { in __e1000_read_phy_reg_hv()
2819 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_read_phy_reg_hv()
2825 if (page == HV_INTC_FC_PAGE_START) in __e1000_read_phy_reg_hv()
2826 page = 0; in __e1000_read_phy_reg_hv()
2829 /* Page is shifted left, PHY expects (page x 32) */ in __e1000_read_phy_reg_hv()
2831 (page << IGP_PAGE_SHIFT)); in __e1000_read_phy_reg_hv()
2833 hw->phy.addr = phy_addr; in __e1000_read_phy_reg_hv()
2840 e_dbg("reading PHY page %d (or 0x%x shifted) reg 0x%x\n", page, in __e1000_read_phy_reg_hv()
2841 page << IGP_PAGE_SHIFT, reg); in __e1000_read_phy_reg_hv()
2846 hw->phy.ops.release(hw); in __e1000_read_phy_reg_hv()
2852 * e1000_read_phy_reg_hv - Read HV PHY register
2854 * @offset: register offset to be read
2857 * Acquires semaphore then reads the PHY register at offset and stores
2861 s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv() argument
2863 return __e1000_read_phy_reg_hv(hw, offset, data, false, false); in e1000_read_phy_reg_hv()
2867 * e1000_read_phy_reg_hv_locked - Read HV PHY register
2869 * @offset: register offset to be read
2872 * Reads the PHY register at offset and stores the retrieved information
2875 s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_hv_locked() argument
2877 return __e1000_read_phy_reg_hv(hw, offset, data, true, false); in e1000_read_phy_reg_hv_locked()
2881 * e1000_read_phy_reg_page_hv - Read HV PHY register
2883 * @offset: register offset to write to
2884 * @data: data to write at register offset
2886 * Reads the PHY register at offset and stores the retrieved information
2887 * in data. Assumes semaphore already acquired and page already set.
2889 s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) in e1000_read_phy_reg_page_hv() argument
2891 return __e1000_read_phy_reg_hv(hw, offset, data, true, true); in e1000_read_phy_reg_page_hv()
2895 * __e1000_write_phy_reg_hv - Write HV PHY register
2897 * @offset: register offset to write to
2898 * @data: data to write at register offset
2903 * at the offset. Release any acquired semaphores before exiting.
2905 static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, in __e1000_write_phy_reg_hv() argument
2909 u16 page = BM_PHY_REG_PAGE(offset); in __e1000_write_phy_reg_hv() local
2910 u16 reg = BM_PHY_REG_NUM(offset); in __e1000_write_phy_reg_hv()
2911 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_write_phy_reg_hv()
2914 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_phy_reg_hv()
2919 /* Page 800 works differently than the rest so it has its own func */ in __e1000_write_phy_reg_hv()
2920 if (page == BM_WUC_PAGE) { in __e1000_write_phy_reg_hv()
2921 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, in __e1000_write_phy_reg_hv()
2926 if (page > 0 && page < HV_INTC_FC_PAGE_START) { in __e1000_write_phy_reg_hv()
2927 ret_val = e1000_access_phy_debug_regs_hv(hw, offset, in __e1000_write_phy_reg_hv()
2933 if (page == HV_INTC_FC_PAGE_START) in __e1000_write_phy_reg_hv()
2934 page = 0; in __e1000_write_phy_reg_hv()
2939 if ((hw->phy.type == e1000_phy_82578) && in __e1000_write_phy_reg_hv()
2940 (hw->phy.revision >= 1) && in __e1000_write_phy_reg_hv()
2941 (hw->phy.addr == 2) && in __e1000_write_phy_reg_hv()
2953 /* Page is shifted left, PHY expects (page x 32) */ in __e1000_write_phy_reg_hv()
2955 (page << IGP_PAGE_SHIFT)); in __e1000_write_phy_reg_hv()
2957 hw->phy.addr = phy_addr; in __e1000_write_phy_reg_hv()
2964 e_dbg("writing PHY page %d (or 0x%x shifted) reg 0x%x\n", page, in __e1000_write_phy_reg_hv()
2965 page << IGP_PAGE_SHIFT, reg); in __e1000_write_phy_reg_hv()
2972 hw->phy.ops.release(hw); in __e1000_write_phy_reg_hv()
2978 * e1000_write_phy_reg_hv - Write HV PHY register
2980 * @offset: register offset to write to
2981 * @data: data to write at register offset
2983 * Acquires semaphore then writes the data to PHY register at the offset.
2986 s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv() argument
2988 return __e1000_write_phy_reg_hv(hw, offset, data, false, false); in e1000_write_phy_reg_hv()
2992 * e1000_write_phy_reg_hv_locked - Write HV PHY register
2994 * @offset: register offset to write to
2995 * @data: data to write at register offset
2997 * Writes the data to PHY register at the offset. Assumes semaphore
3000 s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_hv_locked() argument
3002 return __e1000_write_phy_reg_hv(hw, offset, data, true, false); in e1000_write_phy_reg_hv_locked()
3006 * e1000_write_phy_reg_page_hv - Write HV PHY register
3008 * @offset: register offset to write to
3009 * @data: data to write at register offset
3011 * Writes the data to PHY register at the offset. Assumes semaphore
3012 * already acquired and page already set.
3014 s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data) in e1000_write_phy_reg_page_hv() argument
3016 return __e1000_write_phy_reg_hv(hw, offset, data, true, true); in e1000_write_phy_reg_page_hv()
3020 * e1000_get_phy_addr_for_hv_page - Get PHY address based on page
3021 * @page: page to be accessed
3023 static u32 e1000_get_phy_addr_for_hv_page(u32 page) in e1000_get_phy_addr_for_hv_page() argument
3027 if (page >= HV_INTC_FC_PAGE_START) in e1000_get_phy_addr_for_hv_page()
3034 * e1000_access_phy_debug_regs_hv - Read HV PHY vendor specific high registers
3036 * @offset: register offset to be read or written
3040 * Reads the PHY register at offset and stores the retrieved information
3045 static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, in e1000_access_phy_debug_regs_hv() argument
3053 addr_reg = ((hw->phy.type == e1000_phy_82578) ? in e1000_access_phy_debug_regs_hv()
3058 hw->phy.addr = 2; in e1000_access_phy_debug_regs_hv()
3060 /* masking with 0x3F to remove the page from offset */ in e1000_access_phy_debug_regs_hv()
3061 ret_val = e1000e_write_phy_reg_mdic(hw, addr_reg, (u16)offset & 0x3F); in e1000_access_phy_debug_regs_hv()
3063 e_dbg("Could not write the Address Offset port register\n"); in e1000_access_phy_debug_regs_hv()
3080 * e1000_link_stall_workaround_hv - Si workaround
3095 if (hw->phy.type != e1000_phy_82578) in e1000_link_stall_workaround_hv()
3132 * e1000_check_polarity_82577 - Checks the polarity.
3135 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
3141 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_82577()
3148 phy->cable_polarity = ((data & I82577_PHY_STATUS2_REV_POLARITY) in e1000_check_polarity_82577()
3156 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY
3163 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_82577()
3180 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_82577()
3200 * e1000_get_phy_info_82577 - Retrieve I82577 PHY information
3204 * set/determine 10base-T extended distance and polarity correction. Read
3210 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_82577()
3221 return -E1000_ERR_CONFIG; in e1000_get_phy_info_82577()
3224 phy->polarity_correction = true; in e1000_get_phy_info_82577()
3234 phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX); in e1000_get_phy_info_82577()
3238 ret_val = hw->phy.ops.get_cable_length(hw); in e1000_get_phy_info_82577()
3246 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000_get_phy_info_82577()
3249 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000_get_phy_info_82577()
3252 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_82577()
3253 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3254 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3261 * e1000_get_cable_length_82577 - Determine cable length for 82577 PHY
3269 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_82577()
3280 return -E1000_ERR_PHY; in e1000_get_cable_length_82577()
3282 phy->cable_length = length; in e1000_get_cable_length_82577()