i2c: mlxbf: support lock mechanism
authorAsmaa Mnebhi <asmaa@nvidia.com>
Mon, 26 Sep 2022 19:45:04 +0000 (15:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:46 +0000 (12:34 +0200)
commit1331d3e1f9b5060e159fba8c6fb3285ee5aa2857
tree77e3a1d509e209466db5446321681daba2cf8cfd
parent9233ab8198d8faea0f1b7117a0d9e405536a2aad
i2c: mlxbf: support lock mechanism

[ Upstream commit 86067ccfa1424a26491542d6f6d7546d40b61a10 ]

Linux is not the only entity using the BlueField I2C busses so
support a lock mechanism provided by hardware to avoid issues
when multiple entities are trying to access the same bus.

The lock is acquired whenever written explicitely or the lock
register is read. So make sure it is always released at the end
of a successful or failed transaction.

Fixes: b5b5b32081cd206b (i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC)
Reviewed-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-mlxbf.c