Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alain Volmat" <alain.volmat@foss.st.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH 3/6] ARM: dts: stm32: Use DMA FIFO mode for all spi in stm32mp151
Date: Wed, 22 Jul 2026 09:34:57 +0000	[thread overview]
Message-ID: <20260722093457.6CA1D1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260722-spi_arm_stm32_dt-v1-3-6ef611523232@foss.st.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The SPI driver uses register accessors (`writel_relaxed`/`readl_relaxed`) instead of stream accessors for FIFO data buffers, causing inconsistent byte ordering between PIO and DMA transfers on big-endian systems.
--

--- Patch [3]: [PATCH 3/6] ARM: dts: stm32: Use DMA FIFO mode for all spi in stm32mp151 ---
commit d73fb38e89c8770514f3125ef0d74a5af311d84e
Author: Alain Volmat <alain.volmat@foss.st.com>

ARM: dts: stm32: Use DMA FIFO mode for all spi in stm32mp151

When used, configure the DMA in FIFO mode (instead of Direct) for all
SPI instances of stm32mp151.dtsi

> diff --git a/arch/arm/boot/dts/st/stm32mp151.dtsi b/arch/arm/boot/dts/st/stm32mp151.dtsi
> index 84f68e8563d85..e7fec8b49ae16 100644
> --- a/arch/arm/boot/dts/st/stm32mp151.dtsi
> +++ b/arch/arm/boot/dts/st/stm32mp151.dtsi
[ ... ]
> @@ -943,8 +943,8 @@ spi2: spi@4000b000 {
>  				interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
>  				clocks = <&rcc SPI2_K>;
>  				resets = <&rcc SPI2_R>;
> -				dmas = <&dmamux1 39 0x400 0x05>,
> -				       <&dmamux1 40 0x400 0x05>;
> +				dmas = <&dmamux1 39 0x400 0x01>,
> +				       <&dmamux1 40 0x400 0x01>;

[Severity: High]
This is a pre-existing issue, but this change to use DMA FIFO mode highlights
a potential inconsistency in the SPI driver. Does this driver produce
inconsistent byte ordering between PIO and DMA transfers on big-endian
systems?

Looking at stm32h7_spi_write_txfifo() and stm32h7_spi_read_rxfifo() in
drivers/spi/spi-stm32.c, register accessors are used for FIFO data buffers:

drivers/spi/spi-stm32.c:stm32h7_spi_write_txfifo() {
    ...
    writel_relaxed(*tx_buf32, spi->base + STM32H7_SPI_TXDR);
    ...
}

drivers/spi/spi-stm32.c:stm32h7_spi_read_rxfifo() {
    ...
    *rx_buf32 = readl_relaxed(spi->base + STM32H7_SPI_RXDR);
    ...
}

Because writel_relaxed() and readl_relaxed() perform CPU-to-LE byte swapping
on big-endian CPUs, PIO transfers will output a reversed byte order compared
to DMA transfers, which transfer memory exactly as-is without byte swapping.
Should these use stream accessors like writesl() and readsl() instead to
preserve byte order for FIFO buffers?

>  				dma-names = "rx", "tx";
>  				access-controllers = <&etzpc 27>;
>  				status = "disabled";

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-spi_arm_stm32_dt-v1-0-6ef611523232@foss.st.com?part=3

  reply	other threads:[~2026-07-22  9:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  9:16 [PATCH 0/6] ARM: dts: stm32: enabling of SPI DMA/MDMA chaining on stm32mp13/mp15 Alain Volmat
2026-07-22  9:16 ` [PATCH 1/6] ARM: dts: stm32: add sram[123] nodes on stm32mp131 Alain Volmat
2026-07-22  9:16 ` [PATCH 2/6] ARM: dts: stm32: add pins for spi4 and spi5 in stm32mp15-pinctrl Alain Volmat
2026-07-22  9:16 ` [PATCH 3/6] ARM: dts: stm32: Use DMA FIFO mode for all spi in stm32mp151 Alain Volmat
2026-07-22  9:34   ` sashiko-bot [this message]
2026-07-22  9:16 ` [PATCH 4/6] ARM: dts: stm32: Add disabled spi4 and spi5 in stm32mp15xx-dkx Alain Volmat
2026-07-22  9:16 ` [PATCH 5/6] ARM: dts: stm32: add sram pool to spi4 for DMA-MDMA chaining on MP15 DK Alain Volmat
2026-07-22  9:16 ` [PATCH 6/6] ARM: dts: stm32: add sram pool to spi5 for DMA-MDMA chaining on MP13 DK Alain Volmat

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=20260722093457.6CA1D1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alain.volmat@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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