drivers/net/ethernet/atheros/atl1e/atl1e_hw.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/atheros/atl1e/atl1e_hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/atheros/atl1e/atl1e_hw.c- Extension
.c- Size
- 15775 bytes
- Lines
- 638
- 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/pci.hlinux/delay.hlinux/mii.hlinux/crc32.hatl1e.h
Detected Declarations
function Copyrightfunction atl1e_hw_set_mac_addrfunction atl1e_get_permanent_addressfunction atl1e_write_eepromfunction atl1e_read_eepromfunction atl1e_force_psfunction atl1e_read_mac_addrfunction atl1e_hash_mc_addrfunction atl1e_hash_setfunction atl1e_read_phy_regfunction atl1e_write_phy_regfunction atl1e_init_pciefunction atl1e_phy_setup_autoneg_advfunction regiserfunction atl1e_phy_initfunction atl1e_reset_hwfunction atl1e_init_hwfunction atl1e_get_speed_and_duplexfunction atl1e_restart_autoneg
Annotated Snippet
if (hw->nic_type == athr_l1e) {
mii_1000t_ctrl_reg |= ADVERTISE_1000FULL;
hw->autoneg_advertised |= ADVERTISE_1000_FULL;
}
break;
case MEDIA_TYPE_100M_FULL:
mii_autoneg_adv_reg |= ADVERTISE_100FULL;
hw->autoneg_advertised = ADVERTISE_100_FULL;
break;
case MEDIA_TYPE_100M_HALF:
mii_autoneg_adv_reg |= ADVERTISE_100_HALF;
hw->autoneg_advertised = ADVERTISE_100_HALF;
break;
case MEDIA_TYPE_10M_FULL:
mii_autoneg_adv_reg |= ADVERTISE_10_FULL;
hw->autoneg_advertised = ADVERTISE_10_FULL;
break;
default:
mii_autoneg_adv_reg |= ADVERTISE_10_HALF;
hw->autoneg_advertised = ADVERTISE_10_HALF;
break;
}
/* flow control fixed to enable all */
mii_autoneg_adv_reg |= (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
hw->mii_autoneg_adv_reg = mii_autoneg_adv_reg;
hw->mii_1000t_ctrl_reg = mii_1000t_ctrl_reg;
ret_val = atl1e_write_phy_reg(hw, MII_ADVERTISE, mii_autoneg_adv_reg);
if (ret_val)
return ret_val;
if (hw->nic_type == athr_l1e || hw->nic_type == athr_l2e_revA) {
ret_val = atl1e_write_phy_reg(hw, MII_CTRL1000,
mii_1000t_ctrl_reg);
if (ret_val)
return ret_val;
}
return 0;
}
/*
* Resets the PHY and make all config validate
*
* hw - Struct containing variables accessed by shared code
*
* Sets bit 15 and 12 of the MII control regiser (for F001 bug)
*/
int atl1e_phy_commit(struct atl1e_hw *hw)
{
struct atl1e_adapter *adapter = hw->adapter;
int ret_val;
u16 phy_data;
phy_data = BMCR_RESET | BMCR_ANENABLE | BMCR_ANRESTART;
ret_val = atl1e_write_phy_reg(hw, MII_BMCR, phy_data);
if (ret_val) {
u32 val;
int i;
/**************************************
* pcie serdes link may be down !
**************************************/
for (i = 0; i < 25; i++) {
msleep(1);
val = AT_READ_REG(hw, REG_MDIO_CTRL);
if (!(val & (MDIO_START | MDIO_BUSY)))
break;
}
if (0 != (val & (MDIO_START | MDIO_BUSY))) {
netdev_err(adapter->netdev,
"pcie linkdown at least for 25ms\n");
return ret_val;
}
netdev_err(adapter->netdev, "pcie linkup after %d ms\n", i);
}
return 0;
}
int atl1e_phy_init(struct atl1e_hw *hw)
{
Annotation
- Immediate include surface: `linux/pci.h`, `linux/delay.h`, `linux/mii.h`, `linux/crc32.h`, `atl1e.h`.
- Detected declarations: `function Copyright`, `function atl1e_hw_set_mac_addr`, `function atl1e_get_permanent_address`, `function atl1e_write_eeprom`, `function atl1e_read_eeprom`, `function atl1e_force_ps`, `function atl1e_read_mac_addr`, `function atl1e_hash_mc_addr`, `function atl1e_hash_set`, `function atl1e_read_phy_reg`.
- 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.