[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrUKK2j17LP+dVe61UCj05w914RRgyGXhorP1nfS7=rKnA@mail.gmail.com>
Date: Tue, 16 Jul 2013 18:57:32 -0700
From: Andy Lutomirski <luto@...capital.net>
To: linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: What endianness is word in i2c_smbus_data?
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists