Lines Matching full:phy
65 * e1000_init_phy_ops_generic - Initialize PHY function pointers
72 struct e1000_phy_info *phy = &hw->phy; in e1000_init_phy_ops_generic() local
76 phy->ops.init_params = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
77 phy->ops.acquire = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
78 phy->ops.check_polarity = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
79 phy->ops.check_reset_block = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
80 phy->ops.commit = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
81 phy->ops.force_speed_duplex = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
82 phy->ops.get_cfg_done = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
83 phy->ops.get_cable_length = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
84 phy->ops.get_info = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
85 phy->ops.set_page = e1000_null_set_page; in e1000_init_phy_ops_generic()
86 phy->ops.read_reg = e1000_null_read_reg; in e1000_init_phy_ops_generic()
87 phy->ops.read_reg_locked = e1000_null_read_reg; in e1000_init_phy_ops_generic()
88 phy->ops.read_reg_page = e1000_null_read_reg; in e1000_init_phy_ops_generic()
89 phy->ops.release = e1000_null_phy_generic; in e1000_init_phy_ops_generic()
90 phy->ops.reset = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
91 phy->ops.set_d0_lplu_state = e1000_null_lplu_state; in e1000_init_phy_ops_generic()
92 phy->ops.set_d3_lplu_state = e1000_null_lplu_state; in e1000_init_phy_ops_generic()
93 phy->ops.write_reg = e1000_null_write_reg; in e1000_init_phy_ops_generic()
94 phy->ops.write_reg_locked = e1000_null_write_reg; in e1000_init_phy_ops_generic()
95 phy->ops.write_reg_page = e1000_null_write_reg; in e1000_init_phy_ops_generic()
96 phy->ops.power_up = e1000_null_phy_generic; in e1000_init_phy_ops_generic()
97 phy->ops.power_down = e1000_null_phy_generic; in e1000_init_phy_ops_generic()
98 phy->ops.read_i2c_byte = e1000_read_i2c_byte_null; in e1000_init_phy_ops_generic()
99 phy->ops.write_i2c_byte = e1000_write_i2c_byte_null; in e1000_init_phy_ops_generic()
100 phy->ops.cfg_on_link_up = e1000_null_ops_generic; in e1000_init_phy_ops_generic()
198 * e1000_check_reset_block_generic - Check if PHY reset is blocked
201 * Read the PHY management control register and check whether a PHY reset
218 * e1000_get_phy_id - Retrieve the PHY ID and revision
221 * Reads the PHY registers and stores the PHY ID and possibly the PHY
226 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_id() local
233 if (!phy->ops.read_reg) in e1000_get_phy_id()
237 ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); in e1000_get_phy_id()
241 phy->id = (u32)(phy_id << 16); in e1000_get_phy_id()
243 ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); in e1000_get_phy_id()
247 phy->id |= (u32)(phy_id & PHY_REVISION_MASK); in e1000_get_phy_id()
248 phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); in e1000_get_phy_id()
250 if (phy->id != 0 && phy->id != PHY_REVISION_MASK) in e1000_get_phy_id()
260 * e1000_phy_reset_dsp_generic - Reset PHY DSP
271 if (!hw->phy.ops.write_reg) in e1000_phy_reset_dsp_generic()
274 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1); in e1000_phy_reset_dsp_generic()
278 return hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0); in e1000_phy_reset_dsp_generic()
287 * Reads the MDI control register in the PHY at offset and stores the
292 struct e1000_phy_info *phy = &hw->phy; in e1000_read_phy_reg_mdic() local
298 DEBUGOUT1("PHY Address %d is out of range\n", offset); in e1000_read_phy_reg_mdic()
302 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000_read_phy_reg_mdic()
304 * PHY to retrieve the desired data. in e1000_read_phy_reg_mdic()
307 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000_read_phy_reg_mdic()
353 * Writes data to MDI control register in the PHY at offset.
357 struct e1000_phy_info *phy = &hw->phy; in e1000_write_phy_reg_mdic() local
363 DEBUGOUT1("PHY Address %d is out of range\n", offset); in e1000_write_phy_reg_mdic()
367 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000_write_phy_reg_mdic()
369 * PHY to retrieve the desired data. in e1000_write_phy_reg_mdic()
373 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000_write_phy_reg_mdic()
413 * e1000_read_phy_reg_i2c - Read PHY register using i2c
418 * Reads the PHY register at offset using the i2c interface and stores the
423 struct e1000_phy_info *phy = &hw->phy; in e1000_read_phy_reg_i2c() local
428 /* Set up Op-code, Phy Address, and register address in the I2CCMD in e1000_read_phy_reg_i2c()
430 * PHY to retrieve the desired data. in e1000_read_phy_reg_i2c()
433 (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | in e1000_read_phy_reg_i2c()
461 * e1000_write_phy_reg_i2c - Write PHY register using i2c
466 * Writes the data to PHY register at the offset using the i2c interface.
470 struct e1000_phy_info *phy = &hw->phy; in e1000_write_phy_reg_i2c() local
477 if ((hw->phy.addr == 0) || (hw->phy.addr > 7)) { in e1000_write_phy_reg_i2c()
478 DEBUGOUT1("PHY I2C Address %d is out of range.\n", in e1000_write_phy_reg_i2c()
479 hw->phy.addr); in e1000_write_phy_reg_i2c()
486 /* Set up Op-code, Phy Address, and register address in the I2CCMD in e1000_write_phy_reg_i2c()
488 * PHY to retrieve the desired data. in e1000_write_phy_reg_i2c()
491 (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | in e1000_write_phy_reg_i2c()
645 * e1000_read_phy_reg_m88 - Read m88 PHY register
650 * Acquires semaphore, if necessary, then reads the PHY register at offset
660 if (!hw->phy.ops.acquire) in e1000_read_phy_reg_m88()
663 ret_val = hw->phy.ops.acquire(hw); in e1000_read_phy_reg_m88()
670 hw->phy.ops.release(hw); in e1000_read_phy_reg_m88()
676 * e1000_write_phy_reg_m88 - Write m88 PHY register
681 * Acquires semaphore, if necessary, then writes the data to PHY register
690 if (!hw->phy.ops.acquire) in e1000_write_phy_reg_m88()
693 ret_val = hw->phy.ops.acquire(hw); in e1000_write_phy_reg_m88()
700 hw->phy.ops.release(hw); in e1000_write_phy_reg_m88()
706 * e1000_set_page_igp - Set page as on IGP-like PHY(s)
710 * Sets PHY page required for PHY register access. Assumes semaphore is
711 * already acquired. Note, this function sets phy.addr to 1 so the caller
720 hw->phy.addr = 1; in e1000_set_page_igp()
726 * __e1000_read_phy_reg_igp - Read igp PHY register
732 * Acquires semaphore, if necessary, then reads the PHY register at offset
744 if (!hw->phy.ops.acquire) in __e1000_read_phy_reg_igp()
747 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_phy_reg_igp()
761 hw->phy.ops.release(hw); in __e1000_read_phy_reg_igp()
767 * e1000_read_phy_reg_igp - Read igp PHY register
772 * Acquires semaphore then reads the PHY register at offset and stores the
782 * e1000_read_phy_reg_igp_locked - Read igp PHY register
787 * Reads the PHY register at offset and stores the retrieved information
796 * e1000_write_phy_reg_igp - Write igp PHY register
802 * Acquires semaphore, if necessary, then writes the data to PHY register
813 if (!hw->phy.ops.acquire) in __e1000_write_phy_reg_igp()
816 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_phy_reg_igp()
830 hw->phy.ops.release(hw); in __e1000_write_phy_reg_igp()
836 * e1000_write_phy_reg_igp - Write igp PHY register
841 * Acquires semaphore then writes the data to PHY register
850 * e1000_write_phy_reg_igp_locked - Write igp PHY register
855 * Writes the data to PHY register at the offset.
870 * Acquires semaphore, if necessary. Then reads the PHY register at offset
884 if (!hw->phy.ops.acquire) in __e1000_read_kmrn_reg()
887 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_kmrn_reg()
903 hw->phy.ops.release(hw); in __e1000_read_kmrn_reg()
914 * Acquires semaphore then reads the PHY register at offset using the
929 * Reads the PHY register at offset using the kumeran interface. The
945 * Acquires semaphore, if necessary. Then write the data to PHY register
959 if (!hw->phy.ops.acquire) in __e1000_write_kmrn_reg()
962 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_kmrn_reg()
975 hw->phy.ops.release(hw); in __e1000_write_kmrn_reg()
986 * Acquires semaphore then writes the data to the PHY register at the offset
1000 * Write the data to PHY register at the offset using the kumeran interface.
1009 * e1000_set_master_slave_mode - Setup PHY for Master/slave mode
1020 ret_val = hw->phy.ops.read_reg(hw, PHY_1000T_CTRL, &phy_data); in e1000_set_master_slave_mode()
1025 hw->phy.original_ms_type = (phy_data & CR_1000T_MS_ENABLE) ? in e1000_set_master_slave_mode()
1030 switch (hw->phy.ms_type) { in e1000_set_master_slave_mode()
1045 return hw->phy.ops.write_reg(hw, PHY_1000T_CTRL, phy_data); in e1000_set_master_slave_mode()
1049 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
1061 if (hw->phy.type == e1000_phy_82580) { in e1000_copper_link_setup_82577()
1062 ret_val = hw->phy.ops.reset(hw); in e1000_copper_link_setup_82577()
1064 DEBUGOUT("Error resetting the PHY.\n"); in e1000_copper_link_setup_82577()
1070 ret_val = hw->phy.ops.read_reg(hw, I82577_CFG_REG, &phy_data); in e1000_copper_link_setup_82577()
1079 ret_val = hw->phy.ops.write_reg(hw, I82577_CFG_REG, phy_data); in e1000_copper_link_setup_82577()
1084 ret_val = hw->phy.ops.read_reg(hw, I82577_PHY_CTRL_2, &phy_data); in e1000_copper_link_setup_82577()
1093 switch (hw->phy.mdix) { in e1000_copper_link_setup_82577()
1105 ret_val = hw->phy.ops.write_reg(hw, I82577_PHY_CTRL_2, phy_data); in e1000_copper_link_setup_82577()
1113 * e1000_copper_link_setup_m88 - Setup m88 PHY's for copper link
1116 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
1121 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_setup_m88() local
1129 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_copper_link_setup_m88()
1133 /* For BM PHY this bit is downshift enable */ in e1000_copper_link_setup_m88()
1134 if (phy->type != e1000_phy_bm) in e1000_copper_link_setup_m88()
1146 switch (phy->mdix) { in e1000_copper_link_setup_m88()
1170 if (phy->disable_polarity_correction) in e1000_copper_link_setup_m88()
1174 if (phy->type == e1000_phy_bm) { in e1000_copper_link_setup_m88()
1176 if (phy->id == BME1000_E_PHY_ID_R2) { in e1000_copper_link_setup_m88()
1178 ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, in e1000_copper_link_setup_m88()
1183 ret_val = phy->ops.commit(hw); in e1000_copper_link_setup_m88()
1185 DEBUGOUT("Error committing the PHY changes\n"); in e1000_copper_link_setup_m88()
1193 ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_setup_m88()
1197 if ((phy->type == e1000_phy_m88) && in e1000_copper_link_setup_m88()
1198 (phy->revision < E1000_REVISION_4) && in e1000_copper_link_setup_m88()
1199 (phy->id != BME1000_E_PHY_ID_R2)) { in e1000_copper_link_setup_m88()
1200 /* Force TX_CLK in the Extended PHY Specific Control Register in e1000_copper_link_setup_m88()
1203 ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_copper_link_setup_m88()
1210 if ((phy->revision == E1000_REVISION_2) && in e1000_copper_link_setup_m88()
1211 (phy->id == M88E1111_I_PHY_ID)) { in e1000_copper_link_setup_m88()
1212 /* 82573L PHY - set the downshift counter to 5x. */ in e1000_copper_link_setup_m88()
1222 ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_copper_link_setup_m88()
1228 if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) { in e1000_copper_link_setup_m88()
1229 /* Set PHY page 0, register 29 to 0x0003 */ in e1000_copper_link_setup_m88()
1230 ret_val = phy->ops.write_reg(hw, 29, 0x0003); in e1000_copper_link_setup_m88()
1234 /* Set PHY page 0, register 30 to 0x0000 */ in e1000_copper_link_setup_m88()
1235 ret_val = phy->ops.write_reg(hw, 30, 0x0000); in e1000_copper_link_setup_m88()
1241 ret_val = phy->ops.commit(hw); in e1000_copper_link_setup_m88()
1243 DEBUGOUT("Error committing the PHY changes\n"); in e1000_copper_link_setup_m88()
1247 if (phy->type == e1000_phy_82578) { in e1000_copper_link_setup_m88()
1248 ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_copper_link_setup_m88()
1253 /* 82578 PHY - set the downshift count to 1x. */ in e1000_copper_link_setup_m88()
1256 ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_copper_link_setup_m88()
1266 * e1000_copper_link_setup_m88_gen2 - Setup m88 PHY's for copper link
1269 * Sets up MDI/MDI-X and polarity for i347-AT4, m88e1322 and m88e1112 PHY's.
1274 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_setup_m88_gen2() local
1282 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_copper_link_setup_m88_gen2()
1295 switch (phy->mdix) { in e1000_copper_link_setup_m88_gen2()
1304 if (phy->id != M88E1112_E_PHY_ID) { in e1000_copper_link_setup_m88_gen2()
1323 if (phy->disable_polarity_correction) in e1000_copper_link_setup_m88_gen2()
1327 if (phy->id == M88E1543_E_PHY_ID) { in e1000_copper_link_setup_m88_gen2()
1330 phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_setup_m88_gen2()
1334 ret_val = phy->ops.commit(hw); in e1000_copper_link_setup_m88_gen2()
1336 DEBUGOUT("Error committing the PHY changes\n"); in e1000_copper_link_setup_m88_gen2()
1345 ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_setup_m88_gen2()
1350 ret_val = phy->ops.commit(hw); in e1000_copper_link_setup_m88_gen2()
1352 DEBUGOUT("Error committing the PHY changes\n"); in e1000_copper_link_setup_m88_gen2()
1364 * e1000_copper_link_setup_igp - Setup igp PHY's for copper link
1368 * igp PHY's.
1372 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_setup_igp() local
1379 ret_val = hw->phy.ops.reset(hw); in e1000_copper_link_setup_igp()
1381 DEBUGOUT("Error resetting the PHY.\n"); in e1000_copper_link_setup_igp()
1385 /* Wait 100ms for MAC to configure PHY from NVM settings, to avoid in e1000_copper_link_setup_igp()
1393 if (phy->type == e1000_phy_igp) { in e1000_copper_link_setup_igp()
1395 ret_val = hw->phy.ops.set_d3_lplu_state(hw, false); in e1000_copper_link_setup_igp()
1403 if (hw->phy.ops.set_d0_lplu_state) { in e1000_copper_link_setup_igp()
1404 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); in e1000_copper_link_setup_igp()
1411 ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &data); in e1000_copper_link_setup_igp()
1417 switch (phy->mdix) { in e1000_copper_link_setup_igp()
1430 ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, data); in e1000_copper_link_setup_igp()
1440 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000_copper_link_setup_igp()
1442 ret_val = phy->ops.read_reg(hw, in e1000_copper_link_setup_igp()
1449 ret_val = phy->ops.write_reg(hw, in e1000_copper_link_setup_igp()
1456 ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data); in e1000_copper_link_setup_igp()
1461 ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data); in e1000_copper_link_setup_igp()
1473 * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation
1477 * register and if the PHY is already setup for auto-negotiation, then
1483 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_setup_autoneg() local
1490 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_phy_setup_autoneg()
1493 ret_val = phy->ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1497 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
1499 ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, in e1000_phy_setup_autoneg()
1506 * the appropriate PHY registers. First we will parse for in e1000_phy_setup_autoneg()
1522 DEBUGOUT1("autoneg_advertised %x\n", phy->autoneg_advertised); in e1000_phy_setup_autoneg()
1525 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
1531 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
1537 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
1543 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
1548 /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ in e1000_phy_setup_autoneg()
1549 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in e1000_phy_setup_autoneg()
1553 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
1559 * setup the PHY advertisement registers accordingly. If in e1000_phy_setup_autoneg()
1612 ret_val = phy->ops.write_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1618 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in e1000_phy_setup_autoneg()
1619 ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, in e1000_phy_setup_autoneg()
1630 * configure to advertise the full capability. Setup the PHY to autoneg
1636 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_autoneg() local
1645 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_copper_link_autoneg()
1650 if (!phy->autoneg_advertised) in e1000_copper_link_autoneg()
1651 phy->autoneg_advertised = phy->autoneg_mask; in e1000_copper_link_autoneg()
1662 * the Auto Neg Restart bit in the PHY control register. in e1000_copper_link_autoneg()
1664 ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); in e1000_copper_link_autoneg()
1669 ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl); in e1000_copper_link_autoneg()
1676 if (phy->autoneg_wait_to_complete) { in e1000_copper_link_autoneg()
1714 /* PHY will be set to 10H, 10F, 100H or 100F in e1000_setup_copper_link_generic()
1718 ret_val = hw->phy.ops.force_speed_duplex(hw); in e1000_setup_copper_link_generic()
1745 * e1000_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
1748 * Calls the PHY setup function to force speed and duplex. Clears the
1754 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_igp() local
1761 ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); in e1000_phy_force_speed_duplex_igp()
1767 ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); in e1000_phy_force_speed_duplex_igp()
1774 ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000_phy_force_speed_duplex_igp()
1781 ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000_phy_force_speed_duplex_igp()
1789 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_igp()
1790 DEBUGOUT("Waiting for forced speed/duplex link on IGP phy.\n"); in e1000_phy_force_speed_duplex_igp()
1809 * e1000_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
1812 * Calls the PHY setup function to force speed and duplex. Clears the
1813 * auto-crossover to force MDI manually. Resets the PHY to commit the
1820 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_m88() local
1828 if (phy->type != e1000_phy_i210) { in e1000_phy_force_speed_duplex_m88()
1832 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, in e1000_phy_force_speed_duplex_m88()
1838 ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, in e1000_phy_force_speed_duplex_m88()
1846 ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); in e1000_phy_force_speed_duplex_m88()
1852 ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); in e1000_phy_force_speed_duplex_m88()
1856 /* Reset the phy to commit changes. */ in e1000_phy_force_speed_duplex_m88()
1857 ret_val = hw->phy.ops.commit(hw); in e1000_phy_force_speed_duplex_m88()
1861 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_m88()
1862 DEBUGOUT("Waiting for forced speed/duplex link on M88 phy.\n"); in e1000_phy_force_speed_duplex_m88()
1872 switch (hw->phy.id) { in e1000_phy_force_speed_duplex_m88()
1882 if (hw->phy.type != e1000_phy_m88) in e1000_phy_force_speed_duplex_m88()
1893 ret_val = phy->ops.write_reg(hw, in e1000_phy_force_speed_duplex_m88()
1911 if (hw->phy.type != e1000_phy_m88) in e1000_phy_force_speed_duplex_m88()
1914 if (hw->phy.id == I347AT4_E_PHY_ID || in e1000_phy_force_speed_duplex_m88()
1915 hw->phy.id == M88E1340M_E_PHY_ID || in e1000_phy_force_speed_duplex_m88()
1916 hw->phy.id == M88E1112_E_PHY_ID) in e1000_phy_force_speed_duplex_m88()
1918 if (hw->phy.id == I210_I_PHY_ID) in e1000_phy_force_speed_duplex_m88()
1920 if ((hw->phy.id == M88E1543_E_PHY_ID) || in e1000_phy_force_speed_duplex_m88()
1921 (hw->phy.id == M88E1512_E_PHY_ID)) in e1000_phy_force_speed_duplex_m88()
1923 ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); in e1000_phy_force_speed_duplex_m88()
1927 /* Resetting the phy means we need to re-force TX_CLK in the in e1000_phy_force_speed_duplex_m88()
1928 * Extended PHY Specific Control Register to 25MHz clock from in e1000_phy_force_speed_duplex_m88()
1932 ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); in e1000_phy_force_speed_duplex_m88()
1939 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_phy_force_speed_duplex_m88()
1944 ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_phy_force_speed_duplex_m88()
1950 * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex
1953 * Forces the speed and duplex settings of the PHY.
1955 * PHY setup routines.
1959 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_ife() local
1966 ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &data); in e1000_phy_force_speed_duplex_ife()
1972 ret_val = phy->ops.write_reg(hw, PHY_CONTROL, data); in e1000_phy_force_speed_duplex_ife()
1977 ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_phy_force_speed_duplex_ife()
1984 ret_val = phy->ops.write_reg(hw, IFE_PHY_MDIX_CONTROL, data); in e1000_phy_force_speed_duplex_ife()
1992 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_ife()
1993 DEBUGOUT("Waiting for forced speed/duplex link on IFE phy.\n"); in e1000_phy_force_speed_duplex_ife()
2014 * e1000_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
2018 * Forces speed and duplex on the PHY by doing the following: disable flow
2043 /* Disable autoneg on the phy */ in e1000_phy_force_speed_duplex_setup()
2090 struct e1000_phy_info *phy = &hw->phy; in e1000_set_d3_lplu_state_generic() local
2096 if (!hw->phy.ops.read_reg) in e1000_set_d3_lplu_state_generic()
2099 ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data); in e1000_set_d3_lplu_state_generic()
2105 ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, in e1000_set_d3_lplu_state_generic()
2114 if (phy->smart_speed == e1000_smart_speed_on) { in e1000_set_d3_lplu_state_generic()
2115 ret_val = phy->ops.read_reg(hw, in e1000_set_d3_lplu_state_generic()
2122 ret_val = phy->ops.write_reg(hw, in e1000_set_d3_lplu_state_generic()
2127 } else if (phy->smart_speed == e1000_smart_speed_off) { in e1000_set_d3_lplu_state_generic()
2128 ret_val = phy->ops.read_reg(hw, in e1000_set_d3_lplu_state_generic()
2135 ret_val = phy->ops.write_reg(hw, in e1000_set_d3_lplu_state_generic()
2141 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in e1000_set_d3_lplu_state_generic()
2142 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || in e1000_set_d3_lplu_state_generic()
2143 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { in e1000_set_d3_lplu_state_generic()
2145 ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, in e1000_set_d3_lplu_state_generic()
2151 ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state_generic()
2157 ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state_generic()
2170 * A downshift is detected by querying the PHY link health.
2174 struct e1000_phy_info *phy = &hw->phy; in e1000_check_downshift_generic() local
2180 switch (phy->type) { in e1000_check_downshift_generic()
2197 phy->speed_downgraded = false; in e1000_check_downshift_generic()
2201 ret_val = phy->ops.read_reg(hw, offset, &phy_data); in e1000_check_downshift_generic()
2204 phy->speed_downgraded = !!(phy_data & mask); in e1000_check_downshift_generic()
2215 * Polarity is determined based on the PHY specific status register.
2219 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_m88() local
2225 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &data); in e1000_check_polarity_m88()
2228 phy->cable_polarity = ((data & M88E1000_PSSR_REV_POLARITY) in e1000_check_polarity_m88()
2241 * Polarity is determined based on the PHY port status register, and the
2246 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_igp() local
2255 ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000_check_polarity_igp()
2271 ret_val = phy->ops.read_reg(hw, offset, &data); in e1000_check_polarity_igp()
2274 phy->cable_polarity = ((data & mask) in e1000_check_polarity_igp()
2282 * e1000_check_polarity_ife - Check cable polarity for IFE PHY
2289 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_ife() local
2297 if (phy->polarity_correction) { in e1000_check_polarity_ife()
2305 ret_val = phy->ops.read_reg(hw, offset, &phy_data); in e1000_check_polarity_ife()
2308 phy->cable_polarity = ((phy_data & mask) in e1000_check_polarity_ife()
2329 if (!hw->phy.ops.read_reg) in e1000_wait_autoneg()
2334 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in e1000_wait_autoneg()
2337 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in e1000_wait_autoneg()
2352 * e1000_phy_has_link_generic - Polls PHY for link
2358 * Polls the PHY status register for link, 'iterations' number of times.
2368 if (!hw->phy.ops.read_reg) in e1000_phy_has_link_generic()
2376 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in e1000_phy_has_link_generic()
2387 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in e1000_phy_has_link_generic()
2404 * e1000_get_cable_length_m88 - Determine cable length for m88 PHY
2407 * Reads the PHY specific status register to retrieve the cable length
2409 * maximum values to get the "average" cable length. The m88 PHY has four
2420 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_m88() local
2426 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000_get_cable_length_m88()
2436 phy->min_cable_length = e1000_m88_cable_length_table[index]; in e1000_get_cable_length_m88()
2437 phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; in e1000_get_cable_length_m88()
2439 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000_get_cable_length_m88()
2446 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_m88_gen2() local
2453 switch (hw->phy.id) { in e1000_get_cable_length_m88_gen2()
2455 /* Get cable length from PHY Cable Diagnostics Control Reg */ in e1000_get_cable_length_m88_gen2()
2456 ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) + in e1000_get_cable_length_m88_gen2()
2457 (I347AT4_PCDL + phy->addr), in e1000_get_cable_length_m88_gen2()
2463 ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) + in e1000_get_cable_length_m88_gen2()
2470 /* Populate the phy structure with cable length in meters */ in e1000_get_cable_length_m88_gen2()
2471 phy->min_cable_length = phy_data / (is_cm ? 100 : 1); in e1000_get_cable_length_m88_gen2()
2472 phy->max_cable_length = phy_data / (is_cm ? 100 : 1); in e1000_get_cable_length_m88_gen2()
2473 phy->cable_length = phy_data / (is_cm ? 100 : 1); in e1000_get_cable_length_m88_gen2()
2480 ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT, in e1000_get_cable_length_m88_gen2()
2485 ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, 0x07); in e1000_get_cable_length_m88_gen2()
2489 /* Get cable length from PHY Cable Diagnostics Control Reg */ in e1000_get_cable_length_m88_gen2()
2490 ret_val = phy->ops.read_reg(hw, (I347AT4_PCDL + phy->addr), in e1000_get_cable_length_m88_gen2()
2496 ret_val = phy->ops.read_reg(hw, I347AT4_PCDC, &phy_data2); in e1000_get_cable_length_m88_gen2()
2502 /* Populate the phy structure with cable length in meters */ in e1000_get_cable_length_m88_gen2()
2503 phy->min_cable_length = phy_data / (is_cm ? 100 : 1); in e1000_get_cable_length_m88_gen2()
2504 phy->max_cable_length = phy_data / (is_cm ? 100 : 1); in e1000_get_cable_length_m88_gen2()
2505 phy->cable_length = phy_data / (is_cm ? 100 : 1); in e1000_get_cable_length_m88_gen2()
2508 ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, in e1000_get_cable_length_m88_gen2()
2516 ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT, in e1000_get_cable_length_m88_gen2()
2521 ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, 0x05); in e1000_get_cable_length_m88_gen2()
2525 ret_val = phy->ops.read_reg(hw, M88E1112_VCT_DSP_DISTANCE, in e1000_get_cable_length_m88_gen2()
2536 phy->min_cable_length = e1000_m88_cable_length_table[index]; in e1000_get_cable_length_m88_gen2()
2537 phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; in e1000_get_cable_length_m88_gen2()
2539 phy->cable_length = (phy->min_cable_length + in e1000_get_cable_length_m88_gen2()
2540 phy->max_cable_length) / 2; in e1000_get_cable_length_m88_gen2()
2543 ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, in e1000_get_cable_length_m88_gen2()
2557 * e1000_get_cable_length_igp_2 - Determine cable length for igp2 PHY
2569 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_igp_2() local
2585 ret_val = phy->ops.read_reg(hw, agc_reg_array[i], &phy_data); in e1000_get_cable_length_igp_2()
2618 phy->min_cable_length = (((agc_value - IGP02E1000_AGC_RANGE) > 0) ? in e1000_get_cable_length_igp_2()
2620 phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE; in e1000_get_cable_length_igp_2()
2622 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000_get_cable_length_igp_2()
2628 * e1000_get_phy_info_m88 - Retrieve PHY information
2631 * Valid for only copper links. Read the PHY status register (sticky read)
2632 * to verify that link is up. Read the PHY special control register to
2633 * determine the polarity and 10base-T extended distance. Read the PHY
2639 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_m88() local
2646 if (phy->media_type != e1000_media_type_copper) { in e1000_get_phy_info_m88()
2647 DEBUGOUT("Phy info is only valid for copper media\n"); in e1000_get_phy_info_m88()
2656 DEBUGOUT("Phy info is only valid if link is up\n"); in e1000_get_phy_info_m88()
2660 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_get_phy_info_m88()
2664 phy->polarity_correction = !!(phy_data & in e1000_get_phy_info_m88()
2671 ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000_get_phy_info_m88()
2675 phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX); in e1000_get_phy_info_m88()
2678 ret_val = hw->phy.ops.get_cable_length(hw); in e1000_get_phy_info_m88()
2682 ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &phy_data); in e1000_get_phy_info_m88()
2686 phy->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) in e1000_get_phy_info_m88()
2690 phy->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS) in e1000_get_phy_info_m88()
2695 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_m88()
2696 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_m88()
2697 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_m88()
2704 * e1000_get_phy_info_igp - Retrieve igp PHY information
2707 * Read PHY status to determine if link is up. If link is up, then
2709 * PHY port status to determine MDI/MDIx and speed. Based on the speed,
2714 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_igp() local
2726 DEBUGOUT("Phy info is only valid if link is up\n"); in e1000_get_phy_info_igp()
2730 phy->polarity_correction = true; in e1000_get_phy_info_igp()
2736 ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data); in e1000_get_phy_info_igp()
2740 phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX); in e1000_get_phy_info_igp()
2744 ret_val = phy->ops.get_cable_length(hw); in e1000_get_phy_info_igp()
2748 ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data); in e1000_get_phy_info_igp()
2752 phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS) in e1000_get_phy_info_igp()
2756 phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS) in e1000_get_phy_info_igp()
2760 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_igp()
2761 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_igp()
2762 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_igp()
2769 * e1000_get_phy_info_ife - Retrieves various IFE PHY states
2772 * Populates "phy" structure with various feature states.
2776 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_ife() local
2788 DEBUGOUT("Phy info is only valid if link is up\n"); in e1000_get_phy_info_ife()
2792 ret_val = phy->ops.read_reg(hw, IFE_PHY_SPECIAL_CONTROL, &data); in e1000_get_phy_info_ife()
2795 phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE); in e1000_get_phy_info_ife()
2797 if (phy->polarity_correction) { in e1000_get_phy_info_ife()
2803 phy->cable_polarity = ((data & IFE_PSC_FORCE_POLARITY) in e1000_get_phy_info_ife()
2808 ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); in e1000_get_phy_info_ife()
2812 phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS); in e1000_get_phy_info_ife()
2815 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_ife()
2816 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2817 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2823 * e1000_phy_sw_reset_generic - PHY software reset
2826 * Does a software reset of the PHY by reading the PHY control register and
2827 * setting/write the control register reset bit to the PHY.
2836 if (!hw->phy.ops.read_reg) in e1000_phy_sw_reset_generic()
2839 ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); in e1000_phy_sw_reset_generic()
2844 ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl); in e1000_phy_sw_reset_generic()
2854 * e1000_phy_hw_reset_generic - PHY hardware reset
2859 * bit in the PHY. Wait the appropriate delay time for the device to
2864 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_hw_reset_generic() local
2870 if (phy->ops.check_reset_block) { in e1000_phy_hw_reset_generic()
2871 ret_val = phy->ops.check_reset_block(hw); in e1000_phy_hw_reset_generic()
2876 ret_val = phy->ops.acquire(hw); in e1000_phy_hw_reset_generic()
2884 usec_delay(phy->reset_delay_us); in e1000_phy_hw_reset_generic()
2891 phy->ops.release(hw); in e1000_phy_hw_reset_generic()
2893 return phy->ops.get_cfg_done(hw); in e1000_phy_hw_reset_generic()
2913 * e1000_phy_init_script_igp3 - Inits the IGP3 PHY
2920 DEBUGOUT("Running IGP 3 PHY init script\n"); in e1000_phy_init_script_igp3()
2922 /* PHY init IGP 3 */ in e1000_phy_init_script_igp3()
2924 hw->phy.ops.write_reg(hw, 0x2F5B, 0x9018); in e1000_phy_init_script_igp3()
2926 hw->phy.ops.write_reg(hw, 0x2F52, 0x0000); in e1000_phy_init_script_igp3()
2928 hw->phy.ops.write_reg(hw, 0x2FB1, 0x8B24); in e1000_phy_init_script_igp3()
2930 hw->phy.ops.write_reg(hw, 0x2FB2, 0xF8F0); in e1000_phy_init_script_igp3()
2932 hw->phy.ops.write_reg(hw, 0x2010, 0x10B0); in e1000_phy_init_script_igp3()
2934 hw->phy.ops.write_reg(hw, 0x2011, 0x0000); in e1000_phy_init_script_igp3()
2936 hw->phy.ops.write_reg(hw, 0x20DD, 0x249A); in e1000_phy_init_script_igp3()
2938 hw->phy.ops.write_reg(hw, 0x20DE, 0x00D3); in e1000_phy_init_script_igp3()
2940 hw->phy.ops.write_reg(hw, 0x28B4, 0x04CE); in e1000_phy_init_script_igp3()
2942 hw->phy.ops.write_reg(hw, 0x2F70, 0x29E4); in e1000_phy_init_script_igp3()
2943 /* Force 1000 ( required for enabling PHY regs configuration) */ in e1000_phy_init_script_igp3()
2944 hw->phy.ops.write_reg(hw, 0x0000, 0x0140); in e1000_phy_init_script_igp3()
2946 hw->phy.ops.write_reg(hw, 0x1F30, 0x1606); in e1000_phy_init_script_igp3()
2948 hw->phy.ops.write_reg(hw, 0x1F31, 0xB814); in e1000_phy_init_script_igp3()
2950 hw->phy.ops.write_reg(hw, 0x1F35, 0x002A); in e1000_phy_init_script_igp3()
2952 hw->phy.ops.write_reg(hw, 0x1F3E, 0x0067); in e1000_phy_init_script_igp3()
2954 hw->phy.ops.write_reg(hw, 0x1F54, 0x0065); in e1000_phy_init_script_igp3()
2956 hw->phy.ops.write_reg(hw, 0x1F55, 0x002A); in e1000_phy_init_script_igp3()
2958 hw->phy.ops.write_reg(hw, 0x1F56, 0x002A); in e1000_phy_init_script_igp3()
2960 hw->phy.ops.write_reg(hw, 0x1F72, 0x3FB0); in e1000_phy_init_script_igp3()
2962 hw->phy.ops.write_reg(hw, 0x1F76, 0xC0FF); in e1000_phy_init_script_igp3()
2964 hw->phy.ops.write_reg(hw, 0x1F77, 0x1DEC); in e1000_phy_init_script_igp3()
2966 hw->phy.ops.write_reg(hw, 0x1F78, 0xF9EF); in e1000_phy_init_script_igp3()
2968 hw->phy.ops.write_reg(hw, 0x1F79, 0x0210); in e1000_phy_init_script_igp3()
2970 hw->phy.ops.write_reg(hw, 0x1895, 0x0003); in e1000_phy_init_script_igp3()
2972 hw->phy.ops.write_reg(hw, 0x1796, 0x0008); in e1000_phy_init_script_igp3()
2974 hw->phy.ops.write_reg(hw, 0x1798, 0xD008); in e1000_phy_init_script_igp3()
2978 hw->phy.ops.write_reg(hw, 0x1898, 0xD918); in e1000_phy_init_script_igp3()
2980 hw->phy.ops.write_reg(hw, 0x187A, 0x0800); in e1000_phy_init_script_igp3()
2984 hw->phy.ops.write_reg(hw, 0x0019, 0x008D); in e1000_phy_init_script_igp3()
2986 hw->phy.ops.write_reg(hw, 0x001B, 0x2080); in e1000_phy_init_script_igp3()
2988 hw->phy.ops.write_reg(hw, 0x0014, 0x0045); in e1000_phy_init_script_igp3()
2990 hw->phy.ops.write_reg(hw, 0x0000, 0x1340); in e1000_phy_init_script_igp3()
2996 * e1000_get_phy_type_from_id - Get PHY type from id
2997 * @phy_id: phy_id read from the phy
2999 * Returns the phy type from the id.
3061 * e1000_determine_phy_address - Determines PHY address.
3064 * This uses a trial and error method to loop through possible PHY
3065 * addresses. It tests each by reading the PHY ID registers and
3074 hw->phy.id = phy_type; in e1000_determine_phy_address()
3077 hw->phy.addr = phy_addr; in e1000_determine_phy_address()
3082 phy_type = e1000_get_phy_type_from_id(hw->phy.id); in e1000_determine_phy_address()
3085 * PHY address in e1000_determine_phy_address()
3099 * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address
3103 * Returns the phy address for the page requested.
3116 * e1000_write_phy_reg_bm - Write BM PHY register
3121 * Acquires semaphore, if necessary, then writes the data to PHY register
3131 ret_val = hw->phy.ops.acquire(hw); in e1000_write_phy_reg_bm()
3142 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000_write_phy_reg_bm()
3147 /* Page select is register 31 for phy address 1 and 22 for in e1000_write_phy_reg_bm()
3148 * phy address 2 and 3. Page select is shifted only for in e1000_write_phy_reg_bm()
3149 * phy address 1. in e1000_write_phy_reg_bm()
3151 if (hw->phy.addr == 1) { in e1000_write_phy_reg_bm()
3159 /* Page is shifted left, PHY expects (page x 32) */ in e1000_write_phy_reg_bm()
3170 hw->phy.ops.release(hw); in e1000_write_phy_reg_bm()
3175 * e1000_read_phy_reg_bm - Read BM PHY register
3180 * Acquires semaphore, if necessary, then reads the PHY register at offset
3191 ret_val = hw->phy.ops.acquire(hw); in e1000_read_phy_reg_bm()
3202 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000_read_phy_reg_bm()
3207 /* Page select is register 31 for phy address 1 and 22 for in e1000_read_phy_reg_bm()
3208 * phy address 2 and 3. Page select is shifted only for in e1000_read_phy_reg_bm()
3209 * phy address 1. in e1000_read_phy_reg_bm()
3211 if (hw->phy.addr == 1) { in e1000_read_phy_reg_bm()
3219 /* Page is shifted left, PHY expects (page x 32) */ in e1000_read_phy_reg_bm()
3229 hw->phy.ops.release(hw); in e1000_read_phy_reg_bm()
3234 * e1000_read_phy_reg_bm2 - Read BM PHY register
3239 * Acquires semaphore, if necessary, then reads the PHY register at offset
3250 ret_val = hw->phy.ops.acquire(hw); in e1000_read_phy_reg_bm2()
3261 hw->phy.addr = 1; in e1000_read_phy_reg_bm2()
3264 /* Page is shifted left, PHY expects (page x 32) */ in e1000_read_phy_reg_bm2()
3275 hw->phy.ops.release(hw); in e1000_read_phy_reg_bm2()
3280 * e1000_write_phy_reg_bm2 - Write BM PHY register
3285 * Acquires semaphore, if necessary, then writes the data to PHY register
3295 ret_val = hw->phy.ops.acquire(hw); in e1000_write_phy_reg_bm2()
3306 hw->phy.addr = 1; in e1000_write_phy_reg_bm2()
3309 /* Page is shifted left, PHY expects (page x 32) */ in e1000_write_phy_reg_bm2()
3321 hw->phy.ops.release(hw); in e1000_write_phy_reg_bm2()
3343 /* All page select, port ctrl and wakeup registers use phy address 1 */ in e1000_enable_phy_wakeup_reg_access_bm()
3344 hw->phy.addr = 1; in e1000_enable_phy_wakeup_reg_access_bm()
3355 DEBUGOUT2("Could not read PHY register %d.%d\n", in e1000_enable_phy_wakeup_reg_access_bm()
3360 /* Enable both PHY wakeup mode and Wakeup register page writes. in e1000_enable_phy_wakeup_reg_access_bm()
3361 * Prevent a power state change by disabling ME and Host PHY wakeup. in e1000_enable_phy_wakeup_reg_access_bm()
3369 DEBUGOUT2("Could not write PHY register %d.%d\n", in e1000_enable_phy_wakeup_reg_access_bm()
3410 DEBUGOUT2("Could not restore PHY register %d.%d\n", in e1000_disable_phy_wakeup_reg_access_bm()
3417 * e1000_access_phy_wakeup_reg_bm - Read/write BM PHY wakeup register
3424 * Read the PHY register at offset and store the retrieved information in
3425 * data, or write data to PHY register at offset. Note the procedure to
3426 * access the PHY wakeup registers is different than reading the other PHY
3438 * the PHY page is set to BM_WUC_PAGE (i.e. a function in the call stack
3458 /* Enable access to PHY wakeup registers */ in e1000_access_phy_wakeup_reg_bm()
3461 DEBUGOUT("Could not enable PHY wakeup reg access\n"); in e1000_access_phy_wakeup_reg_bm()
3466 DEBUGOUT2("Accessing PHY page %d reg 0x%x\n", page, reg); in e1000_access_phy_wakeup_reg_bm()
3486 DEBUGOUT2("Could not access PHY reg %d.%d\n", page, reg); in e1000_access_phy_wakeup_reg_bm()
3497 * e1000_power_up_phy_copper - Restore copper link in case of PHY power down
3500 * In the case of a PHY power down to save power, or to turn off link during a
3508 /* The PHY will retain its settings across a power down/up cycle */ in e1000_power_up_phy_copper()
3509 hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); in e1000_power_up_phy_copper()
3511 hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); in e1000_power_up_phy_copper()
3515 * e1000_power_down_phy_copper - Restore copper link in case of PHY power down
3518 * In the case of a PHY power down to save power, or to turn off link during a
3526 /* The PHY will retain its settings across a power down/up cycle */ in e1000_power_down_phy_copper()
3527 hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); in e1000_power_down_phy_copper()
3529 hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); in e1000_power_down_phy_copper()
3534 * __e1000_read_phy_reg_hv - Read HV PHY register
3541 * Acquires semaphore, if necessary, then reads the PHY register at offset
3551 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_read_phy_reg_hv()
3556 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_phy_reg_hv()
3578 /* Page is shifted left, PHY expects (page x 32) */ in __e1000_read_phy_reg_hv()
3582 hw->phy.addr = phy_addr; in __e1000_read_phy_reg_hv()
3589 DEBUGOUT3("reading PHY page %d (or 0x%x shifted) reg 0x%x\n", page, in __e1000_read_phy_reg_hv()
3596 hw->phy.ops.release(hw); in __e1000_read_phy_reg_hv()
3602 * e1000_read_phy_reg_hv - Read HV PHY register
3607 * Acquires semaphore then reads the PHY register at offset and stores
3617 * e1000_read_phy_reg_hv_locked - Read HV PHY register
3622 * Reads the PHY register at offset and stores the retrieved information
3631 * e1000_read_phy_reg_page_hv - Read HV PHY register
3636 * Reads the PHY register at offset and stores the retrieved information
3645 * __e1000_write_phy_reg_hv - Write HV PHY register
3652 * Acquires semaphore, if necessary, then writes the data to PHY register
3661 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_write_phy_reg_hv()
3666 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_phy_reg_hv()
3688 * Power Down (when bit 11 of the PHY Control register is set) in __e1000_write_phy_reg_hv()
3690 if ((hw->phy.type == e1000_phy_82578) && in __e1000_write_phy_reg_hv()
3691 (hw->phy.revision >= 1) && in __e1000_write_phy_reg_hv()
3692 (hw->phy.addr == 2) && in __e1000_write_phy_reg_hv()
3704 /* Page is shifted left, PHY expects (page x 32) */ in __e1000_write_phy_reg_hv()
3708 hw->phy.addr = phy_addr; in __e1000_write_phy_reg_hv()
3715 DEBUGOUT3("writing PHY page %d (or 0x%x shifted) reg 0x%x\n", page, in __e1000_write_phy_reg_hv()
3723 hw->phy.ops.release(hw); in __e1000_write_phy_reg_hv()
3729 * e1000_write_phy_reg_hv - Write HV PHY register
3734 * Acquires semaphore then writes the data to PHY register at the offset.
3743 * e1000_write_phy_reg_hv_locked - Write HV PHY register
3748 * Writes the data to PHY register at the offset. Assumes semaphore
3757 * e1000_write_phy_reg_page_hv - Write HV PHY register
3762 * Writes the data to PHY register at the offset. Assumes semaphore
3771 * e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page
3785 * e1000_access_phy_debug_regs_hv - Read HV PHY vendor specific high registers
3791 * Reads the PHY register at offset and stores the retreived information
3794 * These accesses done with PHY address 2 and without using pages.
3805 /* This takes care of the difference with desktop vs mobile phy */ in e1000_access_phy_debug_regs_hv()
3806 addr_reg = ((hw->phy.type == e1000_phy_82578) ? in e1000_access_phy_debug_regs_hv()
3810 /* All operations in this function are phy address 2 */ in e1000_access_phy_debug_regs_hv()
3811 hw->phy.addr = 2; in e1000_access_phy_debug_regs_hv()
3837 * a link up indication before the PHY does. If small packets are sent
3839 * being properly accounted for by the PHY and will stall preventing
3841 * packet buffer after the PHY detects link up.
3850 if (hw->phy.type != e1000_phy_82578) in e1000_link_stall_workaround_hv()
3853 /* Do not apply workaround if in PHY loopback bit 14 set */ in e1000_link_stall_workaround_hv()
3854 hw->phy.ops.read_reg(hw, PHY_CONTROL, &data); in e1000_link_stall_workaround_hv()
3859 ret_val = hw->phy.ops.read_reg(hw, BM_CS_STATUS, &data); in e1000_link_stall_workaround_hv()
3873 ret_val = hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, in e1000_link_stall_workaround_hv()
3879 return hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, in e1000_link_stall_workaround_hv()
3889 * Polarity is determined based on the PHY specific status register.
3893 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_82577() local
3899 ret_val = phy->ops.read_reg(hw, I82577_PHY_STATUS_2, &data); in e1000_check_polarity_82577()
3902 phy->cable_polarity = ((data & I82577_PHY_STATUS2_REV_POLARITY) in e1000_check_polarity_82577()
3910 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY
3913 * Calls the PHY setup function to force speed and duplex.
3917 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_82577() local
3924 ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); in e1000_phy_force_speed_duplex_82577()
3930 ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); in e1000_phy_force_speed_duplex_82577()
3936 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_82577()
3937 DEBUGOUT("Waiting for forced speed/duplex link on 82577 phy\n"); in e1000_phy_force_speed_duplex_82577()
3956 * e1000_get_phy_info_82577 - Retrieve I82577 PHY information
3959 * Read PHY status to determine if link is up. If link is up, then
3961 * PHY port status to determine MDI/MDIx and speed. Based on the speed,
3966 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_82577() local
3978 DEBUGOUT("Phy info is only valid if link is up\n"); in e1000_get_phy_info_82577()
3982 phy->polarity_correction = true; in e1000_get_phy_info_82577()
3988 ret_val = phy->ops.read_reg(hw, I82577_PHY_STATUS_2, &data); in e1000_get_phy_info_82577()
3992 phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX); in e1000_get_phy_info_82577()
3996 ret_val = hw->phy.ops.get_cable_length(hw); in e1000_get_phy_info_82577()
4000 ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data); in e1000_get_phy_info_82577()
4004 phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS) in e1000_get_phy_info_82577()
4008 phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS) in e1000_get_phy_info_82577()
4012 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_82577()
4013 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
4014 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
4021 * e1000_get_cable_length_82577 - Determine cable length for 82577 PHY
4029 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_82577() local
4035 ret_val = phy->ops.read_reg(hw, I82577_PHY_DIAG_STATUS, &phy_data); in e1000_get_cable_length_82577()
4045 phy->cable_length = length; in e1000_get_cable_length_82577()
4051 * e1000_write_phy_reg_gs40g - Write GS40G PHY register
4056 * Acquires semaphore, if necessary, then writes the data to PHY register
4067 ret_val = hw->phy.ops.acquire(hw); in e1000_write_phy_reg_gs40g()
4077 hw->phy.ops.release(hw); in e1000_write_phy_reg_gs40g()
4082 * e1000_read_phy_reg_gs40g - Read GS40G PHY register
4088 * Acquires semaphore, if necessary, then reads the data in the PHY register
4099 ret_val = hw->phy.ops.acquire(hw); in e1000_read_phy_reg_gs40g()
4109 hw->phy.ops.release(hw); in e1000_read_phy_reg_gs40g()
4119 * Reads the mPHY control register in the PHY at offset and stores the
4263 DEBUGOUT("ERROR READING mPHY control register, phy is busy.\n"); in e1000_is_mphy_ready()
4283 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); in __e1000_access_xmdio_reg()
4287 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address); in __e1000_access_xmdio_reg()
4291 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA | in __e1000_access_xmdio_reg()
4297 ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data); in __e1000_access_xmdio_reg()
4299 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data); in __e1000_access_xmdio_reg()
4304 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0); in __e1000_access_xmdio_reg()