From: Alain Volmat <alain.volmat@foss.st.com>
To: "Leonard Göhrs" <l.goehrs@pengutronix.de>
Cc: Mark Brown <broonie@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
<kernel@pengutronix.de>, <linux-spi@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/2] spi: stm32: split large transfers based on word size instead of bytes
Date: Thu, 16 Mar 2023 13:57:29 +0100 [thread overview]
Message-ID: <20230316125729.GA3495627@gnbcxd0016.gnb.st.com> (raw)
In-Reply-To: <20230310092053.1006459-2-l.goehrs@pengutronix.de>
Hi Leonard,
thanks for your patch. I agree with this patch and tested it ok
as well on my side.
On Fri, Mar 10, 2023 at 10:20:53AM +0100, Leonard Göhrs wrote:
> The TSIZE register in CR2, to which the number of words to transfer
> is written, is only 16 Bit. This limits transfers to 65535 SPI
> _words_ at a time. The existing code uses spi_split_transfers_maxsize
> to limit transfers to 65535 _bytes_ at a time.
>
> This breaks large transfers with bits_per_word > 8, as they are
> split inside of a word boundary by the odd size limit.
>
> Split transfers based on the number of words instead.
> This has the added benefit of not artificially limiting the maximum
> length of bpw > 8 transfers to half or a quarter of the actual limit.
>
> The combination of very large transfers and bits_per_word = 16 is triggered
> e.g. by MIPI DBI displays when updating large parts of the screen.
>
> Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
> ---
> drivers/spi/spi-stm32.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> index def09cf0dc14..d2e16f16fae6 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c
> @@ -984,9 +984,9 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
> if (spi->cfg->set_number_of_data) {
> int ret;
>
> - ret = spi_split_transfers_maxsize(master, msg,
> - STM32H7_SPI_TSIZE_MAX,
> - GFP_KERNEL | GFP_DMA);
> + ret = spi_split_transfers_maxwords(master, msg,
> + STM32H7_SPI_TSIZE_MAX,
> + GFP_KERNEL | GFP_DMA);
> if (ret)
> return ret;
> }
Acked-by: Alain Volmat <alain.volmat@foss.st.com>
> --
> 2.30.2
>
next prev parent reply other threads:[~2023-03-16 12:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 9:20 [PATCH v1 1/2] spi: core: add spi_split_transfers_maxwords Leonard Göhrs
2023-03-10 9:20 ` [PATCH v1 2/2] spi: stm32: split large transfers based on word size instead of bytes Leonard Göhrs
2023-03-16 12:57 ` Alain Volmat [this message]
2023-03-16 14:26 ` [PATCH v1 1/2] spi: core: add spi_split_transfers_maxwords 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=20230316125729.GA3495627@gnbcxd0016.gnb.st.com \
--to=alain.volmat@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=broonie@kernel.org \
--cc=kernel@pengutronix.de \
--cc=l.goehrs@pengutronix.de \
--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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®