Lines Matching +full:flow +full:- +full:control

1 // SPDX-License-Identifier: GPL-2.0
8 * igc_check_reset_block - Check if PHY reset is blocked
11 * Read the PHY management control register and check whether a PHY reset
26 * igc_get_phy_id - Retrieve the PHY ID and revision
34 struct igc_phy_info *phy = &hw->phy; in igc_get_phy_id()
38 ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); in igc_get_phy_id()
42 phy->id = (u32)(phy_id << 16); in igc_get_phy_id()
44 ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); in igc_get_phy_id()
48 phy->id |= (u32)(phy_id & PHY_REVISION_MASK); in igc_get_phy_id()
49 phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); in igc_get_phy_id()
56 * igc_phy_has_link - Polls PHY for link
75 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_phy_has_link()
86 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_phy_has_link()
103 * igc_power_up_phy_copper - Restore copper link in case of PHY power down
114 hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); in igc_power_up_phy_copper()
116 hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); in igc_power_up_phy_copper()
120 * igc_power_down_phy_copper - Power down copper PHY
131 hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); in igc_power_down_phy_copper()
134 /* Temporary workaround - should be removed when PHY will implement in igc_power_down_phy_copper()
137 /* hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);*/ in igc_power_down_phy_copper()
142 * igc_check_downshift - Checks whether a downshift in speed occurred
149 struct igc_phy_info *phy = &hw->phy; in igc_check_downshift()
152 phy->speed_downgraded = false; in igc_check_downshift()
156 * igc_phy_hw_reset - PHY hardware reset
160 * semaphore (if necessary) and read/set/write the device control reset
166 struct igc_phy_info *phy = &hw->phy; in igc_phy_hw_reset()
177 ret_val = phy->ops.acquire(hw); in igc_phy_hw_reset()
187 udelay(phy->reset_delay_us); in igc_phy_hw_reset()
196 timeout--; in igc_phy_hw_reset()
205 phy->ops.release(hw); in igc_phy_hw_reset()
212 * igc_phy_setup_autoneg - Configure PHY for auto-negotiation
215 * Reads the MII auto-neg advertisement register and/or the 1000T control
216 * register and if the PHY is already setup for auto-negotiation, then
217 * return successful. Otherwise, setup advertisement and flow control to
218 * the appropriate values for the wanted auto-negotiation.
222 struct igc_phy_info *phy = &hw->phy; in igc_phy_setup_autoneg()
228 phy->autoneg_advertised &= phy->autoneg_mask; in igc_phy_setup_autoneg()
230 /* Read the MII Auto-Neg Advertisement Register (Address 4). */ in igc_phy_setup_autoneg()
231 ret_val = phy->ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); in igc_phy_setup_autoneg()
235 if (phy->autoneg_mask & ADVERTISE_1000_FULL) { in igc_phy_setup_autoneg()
236 /* Read the MII 1000Base-T Control Register (Address 9). */ in igc_phy_setup_autoneg()
237 ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, in igc_phy_setup_autoneg()
243 if (phy->autoneg_mask & ADVERTISE_2500_FULL) { in igc_phy_setup_autoneg()
244 /* Read the MULTI GBT AN Control Register - reg 7.32 */ in igc_phy_setup_autoneg()
245 ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK << in igc_phy_setup_autoneg()
261 /* First we clear all the 10/100 mb speed bits in the Auto-Neg in igc_phy_setup_autoneg()
263 * the 1000Base-T Control Register (Address 9). in igc_phy_setup_autoneg()
271 hw_dbg("autoneg_advertised %x\n", phy->autoneg_advertised); in igc_phy_setup_autoneg()
274 if (phy->autoneg_advertised & ADVERTISE_10_HALF) { in igc_phy_setup_autoneg()
280 if (phy->autoneg_advertised & ADVERTISE_10_FULL) { in igc_phy_setup_autoneg()
286 if (phy->autoneg_advertised & ADVERTISE_100_HALF) { in igc_phy_setup_autoneg()
292 if (phy->autoneg_advertised & ADVERTISE_100_FULL) { in igc_phy_setup_autoneg()
298 if (phy->autoneg_advertised & ADVERTISE_1000_HALF) in igc_phy_setup_autoneg()
302 if (phy->autoneg_advertised & ADVERTISE_1000_FULL) { in igc_phy_setup_autoneg()
308 if (phy->autoneg_advertised & ADVERTISE_2500_HALF) in igc_phy_setup_autoneg()
312 if (phy->autoneg_advertised & ADVERTISE_2500_FULL) { in igc_phy_setup_autoneg()
319 /* Check for a software override of the flow control settings, and in igc_phy_setup_autoneg()
321 * auto-negotiation is enabled, then software will have to set the in igc_phy_setup_autoneg()
322 * "PAUSE" bits to the correct value in the Auto-Negotiation in igc_phy_setup_autoneg()
323 * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto- in igc_phy_setup_autoneg()
327 * 0: Flow control is completely disabled in igc_phy_setup_autoneg()
328 * 1: Rx flow control is enabled (we can receive pause frames in igc_phy_setup_autoneg()
330 * 2: Tx flow control is enabled (we can send pause frames in igc_phy_setup_autoneg()
332 * 3: Both Rx and Tx flow control (symmetric) are enabled. in igc_phy_setup_autoneg()
333 * other: No software override. The flow control configuration in igc_phy_setup_autoneg()
336 switch (hw->fc.current_mode) { in igc_phy_setup_autoneg()
338 /* Flow control (Rx & Tx) is completely disabled by a in igc_phy_setup_autoneg()
339 * software over-ride. in igc_phy_setup_autoneg()
344 /* Rx Flow control is enabled, and Tx Flow control is in igc_phy_setup_autoneg()
345 * disabled, by a software over-ride. in igc_phy_setup_autoneg()
356 /* Tx Flow control is enabled, and Rx Flow control is in igc_phy_setup_autoneg()
357 * disabled, by a software over-ride. in igc_phy_setup_autoneg()
363 /* Flow control (both Rx and Tx) is enabled by a software in igc_phy_setup_autoneg()
364 * over-ride. in igc_phy_setup_autoneg()
369 hw_dbg("Flow control param set incorrectly\n"); in igc_phy_setup_autoneg()
370 return -IGC_ERR_CONFIG; in igc_phy_setup_autoneg()
373 ret_val = phy->ops.write_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); in igc_phy_setup_autoneg()
377 hw_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); in igc_phy_setup_autoneg()
379 if (phy->autoneg_mask & ADVERTISE_1000_FULL) in igc_phy_setup_autoneg()
380 ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, in igc_phy_setup_autoneg()
383 if (phy->autoneg_mask & ADVERTISE_2500_FULL) in igc_phy_setup_autoneg()
384 ret_val = phy->ops.write_reg(hw, in igc_phy_setup_autoneg()
394 * igc_wait_autoneg - Wait for auto-neg completion
397 * Waits for auto-negotiation to complete or for the auto-negotiation time
406 for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { in igc_wait_autoneg()
407 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_wait_autoneg()
410 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); in igc_wait_autoneg()
418 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation in igc_wait_autoneg()
425 * igc_copper_link_autoneg - Setup/Enable autoneg for copper link
435 struct igc_phy_info *phy = &hw->phy; in igc_copper_link_autoneg()
442 phy->autoneg_advertised &= phy->autoneg_mask; in igc_copper_link_autoneg()
447 if (phy->autoneg_advertised == 0) in igc_copper_link_autoneg()
448 phy->autoneg_advertised = phy->autoneg_mask; in igc_copper_link_autoneg()
450 hw_dbg("Reconfiguring auto-neg advertisement params\n"); in igc_copper_link_autoneg()
453 hw_dbg("Error Setting up Auto-Negotiation\n"); in igc_copper_link_autoneg()
456 hw_dbg("Restarting Auto-Neg\n"); in igc_copper_link_autoneg()
458 /* Restart auto-negotiation by setting the Auto Neg Enable bit and in igc_copper_link_autoneg()
459 * the Auto Neg Restart bit in the PHY control register. in igc_copper_link_autoneg()
461 ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); in igc_copper_link_autoneg()
466 ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl); in igc_copper_link_autoneg()
470 /* Does the user want to wait for Auto-Neg to complete here, or in igc_copper_link_autoneg()
473 if (phy->autoneg_wait_to_complete) { in igc_copper_link_autoneg()
481 hw->mac.get_link_status = true; in igc_copper_link_autoneg()
488 * igc_setup_copper_link - Configure copper link settings
491 * Calls the appropriate function to configure the link for auto-neg or forced
493 * to configure collision distance and flow control are called. If link is
494 * not established, we return -IGC_ERR_PHY (-2).
501 if (hw->mac.autoneg) { in igc_setup_copper_link()
502 /* Setup autoneg and flow control advertisement and perform in igc_setup_copper_link()
513 ret_val = hw->phy.ops.force_speed_duplex(hw); in igc_setup_copper_link()
540 * igc_read_phy_reg_mdic - Read MDI control register
545 * Reads the MDI control register in the PHY at offset and stores the
550 struct igc_phy_info *phy = &hw->phy; in igc_read_phy_reg_mdic()
556 ret_val = -IGC_ERR_PARAM; in igc_read_phy_reg_mdic()
560 /* Set up Op-code, Phy Address, and register offset in the MDI in igc_read_phy_reg_mdic()
561 * Control register. The MAC will take care of interfacing with the in igc_read_phy_reg_mdic()
565 (phy->addr << IGC_MDIC_PHY_SHIFT) | in igc_read_phy_reg_mdic()
582 ret_val = -IGC_ERR_PHY; in igc_read_phy_reg_mdic()
587 ret_val = -IGC_ERR_PHY; in igc_read_phy_reg_mdic()
597 * igc_write_phy_reg_mdic - Write MDI control register
602 * Writes data to MDI control register in the PHY at offset.
606 struct igc_phy_info *phy = &hw->phy; in igc_write_phy_reg_mdic()
612 ret_val = -IGC_ERR_PARAM; in igc_write_phy_reg_mdic()
616 /* Set up Op-code, Phy Address, and register offset in the MDI in igc_write_phy_reg_mdic()
617 * Control register. The MAC will take care of interfacing with the in igc_write_phy_reg_mdic()
622 (phy->addr << IGC_MDIC_PHY_SHIFT) | in igc_write_phy_reg_mdic()
639 ret_val = -IGC_ERR_PHY; in igc_write_phy_reg_mdic()
644 ret_val = -IGC_ERR_PHY; in igc_write_phy_reg_mdic()
653 * __igc_access_xmdio_reg - Read/write XMDIO register
665 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAC, dev_addr); in __igc_access_xmdio_reg()
669 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAAD, address); in __igc_access_xmdio_reg()
673 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAC, IGC_MMDAC_FUNC_DATA | in __igc_access_xmdio_reg()
679 ret_val = hw->phy.ops.read_reg(hw, IGC_MMDAAD, data); in __igc_access_xmdio_reg()
681 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAAD, *data); in __igc_access_xmdio_reg()
686 ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAC, 0); in __igc_access_xmdio_reg()
694 * igc_read_xmdio_reg - Read XMDIO register
707 * igc_write_xmdio_reg - Write XMDIO register
720 * igc_write_phy_reg_gpy - Write GPY PHY register
736 ret_val = hw->phy.ops.acquire(hw); in igc_write_phy_reg_gpy()
740 hw->phy.ops.release(hw); in igc_write_phy_reg_gpy()
750 * igc_read_phy_reg_gpy - Read GPY PHY register
767 ret_val = hw->phy.ops.acquire(hw); in igc_read_phy_reg_gpy()
771 hw->phy.ops.release(hw); in igc_read_phy_reg_gpy()
781 * igc_read_phy_fw_version - Read gPHY firmware version
786 struct igc_phy_info *phy = &hw->phy; in igc_read_phy_fw_version()
791 ret_val = phy->ops.read_reg(hw, IGC_GPHY_VERSION, &gphy_version); in igc_read_phy_fw_version()