STRUCT XIIC_I2C(9)
π struct xiic_i2c(9) π
okay so bestie, welcome to the Kernel API Manual β¨ β this one's all about struct xiic_i2c, which is literally the internal representation of the XIIC I2C bus. think of it as the backstage pass π to how the driver keeps track of itself. no cap, it's a whole vibe.
πΈ SYNOPSIS πΈ
so here's the whole struct, and yes you're gonna want to read every line because it's all load-bearing, iykyk:
struct xiic_i2c {
struct device *dev;
void __iomem *base;
struct completion completion;
struct i2c_adapter adap;
struct i2c_msg *tx_msg;
struct mutex lock;
unsigned int tx_pos;
unsigned int nmsgs;
struct i2c_msg *rx_msg;
int rx_pos;
enum xiic_endian endianness;
struct clk *clk;
int irq;
enum xilinx_i2c_state state;
bool singlemaster;
bool dynamic;
bool prev_msg_tx;
u32 quirks;
bool smbus_block_read;
unsigned int smbus_actual_len;
unsigned long input_clk;
unsigned int i2c_clk;
bool atomic;
spinlock_t atomic_lock;
enum xilinx_i2c_state atomic_xfer_state;
};
π¦ MEMBERS π¦
okay this is the fun part β every single field, explained with the love and care it deserves π
devβ pointer to the device structure π«Άbaseβ the memory base of the HW registers, that's where the hardware lives frcompletionβ completion for callers, so the callers can chill until it's doneadapβ the kernel adapter representation, main character energy ngltx_msgβ messages from above that need to be sent πlockβ mutual exclusion, keepin' things politetx_posβ current pos in the TX message, like a little cursornmsgsβ number of messages intx_msgrx_msgβ the current RX messagerx_posβ position within the current RX messageendiannessβ big/little-endian byte order πclkβ pointer to the AXI4-lite input clock β°irqβ interrupt numberstateβ seeSTATE_πsinglemasterβ indicates the bus is single master πdynamicβ mode of the controllerprev_msg_txβ previous message is Txquirksβ to hold platform specific bug info π (yes, a whole field for bug lore)smbus_block_readβ flag to handle block readsmbus_actual_lenβ valid byte count (length + payload + optional PEC) of a padded SMBus block read.msg->lenis trimmed to this on completion. Zero when no trimming is needed. βοΈinput_clkβ input clock to the I2C controlleri2c_clkβ the I2C SCL frequency πatomicβ mode of transferatomic_lockβ lock for atomic transfer mode πatomic_xfer_stateβ seeSTATE_π (yes, again β it's giving twin energy)
β SEE ALSO β
go check out the kernel file ./drivers/i2c/busses/i2c-xiic.c, plus struct timing_regs(9) and xiic_setclk(9) β all iconic, all worth your time π§
bestie reminder: nothing here is invented, this is all straight from the source, I would never do you like that π
and that's a wrap! πΈ this page came from ./drivers/i2c/busses, dated October 2026, and it's struct xiic_i2c(9) in the Kernel API Manual β slay, go read the actual kernel now, periodt ππ₯
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms