Lines Matching +full:full +full:- +full:duplex

1 // SPDX-License-Identifier: GPL-2.0
7 * igc_check_reset_block - Check if PHY reset is blocked
25 * igc_get_phy_id - Retrieve the PHY ID and revision
33 struct igc_phy_info *phy = &hw->phy; in igc_get_phy_id()
37 ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); in igc_get_phy_id()
41 phy->id = (u32)(phy_id << 16); in igc_get_phy_id()
43 ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); in igc_get_phy_id()
47 phy->id |= (u32)(phy_id & PHY_REVISION_MASK); in igc_get_phy_id()
48 phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); in igc_get_phy_id()
55 * igc_phy_has_link - Polls PHY for link
74 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_phy_has_link()
85 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_phy_has_link()
102 * igc_power_up_phy_copper - Restore copper link in case of PHY power down
113 hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); in igc_power_up_phy_copper()
115 hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); in igc_power_up_phy_copper()
119 * igc_power_down_phy_copper - Power down copper PHY
130 hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); in igc_power_down_phy_copper()
133 /* Temporary workaround - should be removed when PHY will implement in igc_power_down_phy_copper()
136 /* hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);*/ in igc_power_down_phy_copper()
141 * igc_check_downshift - Checks whether a downshift in speed occurred
150 struct igc_phy_info *phy = &hw->phy; in igc_check_downshift()
153 switch (phy->type) { in igc_check_downshift()
157 phy->speed_downgraded = false; in igc_check_downshift()
165 * igc_phy_hw_reset - PHY hardware reset
175 struct igc_phy_info *phy = &hw->phy; in igc_phy_hw_reset()
185 ret_val = phy->ops.acquire(hw); in igc_phy_hw_reset()
193 udelay(phy->reset_delay_us); in igc_phy_hw_reset()
200 phy->ops.release(hw); in igc_phy_hw_reset()
207 * igc_phy_setup_autoneg - Configure PHY for auto-negotiation
210 * Reads the MII auto-neg advertisement register and/or the 1000T control
211 * register and if the PHY is already setup for auto-negotiation, then
213 * the appropriate values for the wanted auto-negotiation.
217 struct igc_phy_info *phy = &hw->phy; in igc_phy_setup_autoneg()
223 phy->autoneg_advertised &= phy->autoneg_mask; in igc_phy_setup_autoneg()
225 /* Read the MII Auto-Neg Advertisement Register (Address 4). */ in igc_phy_setup_autoneg()
226 ret_val = phy->ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); in igc_phy_setup_autoneg()
230 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in igc_phy_setup_autoneg()
231 /* Read the MII 1000Base-T Control Register (Address 9). */ in igc_phy_setup_autoneg()
232 ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, in igc_phy_setup_autoneg()
238 if ((phy->autoneg_mask & ADVERTISE_2500_FULL) && in igc_phy_setup_autoneg()
239 hw->phy.id == I225_I_PHY_ID) { in igc_phy_setup_autoneg()
240 /* Read the MULTI GBT AN Control Register - reg 7.32 */ in igc_phy_setup_autoneg()
241 ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK << in igc_phy_setup_autoneg()
257 /* First we clear all the 10/100 mb speed bits in the Auto-Neg in igc_phy_setup_autoneg()
259 * the 1000Base-T Control Register (Address 9). in igc_phy_setup_autoneg()
267 hw_dbg("autoneg_advertised %x\n", phy->autoneg_advertised); in igc_phy_setup_autoneg()
269 /* Do we want to advertise 10 Mb Half Duplex? */ in igc_phy_setup_autoneg()
270 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in igc_phy_setup_autoneg()
271 hw_dbg("Advertise 10mb Half duplex\n"); in igc_phy_setup_autoneg()
275 /* Do we want to advertise 10 Mb Full Duplex? */ in igc_phy_setup_autoneg()
276 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in igc_phy_setup_autoneg()
277 hw_dbg("Advertise 10mb Full duplex\n"); in igc_phy_setup_autoneg()
281 /* Do we want to advertise 100 Mb Half Duplex? */ in igc_phy_setup_autoneg()
282 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in igc_phy_setup_autoneg()
283 hw_dbg("Advertise 100mb Half duplex\n"); in igc_phy_setup_autoneg()
287 /* Do we want to advertise 100 Mb Full Duplex? */ in igc_phy_setup_autoneg()
288 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in igc_phy_setup_autoneg()
289 hw_dbg("Advertise 100mb Full duplex\n"); in igc_phy_setup_autoneg()
293 /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ in igc_phy_setup_autoneg()
294 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in igc_phy_setup_autoneg()
295 hw_dbg("Advertise 1000mb Half duplex request denied!\n"); in igc_phy_setup_autoneg()
297 /* Do we want to advertise 1000 Mb Full Duplex? */ in igc_phy_setup_autoneg()
298 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in igc_phy_setup_autoneg()
299 hw_dbg("Advertise 1000mb Full duplex\n"); in igc_phy_setup_autoneg()
303 /* We do not allow the Phy to advertise 2500 Mb Half Duplex */ in igc_phy_setup_autoneg()
304 if (phy->autoneg_advertised & ADVERTISE_2500_HALF) in igc_phy_setup_autoneg()
305 hw_dbg("Advertise 2500mb Half duplex request denied!\n"); in igc_phy_setup_autoneg()
307 /* Do we want to advertise 2500 Mb Full Duplex? */ in igc_phy_setup_autoneg()
308 if (phy->autoneg_advertised & ADVERTISE_2500_FULL) { in igc_phy_setup_autoneg()
309 hw_dbg("Advertise 2500mb Full duplex\n"); in igc_phy_setup_autoneg()
317 * auto-negotiation is enabled, then software will have to set the in igc_phy_setup_autoneg()
318 * "PAUSE" bits to the correct value in the Auto-Negotiation in igc_phy_setup_autoneg()
319 * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto- in igc_phy_setup_autoneg()
332 switch (hw->fc.current_mode) { in igc_phy_setup_autoneg()
335 * software over-ride. in igc_phy_setup_autoneg()
341 * disabled, by a software over-ride. in igc_phy_setup_autoneg()
353 * disabled, by a software over-ride. in igc_phy_setup_autoneg()
360 * over-ride. in igc_phy_setup_autoneg()
366 return -IGC_ERR_CONFIG; in igc_phy_setup_autoneg()
369 ret_val = phy->ops.write_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); in igc_phy_setup_autoneg()
373 hw_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); in igc_phy_setup_autoneg()
375 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in igc_phy_setup_autoneg()
376 ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, in igc_phy_setup_autoneg()
379 if ((phy->autoneg_mask & ADVERTISE_2500_FULL) && in igc_phy_setup_autoneg()
380 hw->phy.id == I225_I_PHY_ID) in igc_phy_setup_autoneg()
381 ret_val = phy->ops.write_reg(hw, in igc_phy_setup_autoneg()
391 * igc_wait_autoneg - Wait for auto-neg completion
394 * Waits for auto-negotiation to complete or for the auto-negotiation time
403 for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { in igc_wait_autoneg()
404 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_wait_autoneg()
407 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_wait_autoneg()
415 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation in igc_wait_autoneg()
422 * igc_copper_link_autoneg - Setup/Enable autoneg for copper link
426 * configure to advertise the full capability. Setup the PHY to autoneg
432 struct igc_phy_info *phy = &hw->phy; in igc_copper_link_autoneg()
439 phy->autoneg_advertised &= phy->autoneg_mask; in igc_copper_link_autoneg()
442 * by the calling code so we set to advertise full capability. in igc_copper_link_autoneg()
444 if (phy->autoneg_advertised == 0) in igc_copper_link_autoneg()
445 phy->autoneg_advertised = phy->autoneg_mask; in igc_copper_link_autoneg()
447 hw_dbg("Reconfiguring auto-neg advertisement params\n"); in igc_copper_link_autoneg()
450 hw_dbg("Error Setting up Auto-Negotiation\n"); in igc_copper_link_autoneg()
453 hw_dbg("Restarting Auto-Neg\n"); in igc_copper_link_autoneg()
455 /* Restart auto-negotiation by setting the Auto Neg Enable bit and in igc_copper_link_autoneg()
458 ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); in igc_copper_link_autoneg()
463 ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl); in igc_copper_link_autoneg()
467 /* Does the user want to wait for Auto-Neg to complete here, or in igc_copper_link_autoneg()
470 if (phy->autoneg_wait_to_complete) { in igc_copper_link_autoneg()
478 hw->mac.get_link_status = true; in igc_copper_link_autoneg()
485 * igc_setup_copper_link - Configure copper link settings
488 * Calls the appropriate function to configure the link for auto-neg or forced
489 * speed and duplex. Then we check for link, once link is established calls
491 * not established, we return -IGC_ERR_PHY (-2).
498 if (hw->mac.autoneg) { in igc_setup_copper_link()
509 hw_dbg("Forcing Speed and Duplex\n"); in igc_setup_copper_link()
510 ret_val = hw->phy.ops.force_speed_duplex(hw); in igc_setup_copper_link()
512 hw_dbg("Error Forcing Speed and Duplex\n"); in igc_setup_copper_link()
537 * igc_read_phy_reg_mdic - Read MDI control register
547 struct igc_phy_info *phy = &hw->phy; in igc_read_phy_reg_mdic()
553 ret_val = -IGC_ERR_PARAM; in igc_read_phy_reg_mdic()
557 /* Set up Op-code, Phy Address, and register offset in the MDI in igc_read_phy_reg_mdic()
562 (phy->addr << IGC_MDIC_PHY_SHIFT) | in igc_read_phy_reg_mdic()
579 ret_val = -IGC_ERR_PHY; in igc_read_phy_reg_mdic()
584 ret_val = -IGC_ERR_PHY; in igc_read_phy_reg_mdic()
594 * igc_write_phy_reg_mdic - Write MDI control register
603 struct igc_phy_info *phy = &hw->phy; in igc_write_phy_reg_mdic()
609 ret_val = -IGC_ERR_PARAM; in igc_write_phy_reg_mdic()
613 /* Set up Op-code, Phy Address, and register offset in the MDI in igc_write_phy_reg_mdic()
619 (phy->addr << IGC_MDIC_PHY_SHIFT) | in igc_write_phy_reg_mdic()
636 ret_val = -IGC_ERR_PHY; in igc_write_phy_reg_mdic()
641 ret_val = -IGC_ERR_PHY; in igc_write_phy_reg_mdic()
650 * __igc_access_xmdio_reg - Read/write XMDIO register
662 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAC, dev_addr); in __igc_access_xmdio_reg()
666 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAAD, address); in __igc_access_xmdio_reg()
670 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAC, IGC_MMDAC_FUNC_DATA | in __igc_access_xmdio_reg()
676 ret_val = hw->phy.ops.read_reg(hw, IGC_MMDAAD, data); in __igc_access_xmdio_reg()
678 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAAD, *data); in __igc_access_xmdio_reg()
683 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAC, 0); in __igc_access_xmdio_reg()
691 * igc_read_xmdio_reg - Read XMDIO register
704 * igc_write_xmdio_reg - Write XMDIO register
717 * igc_write_phy_reg_gpy - Write GPY PHY register
733 ret_val = hw->phy.ops.acquire(hw); in igc_write_phy_reg_gpy()
739 hw->phy.ops.release(hw); in igc_write_phy_reg_gpy()
749 * igc_read_phy_reg_gpy - Read GPY PHY register
766 ret_val = hw->phy.ops.acquire(hw); in igc_read_phy_reg_gpy()
772 hw->phy.ops.release(hw); in igc_read_phy_reg_gpy()