drivers/ptp/ptp_ines.c
Source file repositories/reference/linux-study-clean/drivers/ptp/ptp_ines.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ptp/ptp_ines.c- Extension
.c- Size
- 19616 bytes
- Lines
- 815
- Domain
- Driver Families
- Bucket
- drivers/ptp
- 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.
- 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/ethtool.hlinux/export.hlinux/if_vlan.hlinux/mii_timestamper.hlinux/module.hlinux/net_tstamp.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/phy.hlinux/platform_device.hlinux/ptp_classify.hlinux/ptp_clock_kernel.hlinux/stddef.h
Detected Declarations
struct ines_global_regsstruct ines_port_registersstruct ines_timestampstruct ines_portstruct ines_clockfunction ines_clock_cleanupfunction ines_clock_initfunction ines_find_rxtsfunction ines_find_txtsfunction ines_hwtstamp_getfunction ines_hwtstamp_setfunction ines_link_statefunction ines_matchfunction ines_rxtstampfunction ines_rxfifo_readfunction ines_rxts64function ines_timestamp_expiredfunction ines_ts_infofunction ines_txts64function ines_txts_onestepfunction ines_txtstampfunction ines_txtstamp_workfunction is_sync_pdelay_respfunction tag_to_msgtypefunction ines_ptp_release_channelfunction ines_ptp_ctrl_probefunction ines_ptp_ctrl_remove
Annotated Snippet
struct ines_global_regs {
u32 id;
u32 test;
u32 global;
u32 version;
u32 test2;
u32 int_stat;
u32 int_msk;
u32 buf_stat;
};
struct ines_port_registers {
u32 port_conf;
u32 p_delay;
u32 ts_stat_tx;
u32 ts_stat_rx;
u32 ts_tx;
u32 ts_rx;
};
struct ines_timestamp {
struct list_head list;
unsigned long tmo;
u16 tag;
u64 sec;
u64 nsec;
u64 clkid;
u16 portnum;
u16 seqid;
};
struct ines_port {
struct ines_port_registers *regs;
struct mii_timestamper mii_ts;
struct ines_clock *clock;
bool rxts_enabled;
bool txts_enabled;
unsigned int index;
struct delayed_work ts_work;
/* lock protects event list and tx_skb */
spinlock_t lock;
struct sk_buff *tx_skb;
struct list_head events;
struct list_head pool;
struct ines_timestamp pool_data[INES_MAX_EVENTS];
};
struct ines_clock {
struct ines_port port[INES_N_PORTS];
struct ines_global_regs __iomem *regs;
void __iomem *base;
struct device_node *node;
struct device *dev;
struct list_head list;
};
static bool ines_match(struct sk_buff *skb, unsigned int ptp_class,
struct ines_timestamp *ts, struct device *dev);
static int ines_rxfifo_read(struct ines_port *port);
static u64 ines_rxts64(struct ines_port *port, unsigned int words);
static bool ines_timestamp_expired(struct ines_timestamp *ts);
static u64 ines_txts64(struct ines_port *port, unsigned int words);
static void ines_txtstamp_work(struct work_struct *work);
static bool is_sync_pdelay_resp(struct sk_buff *skb, int type);
static u8 tag_to_msgtype(u8 tag);
static void ines_clock_cleanup(struct ines_clock *clock)
{
struct ines_port *port;
int i;
for (i = 0; i < INES_N_PORTS; i++) {
port = &clock->port[i];
cancel_delayed_work_sync(&port->ts_work);
}
}
static int ines_clock_init(struct ines_clock *clock, struct device *device,
void __iomem *addr)
{
struct device_node *node = device->of_node;
unsigned long port_addr;
struct ines_port *port;
int i, j;
INIT_LIST_HEAD(&clock->list);
clock->node = node;
clock->dev = device;
clock->base = addr;
clock->regs = clock->base;
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/export.h`, `linux/if_vlan.h`, `linux/mii_timestamper.h`, `linux/module.h`, `linux/net_tstamp.h`, `linux/of.h`, `linux/of_address.h`.
- Detected declarations: `struct ines_global_regs`, `struct ines_port_registers`, `struct ines_timestamp`, `struct ines_port`, `struct ines_clock`, `function ines_clock_cleanup`, `function ines_clock_init`, `function ines_find_rxts`, `function ines_find_txts`, `function ines_hwtstamp_get`.
- Atlas domain: Driver Families / drivers/ptp.
- 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.