spi: rspi: Round up division to avoid slave overclocking
authorGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 22 May 2014 18:07:35 +0000 (20:07 +0200)
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>
Wed, 4 Feb 2015 10:14:32 +0000 (11:14 +0100)
commit618013118c11b9582f43e188ef23c6e5d0c086e6
treec723961db2620a0691cc2eb9b1183e83ce328bca
parent8112743dfc3b72297e176d08e05ad7843dae6be7
spi: rspi: Round up division to avoid slave overclocking

The calculation of the bit rate divider used a standard C division, which
rounds down the quotient. This may lead to a higher bitrate than requested.
Round up to avoid this.

E.g. on Koelsch, the SPI flash (configured for 30 MHz) was driven at 48.75
MHz. After this patch it's driven at a safe 24.375 MHz.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3beb61dbfcf188399cbc36ce1eeb8b2ba724de38)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/spi/spi-rspi.c