spi: axi-spi-engine: fix sleep calculation
authorDavid Lechner <dlechner@baylibre.com>
Thu, 20 Jun 2024 16:43:58 +0000 (11:43 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 24 Jun 2024 12:38:17 +0000 (13:38 +0100)
commit40b3d0838a1ff242e61f341e49226074bbdd319f
tree69b313c8de485ce3169ddd3905e30513919dc5dd
parentce1dac560a74220f2e53845ec0723b562288aed4
spi: axi-spi-engine: fix sleep calculation

The sleep calculation was not taking into account increased delay when
the SPI device is not running at the maximum SCLK frequency.

Rounding down when one SCLK tick was the same as the instruction
execution time was fine, but it rounds down too much when SCLK is
slower. This changes the rounding to round up instead while still
taking into account the instruction execution time so that small
delays remain accurate.

Fixes: be9070bcf670 ("spi: axi-spi-engine: fix sleep ticks calculation")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20240620-spi-axi-spi-engine-fix-sleep-time-v1-1-b20b527924a0@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-axi-spi-engine.c