提交 e4d313ff 编写于 作者: T Takashi Yoshii 提交者: Mark Brown

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: NTakashi Yoshii <takasi-y@ops.dti.ne.jp>
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 6ce4eac1
...@@ -152,7 +152,7 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p, ...@@ -152,7 +152,7 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
size_t k; size_t k;
if (!WARN_ON(!spi_hz || !parent_rate)) 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 */ /* TODO: make more fine grained */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册