* [PATCH] i2c: Bus drivers don't have to support I2C_M_REV_DIR_ADDR
@ 2009-09-30 20:22 Jean Delvare
[not found] ` <20090930222244.43b8d17d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Jean Delvare @ 2009-09-30 20:22 UTC (permalink / raw)
To: Linux I2C; +Cc: Ben Dooks
I2C bus drivers don't have to support I2C_M_REV_DIR_ADDR. It is a
deviation from the I2C specification, which only makes sense to
implement when really needed.
Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
---
drivers/i2c/busses/i2c-iop3xx.c | 6 ------
drivers/i2c/busses/i2c-mv64xxx.c | 3 ---
drivers/i2c/busses/i2c-powermac.c | 2 --
3 files changed, 11 deletions(-)
--- linux-2.6.32-rc1.orig/drivers/i2c/busses/i2c-iop3xx.c 2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6.32-rc1/drivers/i2c/busses/i2c-iop3xx.c 2009-09-30 21:34:01.000000000 +0200
@@ -56,12 +56,6 @@ iic_cook_addr(struct i2c_msg *msg)
if (msg->flags & I2C_M_RD)
addr |= 1;
- /*
- * Read or Write?
- */
- if (msg->flags & I2C_M_REV_DIR_ADDR)
- addr ^= 1;
-
return addr;
}
--- linux-2.6.32-rc1.orig/drivers/i2c/busses/i2c-mv64xxx.c 2009-09-28 10:28:36.000000000 +0200
+++ linux-2.6.32-rc1/drivers/i2c/busses/i2c-mv64xxx.c 2009-09-30 21:33:45.000000000 +0200
@@ -338,9 +338,6 @@ mv64xxx_i2c_prepare_for_io(struct mv64xx
if (msg->flags & I2C_M_RD)
dir = 1;
- if (msg->flags & I2C_M_REV_DIR_ADDR)
- dir ^= 1;
-
if (msg->flags & I2C_M_TEN) {
drv_data->addr1 = 0xf0 | (((u32)msg->addr & 0x300) >> 7) | dir;
drv_data->addr2 = (u32)msg->addr & 0xff;
--- linux-2.6.32-rc1.orig/drivers/i2c/busses/i2c-powermac.c 2009-09-30 20:29:42.000000000 +0200
+++ linux-2.6.32-rc1/drivers/i2c/busses/i2c-powermac.c 2009-09-30 21:33:39.000000000 +0200
@@ -156,8 +156,6 @@ static int i2c_powermac_master_xfer( str
return -EINVAL;
read = (msgs->flags & I2C_M_RD) != 0;
addrdir = (msgs->addr << 1) | read;
- if (msgs->flags & I2C_M_REV_DIR_ADDR)
- addrdir ^= 1;
rc = pmac_i2c_open(bus, 0);
if (rc)
--
Jean Delvare
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <20090930222244.43b8d17d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>]
* Re: [PATCH] i2c: Bus drivers don't have to support I2C_M_REV_DIR_ADDR [not found] ` <20090930222244.43b8d17d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org> @ 2009-10-13 22:50 ` Ben Dooks [not found] ` <20091013225010.GA15469-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Ben Dooks @ 2009-10-13 22:50 UTC (permalink / raw) To: Jean Delvare; +Cc: Linux I2C, Ben Dooks On Wed, Sep 30, 2009 at 10:22:44PM +0200, Jean Delvare wrote: > I2C bus drivers don't have to support I2C_M_REV_DIR_ADDR. It is a > deviation from the I2C specification, which only makes sense to > implement when really needed. Probably the right thing to do, does anything actually use this support? > Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> > Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org> > --- > drivers/i2c/busses/i2c-iop3xx.c | 6 ------ > drivers/i2c/busses/i2c-mv64xxx.c | 3 --- > drivers/i2c/busses/i2c-powermac.c | 2 -- I assume that I should merge this in my -next tree? -- Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/) 'a smiley only costs 4 bytes' ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20091013225010.GA15469-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>]
* Re: [PATCH] i2c: Bus drivers don't have to support I2C_M_REV_DIR_ADDR [not found] ` <20091013225010.GA15469-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org> @ 2009-10-14 8:35 ` Jean Delvare 0 siblings, 0 replies; 3+ messages in thread From: Jean Delvare @ 2009-10-14 8:35 UTC (permalink / raw) To: Ben Dooks; +Cc: Linux I2C Hi Ben, On Tue, 13 Oct 2009 23:50:10 +0100, Ben Dooks wrote: > On Wed, Sep 30, 2009 at 10:22:44PM +0200, Jean Delvare wrote: > > I2C bus drivers don't have to support I2C_M_REV_DIR_ADDR. It is a > > deviation from the I2C specification, which only makes sense to > > implement when really needed. > > Probably the right thing to do, does anything actually use this > support? As far as I know, the only chip which uses this is the "Maven" which is found on some Matrox G450 graphics cards to handle the second head. As the i2c-matroxfb driver builds on top of i2c-algo-bit, i2c-algo-bit is the only driver which needs to implement I2C_M_REV_DIR_ADDR. I've left it in i2c-algo-pcf and i2c-s3c2410 for now because at least they properly declare the I2C_FUNC_PROTOCOL_MANGLING functionality, but this could be reconsidered. The other protocol mangling flags are in a similar situation. For example I2C_M_NOSTART is only used by the Intel i915 and Matrox Maven chips. Both use i2c-algo-but, but no less than 9 other I2C adapter drivers implement it! Most of these implementations have most probably never been tested, and I wouldn't be surprised if some don't work. I2C_M_IGNORE_NAK is only used by the msp3400 audio processing driver. But it is implemented by embedded I2C adapter drivers which probably will never see this chip: i2c-davinci, i2c-omap, i2c-s3c2410 and i2c-stu300. I2C_M_NO_RD_ACK is only used by the ks0127 video driver, and only i2c-algo-bit implements it. That one is correct. > > Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> > > Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org> > > --- > > drivers/i2c/busses/i2c-iop3xx.c | 6 ------ > > drivers/i2c/busses/i2c-mv64xxx.c | 3 --- > > drivers/i2c/busses/i2c-powermac.c | 2 -- > > I assume that I should merge this in my -next tree? Probably, yes. For now I have this patch in my own -next tree, but as all drivers affected are embedded ones, it would fit better in yours. I leave it up to you to decide what to do with the i2c-s3c2410 driver. As I understand it, it doesn't need to implement I2C_M_REV_DIR_ADDR nor I2C_M_IGNORE_NAK nor I2C_M_NOSTART, so you could simplify the code a bit and stop defining I2C_FUNC_PROTOCOL_MANGLING. BTW, is your -next tree visible somewhere? It might be convenient for me to be able to check what it includes. -- Jean Delvare ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-14 8:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30 20:22 [PATCH] i2c: Bus drivers don't have to support I2C_M_REV_DIR_ADDR Jean Delvare
[not found] ` <20090930222244.43b8d17d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-10-13 22:50 ` Ben Dooks
[not found] ` <20091013225010.GA15469-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2009-10-14 8:35 ` Jean Delvare
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox