All of lore.kernel.org
 help / color / mirror / Atom feed
From: khali@linux-fr.org (Jean Delvare)
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: LM Sensors <lm-sensors@lm-sensors.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [lm-sensors] Re: I2C block reads with i2c-viapro: testers wanted
Date: Fri, 12 Aug 2005 08:26:50 +0000	[thread overview]
Message-ID: <20050812082653.098a6aa3.khali@linux-fr.org> (raw)
In-Reply-To: <m3br44t9cv.fsf@defiant.localdomain>

Hi Krzysztof,

> So, with one transaction, can I write an arbitrary number of bytes to
> the device, and then, in the same transaction, can I read one (or no,
> or with some controllers, more than one) byte(s) back?

In I2C mode, you can even alternate as many read and write sequences you
want in a single transaction. The target chip would of course need to
know how to interpret such a transaction though. I've never seen this
possibility used so far.

In SMBus mode, you are limited by the transaction types that have been
defined, but a number of them are composed of a write transaction and a
read transaction (separated by what is known as a "repeated start").
Read Byte, Read Word, Read Block and Read I2C Block are such
transactions. See the SMBus specification for the details.

> Interesting. Still, that limits it to 8-bit-addressable EEPROMs.

Depends on the SMBus. A SMBus controller could implement 16-bit address
I2C block transfers. I don't think I saw one do so far, but it's still
possible in theory.

Also note that this can easily be emulated using a Write Byte command
(which writes 2 bytes on the bus) to set the 16-bit addressed EEPROM
offset, then using continuous Receive Byte commands to get the data.
This is of course slower than a block read though.

> Are such things documented somewhere on the net (some datasheet
> maybe)?

The I2C specifications are available from Philips. The SMBus
specifications are available from smbus.org. Intel also has good
datasheets for all ICH chips.

http://www.semiconductors.philips.com/markets/mms/protocols/i2c/
http://www.smbus.org/specs/

More generally, see the lm_sensors project's links page:
http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/doc/useful_addresses.html
and also:
http://secure.netroedge.com/~lm78/docs.html

Hope that helps,
-- 
Jean Delvare

WARNING: multiple messages have this Message-ID (diff)
From: Jean Delvare <khali@linux-fr.org>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: LM Sensors <lm-sensors@lm-sensors.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: I2C block reads with i2c-viapro: testers wanted
Date: Fri, 12 Aug 2005 08:26:53 +0200	[thread overview]
Message-ID: <20050812082653.098a6aa3.khali@linux-fr.org> (raw)
In-Reply-To: <m3br44t9cv.fsf@defiant.localdomain>

Hi Krzysztof,

> So, with one transaction, can I write an arbitrary number of bytes to
> the device, and then, in the same transaction, can I read one (or no,
> or with some controllers, more than one) byte(s) back?

In I2C mode, you can even alternate as many read and write sequences you
want in a single transaction. The target chip would of course need to
know how to interpret such a transaction though. I've never seen this
possibility used so far.

In SMBus mode, you are limited by the transaction types that have been
defined, but a number of them are composed of a write transaction and a
read transaction (separated by what is known as a "repeated start").
Read Byte, Read Word, Read Block and Read I2C Block are such
transactions. See the SMBus specification for the details.

> Interesting. Still, that limits it to 8-bit-addressable EEPROMs.

Depends on the SMBus. A SMBus controller could implement 16-bit address
I2C block transfers. I don't think I saw one do so far, but it's still
possible in theory.

Also note that this can easily be emulated using a Write Byte command
(which writes 2 bytes on the bus) to set the 16-bit addressed EEPROM
offset, then using continuous Receive Byte commands to get the data.
This is of course slower than a block read though.

> Are such things documented somewhere on the net (some datasheet
> maybe)?

The I2C specifications are available from Philips. The SMBus
specifications are available from smbus.org. Intel also has good
datasheets for all ICH chips.

http://www.semiconductors.philips.com/markets/mms/protocols/i2c/
http://www.smbus.org/specs/

More generally, see the lm_sensors project's links page:
http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/doc/useful_addresses.html
and also:
http://secure.netroedge.com/~lm78/docs.html

Hope that helps,
-- 
Jean Delvare

  reply	other threads:[~2005-08-12  8:26 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-09 21:13 I2C block reads with i2c-viapro: testers wanted Jean Delvare
2005-08-09 23:13 ` [lm-sensors] " Jean Delvare
2005-08-10 20:31 ` Hinko Kocevar
2005-08-10 22:32   ` [lm-sensors] " Hinko Kocevar
2005-08-10 21:06   ` Jean Delvare
2005-08-10 23:06     ` [lm-sensors] " Jean Delvare
2005-08-10 22:23     ` Martin Drab
2005-08-11  0:25       ` Martin Drab
2005-08-11 17:12       ` Jean Delvare
2005-08-11 19:12         ` Jean Delvare
2005-08-10 23:13     ` Hinko Kocevar
2005-08-11  1:13       ` [lm-sensors] " Hinko Kocevar
2005-08-11 16:56       ` Jean Delvare
2005-08-11 18:56         ` [lm-sensors] " Jean Delvare
2005-08-11 19:13         ` Krzysztof Halasa
2005-08-11 21:14           ` [lm-sensors] " Krzysztof Halasa
2005-08-11 19:59           ` Jean Delvare
2005-08-11 21:59             ` [lm-sensors] " Jean Delvare
2005-08-11 21:39             ` Krzysztof Halasa
2005-08-11 23:40               ` [lm-sensors] " Krzysztof Halasa
2005-08-11 21:49               ` Jean Delvare
2005-08-11 23:49                 ` [lm-sensors] " Jean Delvare
2005-08-11 22:08                 ` Krzysztof Halasa
2005-08-12  0:08                   ` [lm-sensors] " Krzysztof Halasa
2005-08-12  6:26                   ` Jean Delvare [this message]
2005-08-12  8:26                     ` Jean Delvare
2005-08-12 15:29                     ` Krzysztof Halasa
2005-08-12 17:30                       ` [lm-sensors] " Krzysztof Halasa
2005-08-12 17:58                       ` Jean Delvare
2005-08-12 19:58                         ` [lm-sensors] " Jean Delvare
2005-08-12  1:07 ` [lm-sensors] " Mark M. Hoffman
2005-08-12  3:08   ` Mark M. Hoffman
2005-08-12  6:02   ` Jean Delvare
2005-08-12  8:02     ` Jean Delvare
2005-08-13  4:28 ` Mark M. Hoffman
2005-08-13  8:46 ` Jean Delvare
  -- strict thread matches above, loose matches on Subject: below --
2005-08-10  1:55 Salah Coronya
2005-08-10  5:56 ` [lm-sensors] " Salah Coronya
2005-08-10 10:06 ` Jean Delvare
2005-08-10 12:15   ` [lm-sensors] " Jean Delvare
2005-08-11 18:30 Nick Warne

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=20050812082653.098a6aa3.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.