drivers/net/ethernet/intel/igc/igc_ptp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/igc/igc_ptp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/igc/igc_ptp.c- Extension
.c- Size
- 36752 bytes
- Lines
- 1389
- 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
igc.hlinux/module.hlinux/device.hlinux/pci.hlinux/ptp_classify.hlinux/clocksource.hlinux/ktime.hlinux/delay.hlinux/iopoll.hnet/xdp_sock_drv.h
Detected Declarations
function igc_ptp_readfunction igc_ptp_write_i225function igc_ptp_adjfine_i225function igc_ptp_adjtime_i225function igc_ptp_gettimex64_i225function igc_ptp_settime_i225function igc_pin_directionfunction igc_pin_peroutfunction igc_pin_exttsfunction igc_ptp_feature_enable_i225function igc_ptp_verify_pinfunction igc_ptp_systim_to_hwtstampfunction igc_ptp_rx_pktstampfunction igc_ptp_disable_rx_timestampfunction igc_ptp_enable_rx_timestampfunction igc_ptp_free_tx_bufferfunction igc_ptp_clear_tx_tstampfunction igc_ptp_clear_xsk_tx_tstamp_queuefunction igc_ptp_disable_tx_timestampfunction igc_ptp_enable_tx_timestampfunction igc_ptp_set_timestamp_modefunction igc_ptp_tx_timeoutfunction igc_ptp_tx_hangfunction igc_ptp_tx_reg_to_stampfunction igc_ptp_tx_hwtstampfunction igc_ptp_tx_tstamp_eventfunction igc_ptp_hwtstamp_setfunction igc_ptp_hwtstamp_getfunction igc_is_crosststamp_supportedfunction igc_device_tstamp_to_systemfunction igc_ptm_log_errorfunction igc_ptm_triggerfunction igc_ptm_resetfunction igc_phc_get_syncdevicetimefunction igc_ptp_getcrosststampfunction igc_ptp_getcyclesx64function igc_ptp_initfunction igc_ptp_time_savefunction igc_ptp_time_restorefunction igc_ptm_stopfunction igc_ptp_suspendfunction igc_ptp_stopfunction igc_ptp_reset
Annotated Snippet
if (on) {
pin = ptp_find_pin(igc->ptp_clock, PTP_PF_EXTTS,
rq->extts.index);
if (pin < 0)
return -EBUSY;
}
if (rq->extts.index == 1) {
tsauxc_mask = IGC_TSAUXC_EN_TS1;
tsim_mask = IGC_TSICR_AUTT1;
} else {
tsauxc_mask = IGC_TSAUXC_EN_TS0;
tsim_mask = IGC_TSICR_AUTT0;
}
spin_lock_irqsave(&igc->tmreg_lock, flags);
tsauxc = rd32(IGC_TSAUXC);
tsim = rd32(IGC_TSIM);
if (on) {
igc_pin_extts(igc, rq->extts.index, pin);
tsauxc |= tsauxc_mask;
tsim |= tsim_mask;
} else {
tsauxc &= ~tsauxc_mask;
tsim &= ~tsim_mask;
}
wr32(IGC_TSAUXC, tsauxc);
wr32(IGC_TSIM, tsim);
spin_unlock_irqrestore(&igc->tmreg_lock, flags);
return 0;
case PTP_CLK_REQ_PEROUT:
if (on) {
pin = ptp_find_pin(igc->ptp_clock, PTP_PF_PEROUT,
rq->perout.index);
if (pin < 0)
return -EBUSY;
}
ts.tv_sec = rq->perout.period.sec;
ts.tv_nsec = rq->perout.period.nsec;
ns = timespec64_to_ns(&ts);
ns = ns >> 1;
if (on && (ns <= 70000000LL || ns == 125000000LL ||
ns == 250000000LL || ns == 500000000LL)) {
if (ns < 8LL)
return -EINVAL;
use_freq = 1;
}
ts = ns_to_timespec64(ns);
if (rq->perout.index == 1) {
if (use_freq) {
tsauxc_mask = IGC_TSAUXC_EN_CLK1 | IGC_TSAUXC_ST1;
tsim_mask = 0;
} else {
tsauxc_mask = IGC_TSAUXC_EN_TT1;
tsim_mask = IGC_TSICR_TT1;
}
trgttiml = IGC_TRGTTIML1;
trgttimh = IGC_TRGTTIMH1;
freqout = IGC_FREQOUT1;
} else {
if (use_freq) {
tsauxc_mask = IGC_TSAUXC_EN_CLK0 | IGC_TSAUXC_ST0;
tsim_mask = 0;
} else {
tsauxc_mask = IGC_TSAUXC_EN_TT0;
tsim_mask = IGC_TSICR_TT0;
}
trgttiml = IGC_TRGTTIML0;
trgttimh = IGC_TRGTTIMH0;
freqout = IGC_FREQOUT0;
}
spin_lock_irqsave(&igc->tmreg_lock, flags);
tsauxc = rd32(IGC_TSAUXC);
tsim = rd32(IGC_TSIM);
if (rq->perout.index == 1) {
tsauxc &= ~(IGC_TSAUXC_EN_TT1 | IGC_TSAUXC_EN_CLK1 |
IGC_TSAUXC_ST1);
tsim &= ~IGC_TSICR_TT1;
} else {
tsauxc &= ~(IGC_TSAUXC_EN_TT0 | IGC_TSAUXC_EN_CLK0 |
IGC_TSAUXC_ST0);
tsim &= ~IGC_TSICR_TT0;
}
if (on) {
struct timespec64 safe_start;
int i = rq->perout.index;
igc_pin_perout(igc, i, pin, use_freq);
igc_ptp_read(igc, &safe_start);
/* PPS output start time is triggered by Target time(TT)
Annotation
- Immediate include surface: `igc.h`, `linux/module.h`, `linux/device.h`, `linux/pci.h`, `linux/ptp_classify.h`, `linux/clocksource.h`, `linux/ktime.h`, `linux/delay.h`.
- Detected declarations: `function igc_ptp_read`, `function igc_ptp_write_i225`, `function igc_ptp_adjfine_i225`, `function igc_ptp_adjtime_i225`, `function igc_ptp_gettimex64_i225`, `function igc_ptp_settime_i225`, `function igc_pin_direction`, `function igc_pin_perout`, `function igc_pin_extts`, `function igc_ptp_feature_enable_i225`.
- 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.