spi: fsi: Fix contention in the FSI2SPI engine
authorEddie James <eajames@linux.ibm.com>
Tue, 26 Oct 2021 19:33:27 +0000 (14:33 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 27 Oct 2021 10:31:27 +0000 (11:31 +0100)
commite954af1343f6334bf7e081f2631cc2902d07a0ee
tree8ace7d35db1fcbdf5ab0c98980cf8703b3243c06
parent0b0a281ed7001d4c4f4c47bdc84680c4997761ca
spi: fsi: Fix contention in the FSI2SPI engine

There was nothing to protect multiple SPI controllers on the same FSI2SPI
device from being accessed through the FSI2SPI device at the same time.
For example, multiple writes to the command and data registers might occur
for different SPI controllers, resulting in complete chaos in the SPI
engine. To prevent this, add a FSI2SPI device level mutex and lock it in
the SPI register read and write functions.

Fixes: bbb6b2f9865b ("spi: Add FSI-attached SPI controller driver")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20211026193327.52420-1-eajames@linux.ibm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsi.c