drivers/net/phy/nxp-c45-tja11xx.c

Source file repositories/reference/linux-study-clean/drivers/net/phy/nxp-c45-tja11xx.c

File Facts

System
Linux kernel
Corpus path
drivers/net/phy/nxp-c45-tja11xx.c
Extension
.c
Size
61490 bytes
Lines
2191
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct nxp_c45_skb_cb {
	struct ptp_header *header;
	unsigned int type;
};

#define NXP_C45_REG_FIELD(_reg, _devad, _offset, _size)	\
	((struct nxp_c45_reg_field) {			\
		.reg = _reg,				\
		.devad =  _devad,			\
		.offset = _offset,			\
		.size = _size,				\
	})

struct nxp_c45_reg_field {
	u16 reg;
	u8 devad;
	u8 offset;
	u8 size;
};

struct nxp_c45_hwts {
	u32	nsec;
	u32	sec;
	u8	domain_number;
	u16	sequence_id;
	u8	msg_type;
};

struct nxp_c45_regmap {
	/* PTP config regs. */
	u16 vend1_ptp_clk_period;
	u16 vend1_event_msg_filt;

	/* LTC bits and regs. */
	struct nxp_c45_reg_field ltc_read;
	struct nxp_c45_reg_field ltc_write;
	struct nxp_c45_reg_field ltc_lock_ctrl;
	u16 vend1_ltc_wr_nsec_0;
	u16 vend1_ltc_wr_nsec_1;
	u16 vend1_ltc_wr_sec_0;
	u16 vend1_ltc_wr_sec_1;
	u16 vend1_ltc_rd_nsec_0;
	u16 vend1_ltc_rd_nsec_1;
	u16 vend1_ltc_rd_sec_0;
	u16 vend1_ltc_rd_sec_1;
	u16 vend1_rate_adj_subns_0;
	u16 vend1_rate_adj_subns_1;

	/* External trigger reg fields. */
	struct nxp_c45_reg_field irq_egr_ts_en;
	struct nxp_c45_reg_field irq_egr_ts_status;
	struct nxp_c45_reg_field domain_number;
	struct nxp_c45_reg_field msg_type;
	struct nxp_c45_reg_field sequence_id;
	struct nxp_c45_reg_field sec_1_0;
	struct nxp_c45_reg_field sec_4_2;
	struct nxp_c45_reg_field nsec_15_0;
	struct nxp_c45_reg_field nsec_29_16;

	/* PPS and EXT Trigger bits and regs. */
	struct nxp_c45_reg_field pps_enable;
	struct nxp_c45_reg_field pps_polarity;
	u16 vend1_ext_trg_data_0;
	u16 vend1_ext_trg_data_1;
	u16 vend1_ext_trg_data_2;
	u16 vend1_ext_trg_data_3;
	u16 vend1_ext_trg_ctrl;

	/* Cable test reg fields. */
	u16 cable_test;
	struct nxp_c45_reg_field cable_test_valid;
	struct nxp_c45_reg_field cable_test_result;
};

struct nxp_c45_phy_stats {
	const char	*name;
	const struct nxp_c45_reg_field counter;
};

struct nxp_c45_phy_data {
	const struct nxp_c45_regmap *regmap;
	const struct nxp_c45_phy_stats *stats;
	int n_stats;
	u8 ptp_clk_period;
	bool ext_ts_both_edges;
	bool ack_ptp_irq;
	void (*counters_enable)(struct phy_device *phydev);
	bool (*get_egressts)(struct nxp_c45_phy *priv,
			     struct nxp_c45_hwts *hwts);
	bool (*get_extts)(struct nxp_c45_phy *priv, struct timespec64 *extts);

Annotation

Implementation Notes