drivers/net/phy/microchip_rds_ptp.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/microchip_rds_ptp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/microchip_rds_ptp.c- Extension
.c- Size
- 34008 bytes
- Lines
- 1331
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
microchip_rds_ptp.h
Detected Declarations
function mchp_rds_phy_read_mmdfunction mchp_rds_phy_write_mmdfunction mchp_rds_phy_modify_mmdfunction mchp_rds_phy_set_bits_mmdfunction mchp_get_pulsewidthfunction mchp_general_event_configfunction mchp_set_clock_reloadfunction mchp_set_clock_targetfunction mchp_rds_ptp_perout_offfunction mchp_get_eventfunction mchp_rds_ptp_peroutfunction mchp_rds_ptpci_enablefunction mchp_rds_ptpci_verifyfunction mchp_rds_ptp_flush_fifofunction mchp_rds_ptp_config_intrfunction mchp_rds_ptp_txtstampfunction mchp_rds_ptp_get_sig_rxfunction mchp_rds_ptp_match_skbfunction mchp_rds_ptp_match_rx_tsfunction mchp_rds_ptp_match_rx_skbfunction mchp_rds_ptp_rxtstampfunction mchp_rds_ptp_hwtstamp_getfunction mchp_rds_ptp_hwtstamp_setfunction mchp_rds_ptp_ts_infofunction mchp_rds_ptp_ltc_adjtimefunction mchp_rds_ptp_ltc_adjfinefunction mchp_rds_ptp_ltc_gettime64function mchp_rds_ptp_ltc_settime64function mchp_rds_ptp_get_sig_txfunction mchp_rds_ptp_match_tx_skbfunction mchp_rds_ptp_process_rx_tsfunction mchp_rds_ptp_get_tx_tsfunction mchp_rds_ptp_process_tx_tsfunction mchp_rds_ptp_top_config_intrfunction mchp_rds_ptp_handle_interruptfunction mchp_rds_ptp_initexport mchp_rds_ptp_top_config_intrexport mchp_rds_ptp_handle_interruptexport mchp_rds_ptp_probe
Annotated Snippet
if (ts_on_nsec <= sup_on_necs[i]) {
*pulse_width = i;
break;
}
}
phydev_info(phydev, "pulse width is %d\n", *pulse_width);
return 0;
}
static int mchp_general_event_config(struct mchp_rds_ptp_clock *clock,
int pulse_width)
{
int general_config;
general_config = mchp_rds_phy_read_mmd(clock, MCHP_RDS_PTP_GEN_CFG,
MCHP_RDS_PTP_CLOCK);
if (general_config < 0)
return general_config;
general_config &= ~MCHP_RDS_PTP_GEN_CFG_LTC_EVT_MASK;
general_config |= MCHP_RDS_PTP_GEN_CFG_LTC_EVT_SET(pulse_width);
general_config &= ~MCHP_RDS_PTP_GEN_CFG_RELOAD_ADD;
general_config |= MCHP_RDS_PTP_GEN_CFG_POLARITY;
return mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_GEN_CFG,
MCHP_RDS_PTP_CLOCK, general_config);
}
static int mchp_set_clock_reload(struct mchp_rds_ptp_clock *clock,
s64 period_sec, u32 period_nsec)
{
int rc;
rc = mchp_rds_phy_write_mmd(clock,
MCHP_RDS_PTP_CLK_TRGT_RELOAD_SEC_LO,
MCHP_RDS_PTP_CLOCK,
lower_16_bits(period_sec));
if (rc < 0)
return rc;
rc = mchp_rds_phy_write_mmd(clock,
MCHP_RDS_PTP_CLK_TRGT_RELOAD_SEC_HI,
MCHP_RDS_PTP_CLOCK,
upper_16_bits(period_sec));
if (rc < 0)
return rc;
rc = mchp_rds_phy_write_mmd(clock,
MCHP_RDS_PTP_CLK_TRGT_RELOAD_NS_LO,
MCHP_RDS_PTP_CLOCK,
lower_16_bits(period_nsec));
if (rc < 0)
return rc;
return mchp_rds_phy_write_mmd(clock,
MCHP_RDS_PTP_CLK_TRGT_RELOAD_NS_HI,
MCHP_RDS_PTP_CLOCK,
upper_16_bits(period_nsec) & 0x3fff);
}
static int mchp_set_clock_target(struct mchp_rds_ptp_clock *clock,
s64 start_sec, u32 start_nsec)
{
int rc;
/* Set the start time */
rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_SEC_LO,
MCHP_RDS_PTP_CLOCK,
lower_16_bits(start_sec));
if (rc < 0)
return rc;
rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_SEC_HI,
MCHP_RDS_PTP_CLOCK,
upper_16_bits(start_sec));
if (rc < 0)
return rc;
rc = mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_NS_LO,
MCHP_RDS_PTP_CLOCK,
lower_16_bits(start_nsec));
if (rc < 0)
return rc;
return mchp_rds_phy_write_mmd(clock, MCHP_RDS_PTP_CLK_TRGT_NS_HI,
MCHP_RDS_PTP_CLOCK,
upper_16_bits(start_nsec) & 0x3fff);
}
Annotation
- Immediate include surface: `microchip_rds_ptp.h`.
- Detected declarations: `function mchp_rds_phy_read_mmd`, `function mchp_rds_phy_write_mmd`, `function mchp_rds_phy_modify_mmd`, `function mchp_rds_phy_set_bits_mmd`, `function mchp_get_pulsewidth`, `function mchp_general_event_config`, `function mchp_set_clock_reload`, `function mchp_set_clock_target`, `function mchp_rds_ptp_perout_off`, `function mchp_get_event`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.