]> git.proxmox.com Git - mirror_ubuntu-zesty-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)
committerLuis Henriques <luis.henriques@canonical.com>
Fri, 20 Jan 2017 11:27:25 +0000 (11:27 +0000)
commit096cf4760637cd8e410e2448fc84aec773fe7681
tree8e5ac8791ee7e81ecba170d30790d8a49eddd847
parent034f47f2a13b402a69b7ac4914336bb414b82a41
spi: mvebu: fix baudrate calculation for armada variant

BugLink: http://bugs.launchpad.net/bugs/1656876
commit 7243e0b20729d372e97763617a7a9c89f29b33e1 upstream.

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: df59fa7f4bca ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/spi/spi-orion.c