Forum Discussion
Probably a problem in Linux driver i2c-altera.c
According to the documentation (Documentation/i2c/dev-interface):
ioctl (file, I2C_RDWR, struct i2c_rdwr_ioctl_data * msgset)
Do combined read / write transaction without stop in between.
Only valid if the adapter has I2C_FUNC_I2C. The argument is
a pointer to a
struct i2c_rdwr_ioctl_data {
struct i2c_msg * msgs; / * ptr to array of simple messages * /
int nmsgs; / * number of messages to exchange * /
}
The msgs [] themselves contain further pointers into data buffers.
If you’re looking at what I2C_M_RD I’m flag on
Overlaying the ivectl's
The i2c-altera.c driver has I2C_FUNC_I2C:
static u32 altr_i2c_func (struct i2c_adapter * adap)
{
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
} The driver sets STOP when i2c_msg.len = 1 (last data byte):
static void altr_i2c_transfer (struct altr_i2c_dev * idev, u32 data)
{
/ * On the last byte, send STOP * /
if (idev-> msg_len == 1)
data | = ALTR_I2C_TFR_CMD_STO;
if (idev-> msg_len> 0)
writel (data, idev-> base + ALTR_I2C_TFR_CMD);
} Correctly put STOP after the last byte of the last message.
Any thoughts on how to fix this?