projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3373e90
)
spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate
author
Amelie Delaunay
<amelie.delaunay@st.com>
Mon, 10 Aug 2020 07:12:36 +0000
(09:12 +0200)
committer
Mark Brown
<broonie@kernel.org>
Mon, 10 Aug 2020 18:46:43 +0000
(19:46 +0100)
Fix spi->clk_rate when it is odd to the nearest lowest even value because
minimum SPI divider is 2.
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Alain Volmat <alain.volmat@st.com>
Link:
https://lore.kernel.org/r/1597043558-29668-4-git-send-email-alain.volmat@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-stm32.c
patch
|
blob
|
history
diff --git
a/drivers/spi/spi-stm32.c
b/drivers/spi/spi-stm32.c
index
e545023
..
571dea7
100644
(file)
--- a/
drivers/spi/spi-stm32.c
+++ b/
drivers/spi/spi-stm32.c
@@
-441,7
+441,8
@@
static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz,
{
u32 div, mbrdiv;
- div = DIV_ROUND_UP(spi->clk_rate, speed_hz);
+ /* Ensure spi->clk_rate is even */
+ div = DIV_ROUND_UP(spi->clk_rate & ~0x1, speed_hz);
/*
* SPI framework set xfer->speed_hz to master->max_speed_hz if