SAMA5D3/4 I2C: Test for read or write operation was reversed. How could this have worked before?

This commit is contained in:
Gregory Nutt 2014-07-07 09:54:43 -06:00
parent efa3783077
commit 95bbdb675b

View File

@ -683,7 +683,8 @@ static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
/* Set slave address and number of internal address bytes. */
twi_putrel(priv, SAM_TWI_MMR_OFFSET, 0);
twi_putrel(priv, SAM_TWI_MMR_OFFSET, TWI_MMR_IADRSZ_NONE | TWI_MMR_MREAD | TWI_MMR_DADR(msg->addr));
twi_putrel(priv, SAM_TWI_MMR_OFFSET, TWI_MMR_IADRSZ_NONE | TWI_MMR_MREAD |
TWI_MMR_DADR(msg->addr));
/* Set internal address bytes (not used) */
@ -738,7 +739,7 @@ static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg)
static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
if ((msg->flags & I2C_M_READ) == 0)
if ((msg->flags & I2C_M_READ) != 0)
{
twi_startread(priv, msg);
}
@ -756,7 +757,7 @@ static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
* Name: twi_setfrequency
*
* Description:
* Set the frequence for the next transfer
* Set the frequency for the next transfer
*
*******************************************************************************/