From: Alain Volmat <alain.volmat@st.com> To: <broonie@kernel.org>, <amelie.delaunay@st.com> Cc: <mcoquelin.stm32@gmail.com>, <alexandre.torgue@st.com>, <linux-spi@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <fabrice.gasnier@st.com>, <alain.volmat@st.com> Subject: [PATCH v2 3/5] spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate Date: Mon, 10 Aug 2020 09:12:36 +0200 [thread overview] Message-ID: <1597043558-29668-4-git-send-email-alain.volmat@st.com> (raw) In-Reply-To: <1597043558-29668-1-git-send-email-alain.volmat@st.com> From: Amelie Delaunay <amelie.delaunay@st.com> 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> --- v2: identical to v1 drivers/spi/spi-stm32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index e5450233f3f8..571dea72bf7e 100644 --- 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 -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Alain Volmat <alain.volmat@st.com> To: <broonie@kernel.org>, <amelie.delaunay@st.com> Cc: alexandre.torgue@st.com, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, alain.volmat@st.com, mcoquelin.stm32@gmail.com, fabrice.gasnier@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/5] spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate Date: Mon, 10 Aug 2020 09:12:36 +0200 [thread overview] Message-ID: <1597043558-29668-4-git-send-email-alain.volmat@st.com> (raw) In-Reply-To: <1597043558-29668-1-git-send-email-alain.volmat@st.com> From: Amelie Delaunay <amelie.delaunay@st.com> 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> --- v2: identical to v1 drivers/spi/spi-stm32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index e5450233f3f8..571dea72bf7e 100644 --- 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 -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-08-10 7:13 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-10 7:12 [PATCH v2 0/5] spi: stm32: various driver fixes Alain Volmat 2020-08-10 7:12 ` Alain Volmat 2020-08-10 7:12 ` [PATCH v2 1/5] spi: stm32h7: fix race condition at end of transfer Alain Volmat 2020-08-10 7:12 ` Alain Volmat 2020-08-10 7:12 ` [PATCH v2 2/5] spi: stm32: fix fifo threshold level in case of short transfer Alain Volmat 2020-08-10 7:12 ` Alain Volmat 2020-09-14 10:33 ` Ludwig Zenz 2020-09-14 10:33 ` Ludwig Zenz 2020-08-10 7:12 ` Alain Volmat [this message] 2020-08-10 7:12 ` [PATCH v2 3/5] spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate Alain Volmat 2020-08-10 7:12 ` [PATCH v2 4/5] spi: stm32: fixes suspend/resume management Alain Volmat 2020-08-10 7:12 ` Alain Volmat 2020-08-10 7:12 ` [PATCH v2 5/5] spi: stm32: always perform registers configuration prior to transfer Alain Volmat 2020-08-10 7:12 ` Alain Volmat 2020-08-10 18:58 ` [PATCH v2 0/5] spi: stm32: various driver fixes Mark Brown 2020-08-10 18:58 ` Mark Brown
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1597043558-29668-4-git-send-email-alain.volmat@st.com \ --to=alain.volmat@st.com \ --cc=alexandre.torgue@st.com \ --cc=amelie.delaunay@st.com \ --cc=broonie@kernel.org \ --cc=fabrice.gasnier@st.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-spi@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=mcoquelin.stm32@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.