drivers/net/ethernet/intel/igb/e1000_phy.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/igb/e1000_phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/igb/e1000_phy.c- Extension
.c- Size
- 69874 bytes
- Lines
- 2629
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/delay.hlinux/if_ether.he1000_mac.he1000_phy.h
Detected Declarations
function E1000_BLK_PHY_RESETfunction igb_get_phy_idfunction igb_phy_reset_dspfunction igb_read_phy_reg_mdicfunction igb_write_phy_reg_mdicfunction igb_read_phy_reg_i2cfunction igb_write_phy_reg_i2cfunction E1000_I2CCMD_SFP_DATA_ADDRfunction igb_read_phy_reg_igpfunction igb_write_phy_reg_igpfunction igb_copper_link_setup_82580function igb_copper_link_setup_m88function igb_copper_link_setup_m88_gen2function igb_copper_link_setup_igpfunction igb_copper_link_autonegfunction timefunction igb_phy_setup_autonegfunction Registerfunction igb_setup_copper_linkfunction igb_phy_force_speed_duplex_igpfunction igb_phy_force_speed_duplex_m88function igb_phy_force_speed_duplex_setupfunction upfunction igb_check_downshiftfunction igb_check_polarity_m88function speedfunction igb_wait_autonegfunction igb_phy_has_linkfunction igb_get_cable_length_m88function igb_get_cable_length_m88_gen2function controlfunction igb_get_phy_info_m88function igb_get_phy_info_igpfunction igb_phy_sw_resetfunction semaphorefunction igb_phy_init_script_igp3function igb_initialize_M88E1512_phyfunction igb_initialize_M88E1543_phyfunction igb_power_up_phy_copperfunction igb_power_down_phy_copperfunction igb_check_polarity_82580function igb_phy_force_speed_duplex_82580function igb_get_phy_info_82580function igb_get_cable_length_82580function igb_set_master_slave_mode
Annotated Snippet
if (ret_val) {
hw->phy.ops.release(hw);
goto out;
}
}
ret_val = igb_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data);
hw->phy.ops.release(hw);
out:
return ret_val;
}
/**
* igb_write_phy_reg_igp - Write igp PHY register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
*
* Acquires semaphore, if necessary, then writes the data to PHY register
* at the offset. Release any acquired semaphores before exiting.
**/
s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
{
s32 ret_val = 0;
if (!(hw->phy.ops.acquire))
goto out;
ret_val = hw->phy.ops.acquire(hw);
if (ret_val)
goto out;
if (offset > MAX_PHY_MULTI_PAGE_REG) {
ret_val = igb_write_phy_reg_mdic(hw,
IGP01E1000_PHY_PAGE_SELECT,
(u16)offset);
if (ret_val) {
hw->phy.ops.release(hw);
goto out;
}
}
ret_val = igb_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data);
hw->phy.ops.release(hw);
out:
return ret_val;
}
/**
* igb_copper_link_setup_82580 - Setup 82580 PHY for copper link
* @hw: pointer to the HW structure
*
* Sets up Carrier-sense on Transmit and downshift values.
**/
s32 igb_copper_link_setup_82580(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
u16 phy_data;
if (phy->reset_disable) {
ret_val = 0;
goto out;
}
if (phy->type == e1000_phy_82580) {
ret_val = hw->phy.ops.reset(hw);
if (ret_val) {
hw_dbg("Error resetting the PHY.\n");
goto out;
}
}
/* Enable CRS on TX. This must be set for half-duplex operation. */
ret_val = phy->ops.read_reg(hw, I82580_CFG_REG, &phy_data);
if (ret_val)
goto out;
phy_data |= I82580_CFG_ASSERT_CRS_ON_TX;
/* Enable downshift */
phy_data |= I82580_CFG_ENABLE_DOWNSHIFT;
ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/delay.h`, `linux/if_ether.h`, `e1000_mac.h`, `e1000_phy.h`.
- Detected declarations: `function E1000_BLK_PHY_RESET`, `function igb_get_phy_id`, `function igb_phy_reset_dsp`, `function igb_read_phy_reg_mdic`, `function igb_write_phy_reg_mdic`, `function igb_read_phy_reg_i2c`, `function igb_write_phy_reg_i2c`, `function E1000_I2CCMD_SFP_DATA_ADDR`, `function igb_read_phy_reg_igp`, `function igb_write_phy_reg_igp`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.