Skip to content

Commit 02e6427

Browse files
Fabrice GasnierWolfram Sang
authored andcommitted
i2c: stm32f7: fix first byte to send in slave mode
The slave-interface documentation [1] states "the bus driver should transmit the first byte" upon I2C_SLAVE_READ_REQUESTED slave event: - 'val': backend returns first byte to be sent The driver currently ignores the 1st byte to send on this event. [1] https://www.kernel.org/doc/Documentation/i2c/slave-interface Fixes: 60d609f ("i2c: i2c-stm32f7: Add slave support") Signed-off-by: Fabrice Gasnier <[email protected]> Reviewed-by: Pierre-Yves MORDRET <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 62931ac commit 02e6427

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/i2c/busses/i2c-stm32f7.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,8 @@ static void stm32f7_i2c_slave_start(struct stm32f7_i2c_dev *i2c_dev)
11921192
STM32F7_I2C_CR1_TXIE;
11931193
stm32f7_i2c_set_bits(base + STM32F7_I2C_CR1, mask);
11941194

1195+
/* Write 1st data byte */
1196+
writel_relaxed(value, base + STM32F7_I2C_TXDR);
11951197
} else {
11961198
/* Notify i2c slave that new write transfer is starting */
11971199
i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);

0 commit comments

Comments
 (0)