
Hi Simon,
Hi,
On 30 January 2015 at 10:56, Lubomir Popov lpopov@mm-sol.com wrote:
I2C chips do exist that require a write of some multi-byte data to occur in a single bus transaction (aka atomic transfer), otherwise either the write does not come into effect at all, or normal operation of internal circuitry cannot be guaranteed. The current implementation of the 'i2c write' command (transfer of multiple bytes from a memory buffer) in fact performs a separate transaction for each byte to be written and thus cannot support such types of I2C slave devices.
This patch provides an alternative by allowing 'i2c write' to execute the write transfer of the given number of bytes in a single bus transaction if the '-s' option is specified as a final command argument. Else the current re-addressing method is used.
Signed-off-by: Lubomir Popov l-popov@ti.com
Changes in V3: Rebased on current master. Changes in V2: The option to use bulk transfer vs re-addressing is implemented as a run-time command argument. V1 used conditional compilation through a board header definition.
common/cmd_i2c.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-)
What platform are you testing on?
TI OMAP/ARM, in particular the J6Eco EVM (DRA726) where we have a I2C chip that requires this patch for proper operation of some of its functions.
It seems like you could implement this using driver model - just set or clear the DM_I2C_CHIP_WR_ADDRESS flag.
You are right, I could if I were sure that the DM is/shall be supported by all TI platforms and that I would not break anything now, about which I'm not... :( I'm looping in Tom here. Heiko had asked me just to rebase on current mainline, so that the patch applies cleanly, and that was what I did :)
That would solve the problem of existing platforms, since they could be tested when converted to driver model.
So what do you think about adjusting this patch to move the '#ifdef CONFIG_DM_I2C' outside the while loop, and set the flag instead? Although then your feature would only be available for driver model.
When/if the DM shall be supported by TI platforms.
Tom, do we have the DM enabled for any board, so that this could be tested?
Regards, Simon
Best regards, Lubo