]> git.baikalelectronics.ru Git - kernel.git/commit
spi: mvebu: fix baudrate calculation for armada variant
authorUwe Kleine-König <uwe@kleine-koenig.org>
Thu, 8 Dec 2016 16:37:08 +0000 (17:37 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 8 Dec 2016 17:54:51 +0000 (17:54 +0000)
commit374ef27d91c85234a34f2747a2bf7d7b3c151ef4
treeb75e2be1faaecc337cca9496f30517b9e7d8b8ce
parente31441e5943bb6a3c84a56fc79673289957596a6
spi: mvebu: fix baudrate calculation for armada variant

The calculation of SPR and SPPR doesn't round correctly at several
places which might result in baud rates that are too big. For example
with tclk_hz = 250000001 and target rate 25000000 it determined a
divider of 10 which is wrong.

Instead of fixing all the corner cases replace the calculation by an
algorithm without a loop which should even be quicker to execute apart
from being correct.

Fixes: f0ea0082d55a ("spi: orion: support armada extended baud rates")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-orion.c