drivers/net/can/spi/mcp251xfd/mcp251xfd.h

Source file repositories/reference/linux-study-clean/drivers/net/can/spi/mcp251xfd/mcp251xfd.h

File Facts

System
Linux kernel
Corpus path
drivers/net/can/spi/mcp251xfd/mcp251xfd.h
Extension
.h
Size
30603 bytes
Lines
985
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 mcp251xfd_hw_tef_obj {
	u32 id;
	u32 flags;
	u32 ts;
};

/* The tx_obj_raw version is used in spi async, i.e. without
 * regmap. We have to take care of endianness ourselves.
 */
struct __packed mcp251xfd_hw_tx_obj_raw {
	__le32 id;
	__le32 flags;
	u8 data[sizeof_field(struct canfd_frame, data)];
};

struct mcp251xfd_hw_tx_obj_can {
	u32 id;
	u32 flags;
	u8 data[sizeof_field(struct can_frame, data)];
};

struct mcp251xfd_hw_tx_obj_canfd {
	u32 id;
	u32 flags;
	u8 data[sizeof_field(struct canfd_frame, data)];
};

struct mcp251xfd_hw_rx_obj_can {
	u32 id;
	u32 flags;
	u32 ts;
	u8 data[sizeof_field(struct can_frame, data)];
};

struct mcp251xfd_hw_rx_obj_canfd {
	u32 id;
	u32 flags;
	u32 ts;
	u8 data[sizeof_field(struct canfd_frame, data)];
};

struct __packed mcp251xfd_buf_cmd {
	__be16 cmd;
};

struct __packed mcp251xfd_buf_cmd_crc {
	__be16 cmd;
	u8 len;
};

union mcp251xfd_tx_obj_load_buf {
	struct __packed {
		struct mcp251xfd_buf_cmd cmd;
		struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
	} nocrc;
	struct __packed {
		struct mcp251xfd_buf_cmd_crc cmd;
		struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
		__be16 crc;
	} crc;
} ____cacheline_aligned;

union mcp251xfd_write_reg_buf {
	struct __packed {
		struct mcp251xfd_buf_cmd cmd;
		u8 data[4];
	} nocrc;
	struct __packed {
		struct mcp251xfd_buf_cmd_crc cmd;
		u8 data[4];
		__be16 crc;
	} crc;
	struct __packed {
		struct mcp251xfd_buf_cmd cmd;
		u8 data[1];
		__be16 crc;
	} safe;
} ____cacheline_aligned;

struct mcp251xfd_tx_obj {
	struct spi_message msg;
	struct spi_transfer xfer[2];
	union mcp251xfd_tx_obj_load_buf buf;
};

struct mcp251xfd_tef_ring {
	unsigned int head;
	unsigned int tail;

	/* u8 obj_num equals tx_ring->obj_num */

Annotation

Implementation Notes