drivers/net/ethernet/microchip/lan743x_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/microchip/lan743x_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/microchip/lan743x_ethtool.c- Extension
.c- Size
- 38510 bytes
- Lines
- 1393
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/netdevice.hlinux/net_tstamp.hlinux/pci.hlinux/phy.hlan743x_main.hlan743x_ethtool.hlinux/sched.hlinux/iopoll.h
Detected Declarations
function lan743x_otp_power_upfunction lan743x_otp_power_downfunction lan743x_otp_set_addressfunction lan743x_otp_read_gofunction lan743x_otp_wait_till_not_busyfunction lan743x_otp_readfunction lan743x_otp_writefunction lan743x_hs_syslock_acquirefunction lan743x_hs_syslock_releasefunction lan743x_hs_otp_power_upfunction lan743x_hs_otp_power_downfunction lan743x_hs_otp_set_addressfunction lan743x_hs_otp_read_gofunction lan743x_hs_otp_cmd_cmplt_chkfunction lan743x_hs_otp_readfunction lan743x_hs_otp_writefunction lan743x_eeprom_waitfunction lan743x_eeprom_confirm_not_busyfunction lan743x_eeprom_readfunction lan743x_eeprom_writefunction lan743x_hs_eeprom_cmd_cmplt_chkfunction lan743x_hs_eeprom_readfunction lan743x_hs_eeprom_writefunction lan743x_ethtool_get_drvinfofunction lan743x_ethtool_get_msglevelfunction lan743x_ethtool_set_msglevelfunction lan743x_ethtool_get_eeprom_lenfunction lan743x_ethtool_get_eepromfunction lan743x_ethtool_set_eepromfunction lan743x_ethtool_get_stringsfunction lan743x_ethtool_get_ethtool_statsfunction lan743x_ethtool_get_priv_flagsfunction lan743x_ethtool_set_priv_flagsfunction lan743x_ethtool_get_sset_countfunction lan743x_ethtool_get_rxfh_fieldsfunction lan743x_ethtool_get_rx_ring_countfunction lan743x_ethtool_get_rxfh_key_sizefunction lan743x_ethtool_get_rxfh_indir_sizefunction lan743x_ethtool_get_rxfhfunction lan743x_ethtool_set_rxfhfunction lan743x_ethtool_get_ts_infofunction lan743x_ethtool_get_eeefunction lan743x_ethtool_set_eeefunction lan743x_ethtool_nway_resetfunction lan743x_ethtool_set_link_ksettingsfunction lan743x_ethtool_get_link_ksettingsfunction lan743x_ethtool_get_wolfunction lan743x_ethtool_set_wol
Annotated Snippet
if (time_after(jiffies, timeout)) {
netif_warn(adapter, drv, adapter->netdev,
"Timeout on OTP_STATUS completion\n");
return -EIO;
}
udelay(1);
reg_val = lan743x_csr_read(adapter, OTP_STATUS);
} while (reg_val & OTP_STATUS_BUSY_);
return 0;
}
static int lan743x_otp_read(struct lan743x_adapter *adapter, u32 offset,
u32 length, u8 *data)
{
int ret;
int i;
if (offset + length > MAX_OTP_SIZE)
return -EINVAL;
ret = lan743x_otp_power_up(adapter);
if (ret < 0)
return ret;
ret = lan743x_otp_wait_till_not_busy(adapter);
if (ret < 0)
return ret;
for (i = 0; i < length; i++) {
lan743x_otp_set_address(adapter, offset + i);
lan743x_otp_read_go(adapter);
ret = lan743x_otp_wait_till_not_busy(adapter);
if (ret < 0)
return ret;
data[i] = lan743x_csr_read(adapter, OTP_READ_DATA);
}
lan743x_otp_power_down(adapter);
return 0;
}
static int lan743x_otp_write(struct lan743x_adapter *adapter, u32 offset,
u32 length, u8 *data)
{
int ret;
int i;
if (offset + length > MAX_OTP_SIZE)
return -EINVAL;
ret = lan743x_otp_power_up(adapter);
if (ret < 0)
return ret;
ret = lan743x_otp_wait_till_not_busy(adapter);
if (ret < 0)
return ret;
/* set to BYTE program mode */
lan743x_csr_write(adapter, OTP_PRGM_MODE, OTP_PRGM_MODE_BYTE_);
for (i = 0; i < length; i++) {
lan743x_otp_set_address(adapter, offset + i);
lan743x_csr_write(adapter, OTP_PRGM_DATA, data[i]);
lan743x_csr_write(adapter, OTP_TST_CMD, OTP_TST_CMD_PRGVRFY_);
lan743x_csr_write(adapter, OTP_CMD_GO, OTP_CMD_GO_GO_);
ret = lan743x_otp_wait_till_not_busy(adapter);
if (ret < 0)
return ret;
}
lan743x_otp_power_down(adapter);
return 0;
}
int lan743x_hs_syslock_acquire(struct lan743x_adapter *adapter,
u16 timeout)
{
u16 timeout_cnt = 0;
u32 val;
do {
spin_lock(&adapter->eth_syslock_spinlock);
if (adapter->eth_syslock_acquire_cnt == 0) {
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/net_tstamp.h`, `linux/pci.h`, `linux/phy.h`, `lan743x_main.h`, `lan743x_ethtool.h`, `linux/sched.h`, `linux/iopoll.h`.
- Detected declarations: `function lan743x_otp_power_up`, `function lan743x_otp_power_down`, `function lan743x_otp_set_address`, `function lan743x_otp_read_go`, `function lan743x_otp_wait_till_not_busy`, `function lan743x_otp_read`, `function lan743x_otp_write`, `function lan743x_hs_syslock_acquire`, `function lan743x_hs_syslock_release`, `function lan743x_hs_otp_power_up`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.