drivers/net/phy/dp83640.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/dp83640.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/dp83640.c- Extension
.c- Size
- 38583 bytes
- Lines
- 1544
- 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.
- 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
linux/crc32.hlinux/ethtool.hlinux/kernel.hlinux/list.hlinux/mii.hlinux/module.hlinux/net_tstamp.hlinux/netdevice.hlinux/if_vlan.hlinux/phy.hlinux/ptp_classify.hlinux/ptp_clock_kernel.hdp83640_reg.h
Detected Declarations
struct dp83640_skb_infostruct phy_rxtsstruct phy_txtsstruct rxtsstruct dp83640_clockstruct dp83640_privatestruct dp83640_clockfunction dp83640_gpio_defaultsfunction broadcast_writefunction ext_readfunction ext_writefunction tdr_writefunction phy2rxtsfunction phy2txtsfunction periodic_outputfunction ptp_dp83640_adjfinefunction ptp_dp83640_adjtimefunction ptp_dp83640_gettimefunction ptp_dp83640_settimefunction ptp_dp83640_enablefunction ptp_dp83640_verifyfunction enable_status_framesfunction is_status_framefunction expiredfunction prune_rx_tsfunction list_for_each_safefunction enable_broadcastfunction recalibratefunction list_for_each_entryfunction exts_chan_to_edatafunction decode_evntfunction matchfunction decode_rxtsfunction decode_txtsfunction decode_status_framefunction dp83640_clock_initfunction choose_this_phyfunction list_for_eachfunction dp83640_clock_putfunction dp83640_soft_resetfunction dp83640_config_initfunction dp83640_ack_interruptfunction dp83640_config_intrfunction dp83640_handle_interruptfunction dp83640_hwtstamp_getfunction dp83640_hwtstamp_setfunction rx_timestamp_workfunction dp83640_rxtstamp
Annotated Snippet
struct dp83640_skb_info {
int ptp_type;
unsigned long tmo;
};
struct phy_rxts {
u16 ns_lo; /* ns[15:0] */
u16 ns_hi; /* overflow[1:0], ns[29:16] */
u16 sec_lo; /* sec[15:0] */
u16 sec_hi; /* sec[31:16] */
u16 seqid; /* sequenceId[15:0] */
u16 msgtype; /* messageType[3:0], hash[11:0] */
};
struct phy_txts {
u16 ns_lo; /* ns[15:0] */
u16 ns_hi; /* overflow[1:0], ns[29:16] */
u16 sec_lo; /* sec[15:0] */
u16 sec_hi; /* sec[31:16] */
};
struct rxts {
struct list_head list;
unsigned long tmo;
u64 ns;
u16 seqid;
u8 msgtype;
u16 hash;
};
struct dp83640_clock;
struct dp83640_private {
struct list_head list;
struct dp83640_clock *clock;
struct phy_device *phydev;
struct mii_timestamper mii_ts;
struct delayed_work ts_work;
int hwts_tx_en;
int hwts_rx_en;
int layer;
int version;
/* remember state of cfg0 during calibration */
int cfg0;
/* remember the last event time stamp */
struct phy_txts edata;
/* list of rx timestamps */
struct list_head rxts;
struct list_head rxpool;
struct rxts rx_pool_data[MAX_RXTS];
/* protects above three fields from concurrent access */
spinlock_t rx_lock;
/* queues of incoming and outgoing packets */
struct sk_buff_head rx_queue;
struct sk_buff_head tx_queue;
};
struct dp83640_clock {
/* keeps the instance in the 'phyter_clocks' list */
struct list_head list;
/* we create one clock instance per MII bus */
struct mii_bus *bus;
/* protects extended registers from concurrent access */
struct mutex extreg_lock;
/* remembers which page was last selected */
int page;
/* our advertised capabilities */
struct ptp_clock_info caps;
/* protects the three fields below from concurrent access */
struct mutex clock_lock;
/* the one phyter from which we shall read */
struct dp83640_private *chosen;
/* list of the other attached phyters, not chosen */
struct list_head phylist;
/* reference to our PTP hardware clock */
struct ptp_clock *ptp_clock;
};
/* globals */
enum {
CALIBRATE_GPIO,
PEROUT_GPIO,
EXTTS0_GPIO,
EXTTS1_GPIO,
EXTTS2_GPIO,
EXTTS3_GPIO,
EXTTS4_GPIO,
EXTTS5_GPIO,
GPIO_TABLE_SIZE
Annotation
- Immediate include surface: `linux/crc32.h`, `linux/ethtool.h`, `linux/kernel.h`, `linux/list.h`, `linux/mii.h`, `linux/module.h`, `linux/net_tstamp.h`, `linux/netdevice.h`.
- Detected declarations: `struct dp83640_skb_info`, `struct phy_rxts`, `struct phy_txts`, `struct rxts`, `struct dp83640_clock`, `struct dp83640_private`, `struct dp83640_clock`, `function dp83640_gpio_defaults`, `function broadcast_write`, `function ext_read`.
- 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.
- 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.