linux-stable/drivers/i2c
Alain Volmat c896ff2dd8 i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
In case of SMBUS byte read with PEC enabled, the whole transfer
is split into two commands.  A first write command, followed by
a read command.  The write command does not have any PEC byte
and a PEC byte is appended at the end of the read command.
(cf Read byte protocol with PEC in SMBUS specification)

Within the STM32 I2C controller, handling (either sending
or receiving) of the PEC byte is done via the PECBYTE bit in
register CR2.

Currently, the PECBYTE is set at the beginning of a transfer,
which lead to sending a PEC byte at the end of the write command
(hence losing the real last byte), and also does not check the
PEC byte received during the read command.

This patch corrects the function stm32f7_i2c_smbus_xfer_msg
in order to only set the PECBYTE during the read command.

Fixes: 9e48155f6b ("i2c: i2c-stm32f7: Add initial SMBus protocols support")
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
Acked-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2023-10-21 20:31:04 +02:00
..
algos i2c: algo: bit: allow getsda to be NULL 2023-01-23 23:15:49 +01:00
busses i2c: stm32f7: Fix PEC handling in case of SMBUS transfers 2023-10-21 20:31:04 +02:00
muxes i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node() 2023-10-21 19:57:18 +02:00
i2c-atr.c media: i2c: add I2C Address Translator (ATR) support 2023-07-14 13:11:44 +02:00
i2c-boardinfo.c i2c: Remove support for dangling device properties 2021-04-10 21:43:02 +02:00
i2c-core-acpi.c i2c: add fwnode APIs 2023-01-17 09:29:59 +01:00
i2c-core-base.c i2c: Add i2c_get_match_data() 2023-06-09 17:30:47 +02:00
i2c-core-of.c Char/Misc drivers for 6.4-rc1 2023-04-27 12:07:50 -07:00
i2c-core-slave.c i2c: add tracepoints for I2C slave events 2022-03-20 00:11:05 +01:00
i2c-core-smbus.c i2c: smbus: Check for parent device before dereference 2022-02-19 12:37:20 +01:00
i2c-core.h i2c: acpi: Use ACPI wake capability bit to set wake_irq 2022-10-04 15:41:12 +02:00
i2c-dev.c Merge 6.3-rc5 into driver-core-next 2023-04-03 09:33:30 +02:00
i2c-mux.c i2c: mux: Avoid potential false error message in i2c_mux_add_adapter 2023-09-25 08:22:02 +02:00
i2c-slave-eeprom.c i2c: Convert drivers to new .probe() callback 2023-03-09 21:59:30 +01:00
i2c-slave-testunit.c i2c: Convert drivers to new .probe() callback 2023-03-09 21:59:30 +01:00
i2c-smbus.c i2c: Convert drivers to new .probe() callback 2023-03-09 21:59:30 +01:00
i2c-stub.c i2c: stub: remove definition of DEBUG 2021-01-17 13:00:10 +01:00
Kconfig i2c: Make I2C_ATR invisible 2023-09-13 10:56:00 +02:00
Makefile media: i2c: add I2C Address Translator (ATR) support 2023-07-14 13:11:44 +02:00