summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-sh-msiof.c
diff options
context:
space:
mode:
authorTakashi Yoshii <takasi-y@ops.dti.ne.jp>2013-12-01 22:19:13 +0400
committerMark Brown <broonie@linaro.org>2013-12-02 16:48:05 +0400
commite4d313ff79a8b5622a8c4954ba37c6564fa922c4 (patch)
tree6b2d521cd48d521f6b7f37ea9b2e27dfe0ee4350 /drivers/spi/spi-sh-msiof.c
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
downloadlinux-e4d313ff79a8b5622a8c4954ba37c6564fa922c4.tar.xz
spi: spi-sh-msiof: round up div to fix freq calculation
Truncation on integer division in sh_msiof_spi_set_clk_regs() results in insufficient transfer frequency (> max_speed_freq). For example, source 52MHz, required max 6MHz 52/6 = 8.6 --> 8, then 1/8 table selected, and result in 52/8 = 6.5 MHz (>6MHz) Rounding it up is a simple solution. 52/6 = 8.6 --> 9, then 1/16 table selected, and result in 52/16 = 3.25 MHz Signed-off-by: Takashi Yoshii <takasi-y@ops.dti.ne.jp> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-sh-msiof.c')
-rw-r--r--drivers/spi/spi-sh-msiof.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index c74298cf70e2..ac8795f2e700 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -152,7 +152,7 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
size_t k;
if (!WARN_ON(!spi_hz || !parent_rate))
- div = parent_rate / spi_hz;
+ div = DIV_ROUND_UP(parent_rate, spi_hz);
/* TODO: make more fine grained */