i2c: imx: add slave support. v2
PATCH 1/1 i2c: imx: add slave support. v2
Add I2C slave provider using the generic slave interface. It also supports master transactions when the slave in the idle mode.
Issues:
Changes work only in PIO mode (when driver doesnt use DMA) It werent tested with DMA is enabled (in PIO mode it works well) There are might be race conditions.
We hope that these changes will be helpfull.
Thank you.
--- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-imx.c | 311 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 291 insertions(+), 21 deletions(-)
drivers/i2c/busses/Kconfig +1 -0
@@ -587,6 +587,7 @@ config I2C_IMG config I2C_IMX tristate "IMX I2C interface" depends on ARCH_MXC || ARCH_LAYERSCAPE + select I2C_SLAVE help Say Y here if you want to use the IIC bus controller on the Freescale i.MX/MXC or Layerscape processors.
drivers/i2c/busses/i2c-imx.c +290 -21
424 lines not on this page · raw message
Signature · 1 line
2.5.0
Quoted 5 lines · Dmitriy Baranov
Add I2C slave provider using the generic slave interface. It also supports master transactions when the slave in the idle mode.
Issues:
Changes work only in PIO mode (when driver doesn`t use DMA)
This is fine with me. We don't support block transfers currently in the slave core anyhow.
Quoted 1 line
There are might be race conditions.
Can you name them
drivers/i2c/busses/i2c-imx.c enum imx_i2c_type { · line 184
Quoted 4 lines
drivers/i2c/busses/i2c-imx.c +4
-0+enum imx_i2c_slave_state { +I2C_IMX_SLAVE_IDLE , +I2C_IMX_SLAVE_IRQ , +I2C_IMX_SLAVE_POLLING
Highlevel question first: Why do you have polling? Why would anyone not want to use interrupts here?
Hi Wolfram,
I'm now working on creating new driver version. I think I'll be able to sent it soon.
04.03.2016 0:35, Wolfram Sang пишет:
Quoted 2 lines
Quoted 1 line
There are might be race conditions.
Can you name them
Most of races are fixed already. There were some issues with interrupt latencies - sometimes slave interrupt appears in process of starting master xfer.
Quoted 6 lines
drivers/i2c/busses/i2c-imx.c enum imx_i2c_type { · line 184
Quoted 4 lines
drivers/i2c/busses/i2c-imx.c +4
-0+enum imx_i2c_slave_state { +I2C_IMX_SLAVE_IDLE , +I2C_IMX_SLAVE_IRQ , +I2C_IMX_SLAVE_POLLING Highlevel question first: Why do you have polling? Why would anyone not want to use interrupts here?
Since imx doesn't generate interrupt on "bus stop" condition we'd had to implement polling scheme. Interrupts are used for starting polling and for waking polling loop on new slave request. Without polling we can't handle "end-of-packet" event correctly.
In current version states are:
I2C_IMX_SLAVE_IDLE // default state. slave process is waiting for interrupt I2C_IMX_SLAVE_POLLING // slave transfer is in process.
I2C_IMX_MASTER // master transfer is in process.