spi: amd: Setup all xfers before opcode execution
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Thu, 18 Aug 2022 01:00:59 +0000 (04:00 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 18 Aug 2022 14:02:08 +0000 (15:02 +0100)
commit9d08f700ab78fd96cbe5922c261051743cb9c86e
treefbfa2642cc063d538c5a863dcb2ed7b0ceea9ced
parent490211b0f480ce5eb112747af684ed73bae8225d
spi: amd: Setup all xfers before opcode execution

The AMD SPI controller hardware seems to expect the FIFO buffer to be
fully setup with the details of all transfers in the SPI message before
it is able to start processing the data in a reliable way.

Furthermore, it imposes a strict ordering restriction, in the sense that
all TX transfers must be handled prior any RX transfer.

Hence, let's ensure amd_spi_execute_opcode() is called only once, after
all TX transfers have been setup, and process any remaining RX transfers
afterwards, in a second iteration.

Additionally, get rid of the unnecessary AMD_SPI_XFER_TX/RX defines and
improve error handling.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20220818010059.403776-1-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-amd.c