* [PATCH] i2c: rcar: bail out on zero length transfers
@ 2014-05-05 16:36 Wolfram Sang
2014-05-14 16:13 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2014-05-05 16:36 UTC (permalink / raw)
To: linux-sh
Cc: linux-arm-kernel, Wolfram Sang, Magnus Damm, Simon Horman,
Laurent Pinchart, linux-i2c, Kuninori Morimoto
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
This hardware does not support zero length transfers. Instead, the
driver does one (random) byte transfers currently with undefined results
for the slaves. We now bail out.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/i2c/busses/i2c-rcar.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 72a400a73cce..66c952e62f0a 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -552,6 +552,13 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
ret = -EINVAL;
for (i = 0; i < num; i++) {
+
+ /* This HW can't send STOP after address phase */
+ if (msgs[i].len == 0) {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
/*-------------- spin lock -----------------*/
spin_lock_irqsave(&priv->lock, flags);
@@ -616,7 +623,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
static u32 rcar_i2c_func(struct i2c_adapter *adap)
{
- return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+ /* This HW can't do SMBUS_QUICK and NOSTART */
+ return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
}
static const struct i2c_algorithm rcar_i2c_algo = {
--
1.9.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: rcar: bail out on zero length transfers
2014-05-05 16:36 [PATCH] i2c: rcar: bail out on zero length transfers Wolfram Sang
@ 2014-05-14 16:13 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2014-05-14 16:13 UTC (permalink / raw)
To: linux-sh
Cc: linux-arm-kernel, Magnus Damm, Simon Horman, Laurent Pinchart,
linux-i2c, Kuninori Morimoto
[-- Attachment #1: Type: text/plain, Size: 413 bytes --]
On Mon, May 05, 2014 at 06:36:21PM +0200, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> This hardware does not support zero length transfers. Instead, the
> driver does one (random) byte transfers currently with undefined results
> for the slaves. We now bail out.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Applied to for-current, thanks!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-14 16:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 16:36 [PATCH] i2c: rcar: bail out on zero length transfers Wolfram Sang
2014-05-14 16:13 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).