public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Troy Kisky
	<troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>
Cc: i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org,
	Kevin Hilman <khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] ARM: DaVinci: I2C: enable zero-length transfer hack
Date: Tue, 12 Feb 2008 16:56:06 +0100	[thread overview]
Message-ID: <20080212165606.6ad455f6@hyperion.delvare> (raw)
In-Reply-To: <1202781587-3274-1-git-send-email-troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>

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

      parent reply	other threads:[~2008-02-12 15:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080212165606.6ad455f6@hyperion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org \
    --cc=troy.kisky-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox