[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231003174246.vdazyls3c7kykd63@zenone.zhora.eu>
Date: Tue, 3 Oct 2023 19:42:46 +0200
From: Andi Shyti <andi.shyti@...nel.org>
To: Alain Volmat <alain.volmat@...s.st.com>
Cc: Pierre-Yves MORDRET <pierre-yves.mordret@...s.st.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
M'boumba Cedric Madianga <cedric.madianga@...il.com>,
Wolfram Sang <wsa@...nel.org>,
Pierre-Yves MORDRET <pierre-yves.mordret@...com>,
linux-i2c@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
Hi Alain,
On Mon, Oct 02, 2023 at 10:42:10AM +0200, Alain Volmat wrote:
> The PECBYTE bit allows to generate (in case of write) or
> compute/compare the PEC byte (in case of read). In case
> of reading a value (performed by first sending a write
> command, then followed by a read command) the PECBYTE should
> only be set before starting the read command and not before
> the first write command.
What is this patch fixing?
Can you please point this detail in the documentation, I haven't
found it[*]
> Fixes: 9e48155f6bfe ("i2c: i2c-stm32f7: Add initial SMBus protocols support")
>
> Signed-off-by: Alain Volmat <alain.volmat@...s.st.com>
please, don't leave blank lines between tags.
Thanks,
Andi
[*] Hope this is the correct one:
https://www.st.com/resource/en/reference_manual/rm0385-stm32f75xxx-and-stm32f74xxx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
> ---
> drivers/i2c/busses/i2c-stm32f7.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
> index 579b30581725..0d3c9a041b56 100644
> --- a/drivers/i2c/busses/i2c-stm32f7.c
> +++ b/drivers/i2c/busses/i2c-stm32f7.c
> @@ -1059,9 +1059,10 @@ static int stm32f7_i2c_smbus_xfer_msg(struct stm32f7_i2c_dev *i2c_dev,
> /* Configure PEC */
> if ((flags & I2C_CLIENT_PEC) && f7_msg->size != I2C_SMBUS_QUICK) {
> cr1 |= STM32F7_I2C_CR1_PECEN;
> - cr2 |= STM32F7_I2C_CR2_PECBYTE;
> - if (!f7_msg->read_write)
> + if (!f7_msg->read_write) {
> + cr2 |= STM32F7_I2C_CR2_PECBYTE;
> f7_msg->count++;
> + }
> } else {
> cr1 &= ~STM32F7_I2C_CR1_PECEN;
> cr2 &= ~STM32F7_I2C_CR2_PECBYTE;
> @@ -1149,8 +1150,10 @@ static void stm32f7_i2c_smbus_rep_start(struct stm32f7_i2c_dev *i2c_dev)
> f7_msg->stop = true;
>
> /* Add one byte for PEC if needed */
> - if (cr1 & STM32F7_I2C_CR1_PECEN)
> + if (cr1 & STM32F7_I2C_CR1_PECEN) {
> + cr2 |= STM32F7_I2C_CR2_PECBYTE;
> f7_msg->count++;
> + }
>
> /* Set number of bytes to be transferred */
> cr2 &= ~(STM32F7_I2C_CR2_NBYTES_MASK);
> --
> 2.25.1
>
Powered by blists - more mailing lists