spi: axi-spi-engine: fix sleep ticks calculation
authorDavid Lechner <dlechner@baylibre.com>
Mon, 4 Dec 2023 17:33:30 +0000 (11:33 -0600)
committerMark Brown <broonie@kernel.org>
Wed, 6 Dec 2023 14:19:32 +0000 (14:19 +0000)
commitbe9070bcf67057b7b03c5acc1980d3897448ad20
treecf79d7483df1aec525944895da113a058cf78280
parent1fc8dc5721bbc7a21cb4cc60c35eb8031942542b
spi: axi-spi-engine: fix sleep ticks calculation

This fixes the sleep ticks calculation when generating sleep
instructions in the AXI SPI Engine driver. The previous calculation
was ignoring delays less than one microsecond and missed a microsecond
to second conversion factor.

This fixes the first issue by not rounding to microseconds. Now that
xfer->effective_speed_hz is guaranteed to be set correctly, we can use
that to simplify the calculation. This new calculation replaces the old
incorrect math.

Also add unit suffix to the delay variable for clarity while we are
touching this.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20231204-axi-spi-engine-series-2-v1-4-063672323fce@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-axi-spi-engine.c