Lines Matching +full:bias +full:- +full:ctrl +full:- +full:value
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
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
111 * e1000e_read_phy_reg_mdic - Read MDI control register
121 struct e1000_phy_info *phy = &hw->phy; in e1000e_read_phy_reg_mdic()
126 return -E1000_ERR_PARAM; in e1000e_read_phy_reg_mdic()
129 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_read_phy_reg_mdic()
134 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_read_phy_reg_mdic()
151 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
155 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
158 e_dbg("MDI Read offset error - requested %d, returned %d\n", in e1000e_read_phy_reg_mdic()
160 return -E1000_ERR_PHY; in e1000e_read_phy_reg_mdic()
167 if (hw->mac.type == e1000_pch2lan) in e1000e_read_phy_reg_mdic()
173 * e1000e_write_phy_reg_mdic - Write MDI control register
182 struct e1000_phy_info *phy = &hw->phy; in e1000e_write_phy_reg_mdic()
187 return -E1000_ERR_PARAM; in e1000e_write_phy_reg_mdic()
190 /* Set up Op-code, Phy Address, and register offset in the MDI in e1000e_write_phy_reg_mdic()
196 (phy->addr << E1000_MDIC_PHY_SHIFT) | in e1000e_write_phy_reg_mdic()
213 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
217 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
220 e_dbg("MDI Write offset error - requested %d, returned %d\n", in e1000e_write_phy_reg_mdic()
222 return -E1000_ERR_PHY; in e1000e_write_phy_reg_mdic()
228 if (hw->mac.type == e1000_pch2lan) in e1000e_write_phy_reg_mdic()
235 * e1000e_read_phy_reg_m88 - Read m88 PHY register
248 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_m88()
255 hw->phy.ops.release(hw); in e1000e_read_phy_reg_m88()
261 * e1000e_write_phy_reg_m88 - Write m88 PHY register
273 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_m88()
280 hw->phy.ops.release(hw); in e1000e_write_phy_reg_m88()
286 * e1000_set_page_igp - Set page as on IGP-like PHY(s)
298 hw->phy.addr = 1; in e1000_set_page_igp()
304 * __e1000e_read_phy_reg_igp - Read igp PHY register
320 if (!hw->phy.ops.acquire) in __e1000e_read_phy_reg_igp()
323 ret_val = hw->phy.ops.acquire(hw); in __e1000e_read_phy_reg_igp()
337 hw->phy.ops.release(hw); in __e1000e_read_phy_reg_igp()
343 * e1000e_read_phy_reg_igp - Read igp PHY register
358 * e1000e_read_phy_reg_igp_locked - Read igp PHY register
372 * __e1000e_write_phy_reg_igp - Write igp PHY register
387 if (!hw->phy.ops.acquire) in __e1000e_write_phy_reg_igp()
390 ret_val = hw->phy.ops.acquire(hw); in __e1000e_write_phy_reg_igp()
403 hw->phy.ops.release(hw); in __e1000e_write_phy_reg_igp()
409 * e1000e_write_phy_reg_igp - Write igp PHY register
423 * e1000e_write_phy_reg_igp_locked - Write igp PHY register
437 * __e1000_read_kmrn_reg - Read kumeran register
455 if (!hw->phy.ops.acquire) in __e1000_read_kmrn_reg()
458 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_kmrn_reg()
474 hw->phy.ops.release(hw); in __e1000_read_kmrn_reg()
480 * e1000e_read_kmrn_reg - Read kumeran register
495 * e1000e_read_kmrn_reg_locked - Read kumeran register
510 * __e1000_write_kmrn_reg - Write kumeran register
528 if (!hw->phy.ops.acquire) in __e1000_write_kmrn_reg()
531 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_kmrn_reg()
543 hw->phy.ops.release(hw); in __e1000_write_kmrn_reg()
549 * e1000e_write_kmrn_reg - Write kumeran register
563 * e1000e_write_kmrn_reg_locked - Write kumeran register
577 * e1000_set_master_slave_mode - Setup PHY for Master/slave mode
593 hw->phy.original_ms_type = (phy_data & CTL1000_ENABLE_MASTER) ? in e1000_set_master_slave_mode()
597 switch (hw->phy.ms_type) { in e1000_set_master_slave_mode()
616 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
619 * Sets up Carrier-sense on Transmit and downshift values.
626 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000_copper_link_setup_82577()
646 * 0 - Auto (default) in e1000_copper_link_setup_82577()
647 * 1 - MDI mode in e1000_copper_link_setup_82577()
648 * 2 - MDI-X mode in e1000_copper_link_setup_82577()
650 switch (hw->phy.mdix) { in e1000_copper_link_setup_82577()
669 * e1000e_copper_link_setup_m88 - Setup m88 PHY's for copper link
672 * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
677 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_m88()
681 /* Enable CRS on Tx. This must be set for half-duplex operation. */ in e1000e_copper_link_setup_m88()
687 if (phy->type != e1000_phy_bm) in e1000e_copper_link_setup_m88()
691 * MDI/MDI-X = 0 (default) in e1000e_copper_link_setup_m88()
692 * 0 - Auto for all speeds in e1000e_copper_link_setup_m88()
693 * 1 - MDI mode in e1000e_copper_link_setup_m88()
694 * 2 - MDI-X mode in e1000e_copper_link_setup_m88()
695 * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) in e1000e_copper_link_setup_m88()
699 switch (phy->mdix) { in e1000e_copper_link_setup_m88()
718 * 0 - Disabled in e1000e_copper_link_setup_m88()
719 * 1 - Enabled in e1000e_copper_link_setup_m88()
722 if (phy->disable_polarity_correction) in e1000e_copper_link_setup_m88()
726 if (phy->type == e1000_phy_bm) { in e1000e_copper_link_setup_m88()
728 if (phy->id == BME1000_E_PHY_ID_R2) { in e1000e_copper_link_setup_m88()
735 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
749 if ((phy->type == e1000_phy_m88) && in e1000e_copper_link_setup_m88()
750 (phy->revision < E1000_REVISION_4) && in e1000e_copper_link_setup_m88()
751 (phy->id != BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
761 if ((phy->revision == 2) && (phy->id == M88E1111_I_PHY_ID)) { in e1000e_copper_link_setup_m88()
762 /* 82573L PHY - set the downshift counter to 5x. */ in e1000e_copper_link_setup_m88()
777 if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) { in e1000e_copper_link_setup_m88()
790 if (phy->ops.commit) { in e1000e_copper_link_setup_m88()
791 ret_val = phy->ops.commit(hw); in e1000e_copper_link_setup_m88()
798 if (phy->type == e1000_phy_82578) { in e1000e_copper_link_setup_m88()
803 /* 82578 PHY - set the downshift count to 1x. */ in e1000e_copper_link_setup_m88()
815 * e1000e_copper_link_setup_igp - Setup igp PHY's for copper link
818 * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
823 struct e1000_phy_info *phy = &hw->phy; in e1000e_copper_link_setup_igp()
839 if (hw->phy.ops.set_d0_lplu_state) { in e1000e_copper_link_setup_igp()
840 ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); in e1000e_copper_link_setup_igp()
846 /* Configure mdi-mdix settings */ in e1000e_copper_link_setup_igp()
853 switch (phy->mdix) { in e1000e_copper_link_setup_igp()
869 /* set auto-master slave resolution settings */ in e1000e_copper_link_setup_igp()
870 if (hw->mac.autoneg) { in e1000e_copper_link_setup_igp()
875 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000e_copper_link_setup_igp()
906 * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation
909 * Reads the MII auto-neg advertisement register and/or the 1000T control
910 * register and if the PHY is already setup for auto-negotiation, then
912 * the appropriate values for the wanted auto-negotiation.
916 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_setup_autoneg()
921 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_phy_setup_autoneg()
923 /* Read the MII Auto-Neg Advertisement Register (Address 4). */ in e1000_phy_setup_autoneg()
928 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
929 /* Read the MII 1000Base-T Control Register (Address 9). */ in e1000_phy_setup_autoneg()
942 /* First we clear all the 10/100 mb speed bits in the Auto-Neg in e1000_phy_setup_autoneg()
944 * the 1000Base-T Control Register (Address 9). in e1000_phy_setup_autoneg()
951 e_dbg("autoneg_advertised %x\n", phy->autoneg_advertised); in e1000_phy_setup_autoneg()
954 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
960 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
966 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
972 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
978 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in e1000_phy_setup_autoneg()
982 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
989 * auto-negotiation is enabled, then software will have to set the in e1000_phy_setup_autoneg()
990 * "PAUSE" bits to the correct value in the Auto-Negotiation in e1000_phy_setup_autoneg()
991 * Advertisement Register (MII_ADVERTISE) and re-start auto- in e1000_phy_setup_autoneg()
1004 switch (hw->fc.current_mode) { in e1000_phy_setup_autoneg()
1007 * software over-ride. in e1000_phy_setup_autoneg()
1011 phy->autoneg_advertised &= in e1000_phy_setup_autoneg()
1016 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1026 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1031 * disabled, by a software over-ride. in e1000_phy_setup_autoneg()
1035 phy->autoneg_advertised |= ADVERTISED_Asym_Pause; in e1000_phy_setup_autoneg()
1036 phy->autoneg_advertised &= ~ADVERTISED_Pause; in e1000_phy_setup_autoneg()
1040 * over-ride. in e1000_phy_setup_autoneg()
1044 phy->autoneg_advertised |= in e1000_phy_setup_autoneg()
1049 return -E1000_ERR_CONFIG; in e1000_phy_setup_autoneg()
1056 e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1058 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in e1000_phy_setup_autoneg()
1065 * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link
1075 struct e1000_phy_info *phy = &hw->phy; in e1000_copper_link_autoneg()
1082 phy->autoneg_advertised &= phy->autoneg_mask; in e1000_copper_link_autoneg()
1087 if (!phy->autoneg_advertised) in e1000_copper_link_autoneg()
1088 phy->autoneg_advertised = phy->autoneg_mask; in e1000_copper_link_autoneg()
1090 e_dbg("Reconfiguring auto-neg advertisement params\n"); in e1000_copper_link_autoneg()
1093 e_dbg("Error Setting up Auto-Negotiation\n"); in e1000_copper_link_autoneg()
1096 e_dbg("Restarting Auto-Neg\n"); in e1000_copper_link_autoneg()
1098 /* Restart auto-negotiation by setting the Auto Neg Enable bit and in e1000_copper_link_autoneg()
1110 /* Does the user want to wait for Auto-Neg to complete here, or in e1000_copper_link_autoneg()
1113 if (phy->autoneg_wait_to_complete) { in e1000_copper_link_autoneg()
1121 hw->mac.get_link_status = true; in e1000_copper_link_autoneg()
1127 * e1000e_setup_copper_link - Configure copper link settings
1130 * Calls the appropriate function to configure the link for auto-neg or forced
1133 * not established, we return -E1000_ERR_PHY (-2).
1140 if (hw->mac.autoneg) { in e1000e_setup_copper_link()
1152 ret_val = hw->phy.ops.force_speed_duplex(hw); in e1000e_setup_copper_link()
1169 hw->mac.ops.config_collision_dist(hw); in e1000e_setup_copper_link()
1179 * e1000e_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
1183 * auto-crossover to force MDI manually. Waits for link and returns
1184 * successful if link up is successful, else -E1000_ERR_PHY (-2).
1188 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_igp()
1203 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI in e1000e_phy_force_speed_duplex_igp()
1221 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_igp()
1241 * e1000e_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
1245 * auto-crossover to force MDI manually. Resets the PHY to commit the
1252 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_force_speed_duplex_m88()
1257 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI in e1000e_phy_force_speed_duplex_m88()
1282 if (hw->phy.ops.commit) { in e1000e_phy_force_speed_duplex_m88()
1283 ret_val = hw->phy.ops.commit(hw); in e1000e_phy_force_speed_duplex_m88()
1288 if (phy->autoneg_wait_to_complete) { in e1000e_phy_force_speed_duplex_m88()
1297 if (hw->phy.type != e1000_phy_m88) { in e1000e_phy_force_speed_duplex_m88()
1320 if (hw->phy.type != e1000_phy_m88) in e1000e_phy_force_speed_duplex_m88()
1327 /* Resetting the phy means we need to re-force TX_CLK in the in e1000e_phy_force_speed_duplex_m88()
1329 * the reset value of 2.5MHz. in e1000e_phy_force_speed_duplex_m88()
1336 /* In addition, we must re-enable CRS on Tx for both half and full in e1000e_phy_force_speed_duplex_m88()
1350 * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex
1359 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_ife()
1374 /* Disable MDI-X support for 10/100 */ in e1000_phy_force_speed_duplex_ife()
1390 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_ife()
1412 * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
1414 * @phy_ctrl: pointer to current value of MII_BMCR
1418 * disable auto-negotiation, configure duplex, configure speed, configure
1419 * the collision distance, write configuration to CTRL register. The
1425 struct e1000_mac_info *mac = &hw->mac; in e1000e_phy_force_speed_duplex_setup()
1426 u32 ctrl; in e1000e_phy_force_speed_duplex_setup() local
1429 hw->fc.current_mode = e1000_fc_none; in e1000e_phy_force_speed_duplex_setup()
1432 ctrl = er32(CTRL); in e1000e_phy_force_speed_duplex_setup()
1433 ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); in e1000e_phy_force_speed_duplex_setup()
1434 ctrl &= ~E1000_CTRL_SPD_SEL; in e1000e_phy_force_speed_duplex_setup()
1437 ctrl &= ~E1000_CTRL_ASDE; in e1000e_phy_force_speed_duplex_setup()
1443 if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) { in e1000e_phy_force_speed_duplex_setup()
1444 ctrl &= ~E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1448 ctrl |= E1000_CTRL_FD; in e1000e_phy_force_speed_duplex_setup()
1454 if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) { in e1000e_phy_force_speed_duplex_setup()
1455 ctrl |= E1000_CTRL_SPD_100; in e1000e_phy_force_speed_duplex_setup()
1460 ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); in e1000e_phy_force_speed_duplex_setup()
1465 hw->mac.ops.config_collision_dist(hw); in e1000e_phy_force_speed_duplex_setup()
1467 ew32(CTRL, ctrl); in e1000e_phy_force_speed_duplex_setup()
1471 * e1000e_set_d3_lplu_state - Sets low power link up state for D3
1486 struct e1000_phy_info *phy = &hw->phy; in e1000e_set_d3_lplu_state()
1504 if (phy->smart_speed == e1000_smart_speed_on) { in e1000e_set_d3_lplu_state()
1515 } else if (phy->smart_speed == e1000_smart_speed_off) { in e1000e_set_d3_lplu_state()
1527 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in e1000e_set_d3_lplu_state()
1528 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || in e1000e_set_d3_lplu_state()
1529 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { in e1000e_set_d3_lplu_state()
1548 * e1000e_check_downshift - Checks whether a downshift in speed occurred
1557 struct e1000_phy_info *phy = &hw->phy; in e1000e_check_downshift()
1561 switch (phy->type) { in e1000e_check_downshift()
1576 phy->speed_downgraded = false; in e1000e_check_downshift()
1583 phy->speed_downgraded = !!(phy_data & mask); in e1000e_check_downshift()
1589 * e1000_check_polarity_m88 - Checks the polarity.
1592 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1598 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_m88()
1605 phy->cable_polarity = ((data & M88E1000_PSSR_REV_POLARITY) in e1000_check_polarity_m88()
1613 * e1000_check_polarity_igp - Checks the polarity.
1616 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1623 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_igp()
1649 phy->cable_polarity = ((data & mask) in e1000_check_polarity_igp()
1657 * e1000_check_polarity_ife - Check cable polarity for IFE PHY
1664 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_ife()
1670 if (phy->polarity_correction) { in e1000_check_polarity_ife()
1681 phy->cable_polarity = ((phy_data & mask) in e1000_check_polarity_ife()
1689 * e1000_wait_autoneg - Wait for auto-neg completion
1692 * Waits for auto-negotiation to complete or for the auto-negotiation time
1701 for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { in e1000_wait_autoneg()
1713 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation in e1000_wait_autoneg()
1720 * e1000e_phy_has_link_generic - Polls PHY for link
1768 * e1000e_get_cable_length_m88 - Determine cable length for m88 PHY
1775 * Register Value Cable Length
1777 * 1 50 - 80 meters
1778 * 2 80 - 110 meters
1779 * 3 110 - 140 meters
1784 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_m88()
1794 if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) in e1000e_get_cable_length_m88()
1795 return -E1000_ERR_PHY; in e1000e_get_cable_length_m88()
1797 phy->min_cable_length = e1000_m88_cable_length_table[index]; in e1000e_get_cable_length_m88()
1798 phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; in e1000e_get_cable_length_m88()
1800 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_m88()
1806 * e1000e_get_cable_length_igp_2 - Determine cable length for igp2 PHY
1812 * combination of coarse and fine gain value, the value can be put
1818 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_cable_length_igp_2()
1822 u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1; in e1000e_get_cable_length_igp_2()
1847 return -E1000_ERR_PHY; in e1000e_get_cable_length_igp_2()
1860 agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + in e1000e_get_cable_length_igp_2()
1862 agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); in e1000e_get_cable_length_igp_2()
1864 /* Calculate cable length with the error range of +/- 10 meters. */ in e1000e_get_cable_length_igp_2()
1865 phy->min_cable_length = (((agc_value - IGP02E1000_AGC_RANGE) > 0) ? in e1000e_get_cable_length_igp_2()
1866 (agc_value - IGP02E1000_AGC_RANGE) : 0); in e1000e_get_cable_length_igp_2()
1867 phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE; in e1000e_get_cable_length_igp_2()
1869 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; in e1000e_get_cable_length_igp_2()
1875 * e1000e_get_phy_info_m88 - Retrieve PHY information
1880 * determine the polarity and 10base-T extended distance. Read the PHY
1886 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_m88()
1891 if (phy->media_type != e1000_media_type_copper) { in e1000e_get_phy_info_m88()
1893 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1902 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_m88()
1909 phy->polarity_correction = !!(phy_data & in e1000e_get_phy_info_m88()
1920 phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX); in e1000e_get_phy_info_m88()
1923 ret_val = hw->phy.ops.get_cable_length(hw); in e1000e_get_phy_info_m88()
1931 phy->local_rx = (phy_data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_m88()
1934 phy->remote_rx = (phy_data & LPA_1000REMRXOK) in e1000e_get_phy_info_m88()
1938 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_m88()
1939 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1940 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_m88()
1947 * e1000e_get_phy_info_igp - Retrieve igp PHY information
1951 * set/determine 10base-T extended distance and polarity correction. Read
1957 struct e1000_phy_info *phy = &hw->phy; in e1000e_get_phy_info_igp()
1968 return -E1000_ERR_CONFIG; in e1000e_get_phy_info_igp()
1971 phy->polarity_correction = true; in e1000e_get_phy_info_igp()
1981 phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX); in e1000e_get_phy_info_igp()
1985 ret_val = phy->ops.get_cable_length(hw); in e1000e_get_phy_info_igp()
1993 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000e_get_phy_info_igp()
1996 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000e_get_phy_info_igp()
1999 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000e_get_phy_info_igp()
2000 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2001 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000e_get_phy_info_igp()
2008 * e1000_get_phy_info_ife - Retrieves various IFE PHY states
2015 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_ife()
2026 return -E1000_ERR_CONFIG; in e1000_get_phy_info_ife()
2032 phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE); in e1000_get_phy_info_ife()
2034 if (phy->polarity_correction) { in e1000_get_phy_info_ife()
2040 phy->cable_polarity = ((data & IFE_PSC_FORCE_POLARITY) in e1000_get_phy_info_ife()
2049 phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS); in e1000_get_phy_info_ife()
2052 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_ife()
2053 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2054 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_ife()
2060 * e1000e_phy_sw_reset - PHY software reset
2086 * e1000e_phy_hw_reset_generic - PHY hardware reset
2096 struct e1000_phy_info *phy = &hw->phy; in e1000e_phy_hw_reset_generic()
2098 u32 ctrl; in e1000e_phy_hw_reset_generic() local
2100 if (phy->ops.check_reset_block) { in e1000e_phy_hw_reset_generic()
2101 ret_val = phy->ops.check_reset_block(hw); in e1000e_phy_hw_reset_generic()
2106 ret_val = phy->ops.acquire(hw); in e1000e_phy_hw_reset_generic()
2110 ctrl = er32(CTRL); in e1000e_phy_hw_reset_generic()
2111 ew32(CTRL, ctrl | E1000_CTRL_PHY_RST); in e1000e_phy_hw_reset_generic()
2114 udelay(phy->reset_delay_us); in e1000e_phy_hw_reset_generic()
2116 ew32(CTRL, ctrl); in e1000e_phy_hw_reset_generic()
2121 phy->ops.release(hw); in e1000e_phy_hw_reset_generic()
2123 return phy->ops.get_cfg_done(hw); in e1000e_phy_hw_reset_generic()
2127 * e1000e_get_cfg_done_generic - Generic configuration done
2130 * Generic function to wait 10 milli-seconds for configuration to complete
2141 * e1000e_phy_init_script_igp3 - Inits the IGP3 PHY
2151 /* Enable rise/fall, 10-mode work in class-A */ in e1000e_phy_init_script_igp3()
2155 /* Bias trimming for ADC, AFE and Driver (Default) */ in e1000e_phy_init_script_igp3()
2157 /* Increase Hybrid poly bias */ in e1000e_phy_init_script_igp3()
2209 /* Enable LPLU and disable AN to 1000 in non-D0a states, in e1000e_phy_init_script_igp3()
2224 * e1000e_get_phy_type_from_id - Get PHY type from id
2278 * e1000e_determine_phy_address - Determines PHY address.
2291 hw->phy.id = phy_type; in e1000e_determine_phy_address()
2294 hw->phy.addr = phy_addr; in e1000e_determine_phy_address()
2299 phy_type = e1000e_get_phy_type_from_id(hw->phy.id); in e1000e_determine_phy_address()
2301 /* If phy_type is valid, break - we found our in e1000e_determine_phy_address()
2312 return -E1000_ERR_PHY_TYPE; in e1000e_determine_phy_address()
2316 * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address
2333 * e1000e_write_phy_reg_bm - Write BM PHY register
2346 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm()
2357 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_write_phy_reg_bm()
2366 if (hw->phy.addr == 1) { in e1000e_write_phy_reg_bm()
2385 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm()
2390 * e1000e_read_phy_reg_bm - Read BM PHY register
2404 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm()
2415 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); in e1000e_read_phy_reg_bm()
2424 if (hw->phy.addr == 1) { in e1000e_read_phy_reg_bm()
2442 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm()
2447 * e1000e_read_phy_reg_bm2 - Read BM PHY register
2461 ret_val = hw->phy.ops.acquire(hw); in e1000e_read_phy_reg_bm2()
2472 hw->phy.addr = 1; in e1000e_read_phy_reg_bm2()
2486 hw->phy.ops.release(hw); in e1000e_read_phy_reg_bm2()
2491 * e1000e_write_phy_reg_bm2 - Write BM PHY register
2504 ret_val = hw->phy.ops.acquire(hw); in e1000e_write_phy_reg_bm2()
2515 hw->phy.addr = 1; in e1000e_write_phy_reg_bm2()
2530 hw->phy.ops.release(hw); in e1000e_write_phy_reg_bm2()
2535 * e1000_enable_phy_wakeup_reg_access_bm - enable access to BM wakeup registers
2547 /* All page select, port ctrl and wakeup registers use phy address 1 */ in e1000_enable_phy_wakeup_reg_access_bm()
2548 hw->phy.addr = 1; in e1000_enable_phy_wakeup_reg_access_bm()
2578 /* Select Host Wakeup Registers page - caller now able to write in e1000_enable_phy_wakeup_reg_access_bm()
2585 * e1000_disable_phy_wakeup_reg_access_bm - disable access to BM wakeup regs
2589 * Restore BM_WUC_ENABLE_REG to its original value.
2606 /* Restore 769.17 to its original value */ in e1000_disable_phy_wakeup_reg_access_bm()
2616 * e1000_access_phy_wakeup_reg_bm - Read/write BM PHY wakeup register
2631 * 5) Restore 769.17.2 to its original value
2649 if ((hw->mac.type == e1000_pchlan) && in e1000_access_phy_wakeup_reg_bm()
2665 /* Write the Wakeup register page offset value using opcode 0x11 */ in e1000_access_phy_wakeup_reg_bm()
2673 /* Read the Wakeup register page value using opcode 0x12 */ in e1000_access_phy_wakeup_reg_bm()
2677 /* Write the Wakeup register page value using opcode 0x12 */ in e1000_access_phy_wakeup_reg_bm()
2694 * e1000_power_up_phy_copper - Restore copper link in case of PHY power down
2717 * e1000_power_down_phy_copper - Restore copper link in case of PHY power down
2741 * __e1000_read_phy_reg_hv - Read HV PHY register
2758 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_read_phy_reg_hv()
2761 ret_val = hw->phy.ops.acquire(hw); in __e1000_read_phy_reg_hv()
2788 hw->phy.addr = phy_addr; in __e1000_read_phy_reg_hv()
2801 hw->phy.ops.release(hw); in __e1000_read_phy_reg_hv()
2807 * e1000_read_phy_reg_hv - Read HV PHY register
2822 * e1000_read_phy_reg_hv_locked - Read HV PHY register
2836 * e1000_read_phy_reg_page_hv - Read HV PHY register
2850 * __e1000_write_phy_reg_hv - Write HV PHY register
2866 u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); in __e1000_write_phy_reg_hv()
2869 ret_val = hw->phy.ops.acquire(hw); in __e1000_write_phy_reg_hv()
2894 if ((hw->phy.type == e1000_phy_82578) && in __e1000_write_phy_reg_hv()
2895 (hw->phy.revision >= 1) && in __e1000_write_phy_reg_hv()
2896 (hw->phy.addr == 2) && in __e1000_write_phy_reg_hv()
2912 hw->phy.addr = phy_addr; in __e1000_write_phy_reg_hv()
2927 hw->phy.ops.release(hw); in __e1000_write_phy_reg_hv()
2933 * e1000_write_phy_reg_hv - Write HV PHY register
2947 * e1000_write_phy_reg_hv_locked - Write HV PHY register
2961 * e1000_write_phy_reg_page_hv - Write HV PHY register
2975 * e1000_get_phy_addr_for_hv_page - Get PHY address based on page
2989 * e1000_access_phy_debug_regs_hv - Read HV PHY vendor specific high registers
3008 addr_reg = ((hw->phy.type == e1000_phy_82578) ? in e1000_access_phy_debug_regs_hv()
3013 hw->phy.addr = 2; in e1000_access_phy_debug_regs_hv()
3022 /* Read or write the data value next */ in e1000_access_phy_debug_regs_hv()
3035 * e1000_link_stall_workaround_hv - Si workaround
3050 if (hw->phy.type != e1000_phy_82578) in e1000_link_stall_workaround_hv()
3087 * e1000_check_polarity_82577 - Checks the polarity.
3090 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
3096 struct e1000_phy_info *phy = &hw->phy; in e1000_check_polarity_82577()
3103 phy->cable_polarity = ((data & I82577_PHY_STATUS2_REV_POLARITY) in e1000_check_polarity_82577()
3111 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY
3118 struct e1000_phy_info *phy = &hw->phy; in e1000_phy_force_speed_duplex_82577()
3135 if (phy->autoneg_wait_to_complete) { in e1000_phy_force_speed_duplex_82577()
3155 * e1000_get_phy_info_82577 - Retrieve I82577 PHY information
3159 * set/determine 10base-T extended distance and polarity correction. Read
3165 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_info_82577()
3176 return -E1000_ERR_CONFIG; in e1000_get_phy_info_82577()
3179 phy->polarity_correction = true; in e1000_get_phy_info_82577()
3189 phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX); in e1000_get_phy_info_82577()
3193 ret_val = hw->phy.ops.get_cable_length(hw); in e1000_get_phy_info_82577()
3201 phy->local_rx = (data & LPA_1000LOCALRXOK) in e1000_get_phy_info_82577()
3204 phy->remote_rx = (data & LPA_1000REMRXOK) in e1000_get_phy_info_82577()
3207 phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; in e1000_get_phy_info_82577()
3208 phy->local_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3209 phy->remote_rx = e1000_1000t_rx_status_undefined; in e1000_get_phy_info_82577()
3216 * e1000_get_cable_length_82577 - Determine cable length for 82577 PHY
3224 struct e1000_phy_info *phy = &hw->phy; in e1000_get_cable_length_82577()
3235 return -E1000_ERR_PHY; in e1000_get_cable_length_82577()
3237 phy->cable_length = length; in e1000_get_cable_length_82577()