linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What endianness is word in i2c_smbus_data?
@ 2013-07-17  1:57 Andy Lutomirski
       [not found] ` <CALCETrUKK2j17LP+dVe61UCj05w914RRgyGXhorP1nfS7=rKnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Lutomirski @ 2013-07-17  1:57 UTC (permalink / raw)
  To: linux-i2c, linux-kernel

I'm rather confused here.  In SMBUS, the "read word" operation returns
two bytes.  Just to be confusing, the SMBUS spec calls the first byte
"Data Byte Low" and the second byte "Data Byte High".  But they really
are the first and second bytes -- Read Word will return whatever Read
Byte would have as its first byte.  Let's call these bytes B1 and B2
for first and second.

The eeprom and at24 drivers expect data->word to be (B2 << 8) | B1.
That is, data->word is the cpu representation of the value on the bus
if that value is treated as little-endian.  Is that indeed the correct
interpretation?  If so, should it be documented somewhere?

--Andy

-- 
Andy Lutomirski
AMA Capital Management, LLC

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-17 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-17  1:57 What endianness is word in i2c_smbus_data? Andy Lutomirski
     [not found] ` <CALCETrUKK2j17LP+dVe61UCj05w914RRgyGXhorP1nfS7=rKnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-17 13:05   ` Paul Carpenter

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).