fix SW PEC for write byte data
PATCH 1/1 fix SW PEC for write byte data
Index: kernel/i2c-core.c
=================================RCS file: /home/cvs/i2c/kernel/i2c-core.c,v retrieving revision 1.110
i2c-core.c +1 -1
@@ -979,7 +979,7 @@break ;case I2C_SMBUS_BYTE_DATA : buf[2 ] = data->byte; - data->word = buf[2 ] || + data->word = buf[2 ] | (i2c_smbus_pec (3 , buf,NULL ) <<8 ); size =I2C_SMBUS_WORD_DATA ;break ;
----
Hideki IWAMOTO [email protected]
PATCH 1/1 fix SW PEC for write byte data
Konbanwa Hideki,
i2c-core.c line 985
Quoted 9 lines
i2c-core.c +1
-1@@ -979,7 +979,7 @@break ;case I2C_SMBUS_BYTE_DATA : buf[2 ] = data->byte; - data->word = buf[2 ] || + data->word = buf[2 ] | (i2c_smbus_pec (3 , buf,NULL ) <<8 ); size =I2C_SMBUS_WORD_DATA ;break ;
Eek, this one was weird :( Looks like nobody ever used this code. Thanks a lot for reporting all these errors in our code. I've committed your fix to i2c CVS already and will port it to Linux 2.6 as well.
Arigato,
Signature · 1 line
Jean Delvare
PATCH 1/1 fix SW PEC for write byte data
In reply to Hideki IWAMOTOQuoted 18 lines · Jean Delvare
Konbanwa Hideki,
i2c-core.c line 985
Quoted 9 lines
i2c-core.c +1
-1@@ -979,7 +979,7 @@break ;case I2C_SMBUS_BYTE_DATA : buf[2 ] = data->byte; - data->word = buf[2 ] || + data->word = buf[2 ] | (i2c_smbus_pec (3 , buf,NULL ) <<8 ); size =I2C_SMBUS_WORD_DATA ;break ;Eek, this one was weird :( Looks like nobody ever used this code. Thanks a lot for reporting all these errors in our code. I've committed your fix to i2c CVS already and will port it to Linux 2.6 as well.
Quoted 1 line
Arigato,
ha
of course I take blame and credit for PEC bugs.
PEC really used for block transfers (including ARP and the IPMI-over-I2C_, not familiar with any chip using it for single bytes.
PATCH 1/1 fix SW PEC for write byte data
In reply to Hideki IWAMOTOHi Mark, all,
Quoted 2 lines · Mark Studebaker
PEC really used for block transfers (including ARP and the IPMI-over-I2C), not familiar with any chip using it for single bytes.
Maybe the overhead in the case of short transactions frightened designers. Nevertheless, I have an ADM1032 evaluation board, and the ADM1032 is supposed to support PEC. I tried i2cdump in "bp" mode and it failed, but I guess this isn't surprising with Hideki reporting read_byte and read_byte_data w/PEC being broken. At least this should help me test any fix (or rewrite) I may do on software PEC support.
--
Jean Delvare