[PATCHv2 2/2] i2c: stm32f7: do not set the STOP condition on error

Patrick DELAUNAY patrick.delaunay at foss.st.com
Fri Sep 9 11:35:41 CEST 2022


Hi,

On 9/7/22 11:20, Alain Volmat wrote:
> Hi,
>
> I confirm that a fix is necessary regarding this setting of the stop
> condition.  As a matter of fact, the controller is already sending
> the stop condition in case of NACK so there is no need to send the
> stop condition.
> However, this fix is not enough since the nack could be detected
> few lines above
>
> 	if (status & (STM32_I2C_ISR_NACKF | STM32_I2C_ISR_ERRORS))
> 		break;
>
> and in this case the current check would not catch it.
>
> I propose to set the STOP condition upon handling of the transfer
> complete.
>
> I've put this fix within a small 3 patches series that I'm going to
> send, could you check it to confirm this fixes the issue ?
>
> Regards,
> Alain
>
> On Thu, Aug 25, 2022 at 03:36:36PM +0200, Patrice CHOTARD wrote:
>> +Alain (with the correct email address ;-))
>>
>> Alain, can you have a look a this patch and give your feedback on it.
>>
>> On my side i tested it on stm32mp157c-ev1 and stm32mp157c-dk2, i didn't see any regression
>> but i prefer to get expert feedback
>>
>> Thanks
>> Patrice
>>
>> On 8/15/22 16:52, Jorge Ramirez-Ortiz wrote:
>>> Sending the stop condition without waiting for transfer complete
>>> has been found to lock the bus (BUSY) when NACKF is raised.
>>>
>>> Tested accessing the NXP SE05X I2C device.
>>> https://www.nxp.com/docs/en/application-note/AN12399.pdf
>>>
>>> Signed-off-by: Jorge Ramirez-Ortiz <jorge at foundries.io>
>>> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
>>> ---
>>>   drivers/i2c/stm32f7_i2c.c | 8 +++++---
>>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>>

For reference, this patch is superseded by Alain Volmat patch:

[v2,1/3] i2c: stm32: fix comment and remove unused AUTOEND bit

http://patchwork.ozlabs.org/project/uboot/patch/20220908105934.1764482-2-alain.volmat@foss.st.com/

in the serie "i2c: stm32: cleanup & stop handling fix"

http://patchwork.ozlabs.org/project/uboot/list/?series=317443&state=*


Regards


Patrick



More information about the U-Boot mailing list