* [PATCH] ARM: DaVinci: I2C: enable zero-length transfer hack
@ 2008-02-12 1:59 Troy Kisky
[not found] ` <1202781587-3274-1-git-send-email-troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Troy Kisky @ 2008-02-12 1:59 UTC (permalink / raw)
To: i2c-GZX6beZjE8VD60Wz+7aTrA; +Cc: Kevin Hilman
From: Vladimir Barinov <vbarinov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
ARM: DaVinci: I2C: enable zero-length transfer hack
Signed-off-by: Vladimir Barinov <vbarinov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
---
drivers/i2c/busses/i2c-davinci.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 6767988..f348ee0 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -41,6 +41,11 @@
#include <asm/arch/i2c.h>
+/* Hack to enable zero length transfers and smbus quick until clean fix
+ * is available
+ */
+#define DAVINCI_HACK
+
/* ----- global defines ----------------------------------------------- */
#define DAVINCI_I2C_TIMEOUT (1*HZ)
@@ -236,9 +241,14 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
u32 stat;
u16 w;
int r;
+#ifdef DAVINCI_HACK
+ u8 zero_byte = 0;
+#endif
+#ifndef DAVINCI_HACK
if (msg->len == 0)
return -EINVAL;
+#endif
if (!pdata)
pdata = &davinci_i2c_platform_data_default;
@@ -249,8 +259,18 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
/* set the slave address */
davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg->addr);
+#ifndef DAVINCI_HACK
dev->buf = msg->buf;
dev->buf_len = msg->len;
+#else
+ if (msg->len == 0) {
+ dev->buf = &zero_byte;
+ dev->buf_len = 1;
+ } else {
+ dev->buf = msg->buf;
+ dev->buf_len = msg->len;
+ }
+#endif
davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len);
@@ -349,7 +369,11 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
static u32 i2c_davinci_func(struct i2c_adapter *adap)
{
+#ifndef DAVINCI_HACK
return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
+#else
+ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+#endif
}
/*
--
1.5.4
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1202781587-3274-1-git-send-email-troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>]
* Re: [PATCH] ARM: DaVinci: I2C: enable zero-length transfer hack [not found] ` <1202781587-3274-1-git-send-email-troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org> @ 2008-02-12 5:22 ` Kevin Hilman 2008-02-12 15:56 ` Jean Delvare 1 sibling, 0 replies; 3+ messages in thread From: Kevin Hilman @ 2008-02-12 5:22 UTC (permalink / raw) To: Troy Kisky; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA Troy Kisky <troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org> writes: > From: Vladimir Barinov <vbarinov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> > > ARM: DaVinci: I2C: enable zero-length transfer hack Troy, Please send your other DaVinci i2c fixes and cleanups, but leave this one out for now. This is a temporary hack. Kevin _______________________________________________ i2c mailing list i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org http://lists.lm-sensors.org/mailman/listinfo/i2c ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: DaVinci: I2C: enable zero-length transfer hack [not found] ` <1202781587-3274-1-git-send-email-troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org> 2008-02-12 5:22 ` Kevin Hilman @ 2008-02-12 15:56 ` Jean Delvare 1 sibling, 0 replies; 3+ messages in thread From: Jean Delvare @ 2008-02-12 15:56 UTC (permalink / raw) To: Troy Kisky; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA, Kevin Hilman Hi Troy, On Mon, 11 Feb 2008 18:59:47 -0700, Troy Kisky wrote: > From: Vladimir Barinov <vbarinov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> > > ARM: DaVinci: I2C: enable zero-length transfer hack > > Signed-off-by: Vladimir Barinov <vbarinov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> > Signed-off-by: Kevin Hilman <khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org> > --- > drivers/i2c/busses/i2c-davinci.c | 24 ++++++++++++++++++++++++ > 1 files changed, 24 insertions(+), 0 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c > index 6767988..f348ee0 100644 > --- a/drivers/i2c/busses/i2c-davinci.c > +++ b/drivers/i2c/busses/i2c-davinci.c > @@ -41,6 +41,11 @@ > > #include <asm/arch/i2c.h> > > +/* Hack to enable zero length transfers and smbus quick until clean fix > + * is available > + */ > +#define DAVINCI_HACK > + > /* ----- global defines ----------------------------------------------- */ > > #define DAVINCI_I2C_TIMEOUT (1*HZ) > @@ -236,9 +241,14 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) > u32 stat; > u16 w; > int r; > +#ifdef DAVINCI_HACK > + u8 zero_byte = 0; > +#endif > > +#ifndef DAVINCI_HACK > if (msg->len == 0) > return -EINVAL; > +#endif > > if (!pdata) > pdata = &davinci_i2c_platform_data_default; > @@ -249,8 +259,18 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) > /* set the slave address */ > davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg->addr); > > +#ifndef DAVINCI_HACK > dev->buf = msg->buf; > dev->buf_len = msg->len; > +#else > + if (msg->len == 0) { > + dev->buf = &zero_byte; > + dev->buf_len = 1; > + } else { > + dev->buf = msg->buf; > + dev->buf_len = msg->len; > + } > +#endif > > davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len); > > @@ -349,7 +369,11 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) > > static u32 i2c_davinci_func(struct i2c_adapter *adap) > { > +#ifndef DAVINCI_HACK > return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); > +#else > + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; > +#endif > } > > /* Nack. If the hardware doesn't support zero-byte transactions, it doesn't support them, period. The new i2c framework makes it very easy to live without these transactions anyway. -- Jean Delvare _______________________________________________ i2c mailing list i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org http://lists.lm-sensors.org/mailman/listinfo/i2c ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-12 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-12 1:59 [PATCH] ARM: DaVinci: I2C: enable zero-length transfer hack Troy Kisky
[not found] ` <1202781587-3274-1-git-send-email-troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>
2008-02-12 5:22 ` Kevin Hilman
2008-02-12 15:56 ` Jean Delvare
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox