summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Seidel <kernel@mseidel.net>2016-09-07 17:45:30 +0200
committerMark Brown <broonie@kernel.org>2016-09-12 19:59:08 +0100
commit3aef463222eaf1ca505629e93a0b64e4040a4472 (patch)
treec133a67256a92cd432ad53fd60387220c4a828ca
parent13b10301b858e355613bfc6dc297580bf34d3fb5 (diff)
downloadop-kernel-dev-3aef463222eaf1ca505629e93a0b64e4040a4472.zip
op-kernel-dev-3aef463222eaf1ca505629e93a0b64e4040a4472.tar.gz
spi: dw: round up result of calculation for clock divider
Avoid ending up with a higher frequency than requested Signed-off-by: Matthias Seidel <kernel@mseidel.net> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-dw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index c85e4b3..27960e4 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -300,7 +300,7 @@ static int dw_spi_transfer_one(struct spi_master *master,
if (transfer->speed_hz != dws->current_freq) {
if (transfer->speed_hz != chip->speed_hz) {
/* clk_div doesn't support odd number */
- chip->clk_div = (dws->max_freq / transfer->speed_hz + 1) & 0xfffe;
+ chip->clk_div = (DIV_ROUND_UP(dws->max_freq, transfer->speed_hz) + 1) & 0xfffe;
chip->speed_hz = transfer->speed_hz;
}
dws->current_freq = transfer->speed_hz;
OpenPOWER on IntegriCloud