Commit graph zephyr/drivers/spi
Author SHA1 Message Date
Fin Maaß
9014541b98 drivers: spi: intel: pw: select PCIE
select PCIE if the controller is
on a pcie bus.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-19 22:39:12 +02:00
Bjarki Arge Andreasen
500d54f357 drivers: spi: nrf_spim_common: init sck pin using nrf gpio
The SPI SCK pin needs to be initialized to match the current SPI
transfer CPOL setting. The SPIM peripheral is enabled after CS is
toggled, thus all pins need to be configured to drive correct
initial state using gpio. Since the SCK pin is defined in pinctrl
rather than as a gpio pin, nrfy is used to get the pin number and
set the pin rather than gpio peripheral driver.

Without this addition, CPOL=1 may cause an incorrect clock to be
registered at the start of the transfer, shifting the data 1 bit.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-06-19 11:10:21 +02:00
Sylvio Alves
43d7de48c1 drivers: spi: esp32: add spi target mode support
Add target (peripheral) mode to the Espressif SPI driver. The scattered
transfer buffers are coalesced into one FIFO transfer and the received
data is scattered back on completion. Socs with the integrated SPI-DMA
use DMA, as their CPU/FIFO slave path drops the final received byte.

Also fix the controller chip-select hold to track the remaining length
so trailing zero-length buffers no longer keep the line asserted.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-18 08:56:35 -04:00
Pete Johanson
eeef2b9042 drivers: spi: max32: Initialize driver state early
To avoid MXC_SPI_Shutdown having an invalid state (for DMA channels,
specifically), add a call to initialize the internal state of the SPI
driver before calling shutdown. This avoids a bug with DMA channels being
released that shouldn't be by shutdown.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-06-18 08:56:08 -04:00
Pete Johanson
7cd6fc4880 drivers: spi: max32: Refactor check for assigned DMA channels
Pull the code for checking if a given peripheral has DMA channels assigned
into a shared inline function.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-06-18 08:56:08 -04:00
Pete Johanson
d43516e3b9 drivers: spi: max32: Use dedicated dummy buffers for TX/RX
To avoid accidentally sending bogus data placed into the dummy buffer
during an RX, use dedicated two-byte buffers for TX/RX each.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-06-18 08:56:08 -04:00
Pete Johanson
6094fe5981 drivers: spi: max32: Add target support
Add support for target mode for the MAX32 SPI peripheral, including testing
support for the APARD32690 board.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-06-18 08:56:08 -04:00
Pete Johanson
3e7d763b7a drivers: spi: Properly support half duplex mode on MAX32 with interrupts
Fixes for properly setting half duplex mode for the SPI peripheral, and
handle fifo/interrupts properly for that mode of operation.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-06-18 08:56:08 -04:00
minyuan xue
b0382397dc drivers: spi: add ameba spi driver support
Add realtek ameba spi driver.

Signed-off-by: minyuan xue <minyuan_xue@realsil.com.cn>
2026-06-18 08:55:59 -04:00
Fin Maaß
120784014c drivers: select CACHE_MANAGEMENT if DCACHE
CACHE_MANAGEMENT depends on DCACHE,
therfore we should also only select it, if it is
enabled and not just if the cache exists, as the
user could disable DCACHE and then there
would be a problem.
DCACHE btw depends on CPU_HAS_DCACHE
and is enabled by default.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-18 05:35:01 -04:00
Bjarki Arge Andreasen
52ba8bb82a Revert "drivers: spi: nrfx_spim: chunk transfers exceeding EasyDMA MAXCNT"
This reverts commit 8c2a903829.

Chunk transfers are now handled in spi_nrfx_spim_common.c to support
both DMM, RAM and EasyDMA limits for spim and spim_rtio drivers.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-06-17 16:35:23 -04:00
Bjarki Arge Andreasen
29719b830b drivers: spi: nrfx_spim: split large buffers in common code
The nrfx_spim drivers need to handle transfers larger than the
internal buffers and DMA capabilities by splitting them into chunks.

Additionally, DMM and RAM buffers are mutually exclusive.

Update the common code to split the transfer internally, and update
the event callback to include the result of the transfer, since the
transfer can now fail. Update the spim and spim_rtio drivers to use
the new callback. Add new kconfig for DMM chunk size and update both
common code and kconfig to make it clear DMM and RAM buf are mutually
exclusive.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-06-17 16:35:23 -04:00
Bjarki Arge Andreasen
875beefedc drivers: spi: nrfx_spim_common: Build assert DMM region defined
Add build assert which validates that memory region has been defined
for SPIM instance if HAS_NORDIC_DMM is enabled.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-06-17 16:35:23 -04:00
Bjarki Arge Andreasen
62f200f4b8 drivers: spi: nrfx_spim_common: remove RAM_BUF linker placement
Since nordic DMM has been introduced, the SPIM RAM buffer is no
longer used in case DMM is enabled. Before DMM the SPIM RAM buffer
was manually placed in the DMM linker section, now the driver
allocates a buffer from the DMM linker section dynamically instead.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-06-17 16:35:23 -04:00
Anas Nashif
ea1fbf3588 driver: fix various typos
Fixed various typos under drivers/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-17 10:12:27 -04:00
Michael Zimmermann
8a7ae0bed1 modules: hal_silabs: rename gecko kconfigs
- Kconfigs in modules/ should not define configs with an SOC_ prefix.
  Furthermore, these options are SDK specific, not SoC specific.
- The simplicity_sdk configs do the same.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-06-17 08:05:45 +02:00
Guillaume Gautier
d4972dc2ed drivers: spi: stm32: fix for stm32h7 in rtio
For STM32H7, disable IRQ in RTIO when tranfer is completed to prevent
spurious IRQ to stall the system.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
f35c46b7be drivers: spi: stm32: remove fifo-enable
For st,stm32h7-spi compatible, always use the TSIZE register and the FIFO
for polling and interrupt mode. This increases performance compared to not
using it, and it reduces code complexity. This removes the need for the
fifo-enable property.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
1628f86398 drivers: spi: stm32: simplify the use of fifo for st,stm32h7-spi compat
For st,stm32h7-spi compatibles, when fifo-enable property is set, the
driver was setting the TSIZE register with the size of each buffer in the
transaction, leading to several disable/enable of the SPI instance.
Now, it sets the complete size of the transaction without intempestive
disabling of the SPI.

To add flexibility, the FIFO threshold is now configurable from a dts
property.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
7e23b63959 drivers: spi: stm32: rework dma transfer
This commit simplifies the flow of the STM32 SPI DMA transfer.

For the "st,stm32h7-spi" compatible, do not set the TSIZE register for a
DMA transfer (to define the size of the transfer). This setting was
leading to several disable/enable of the SPI instance in case multiple
buffers were used in the transaction, and it didn't bring noticeable
performance benefit. At the same time, do not use the SPI FIFO because
it's a hurdle to use without the TSIZE.

Rework the flow of initial operation to better match the procedure
described in the Reference Manuals.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
ab34f00777 drivers: spi: stm32: wait for both dma tx and rx done
When waiting for DMA transfer done, wait for both TX and RX, instead of
only one of them.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Aksel Skauge Mellbye
110985ae58 drivers: spi: silabs: Disable EUSART transceiver when idle
Disable the EUSART transmitter and receiver immediately upon
completion of a transfer, rather than deferring it to PM Device
Runtime suspend.

The transmitter and receiver are always re-enabled as part of
configuring a new transfer.

This fixes an issue when CONFIG_PM=y where the driver would
not block deep sleep when it was idle, but would wake up with
an inconsistent internal shift register state. Safely shut down
the transmitter and receiver whenever they are not used to
avoid this scenario.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-06-11 15:03:51 -04:00
Eliott Speyser
2747b03a8b drivers: spi: stm32: add log level config
When CONFIG_LOG_DEFAULT_LEVEL is set to 4 and SPI driver is used,
it will log debug messages idependently of CONFIG_SPI_LOG_LEVEL.
This allows disabling debug logs with the SPI log level config.

Signed-off-by: Eliott Speyser <eliott.speyser@st.com>
2026-06-09 20:01:47 +02:00
Bjarki Arge Andreasen
b8ead74673 drivers: spi: spi_nrfx_spim: patch to support nothread
The spi_nrfx_spim device driver is used in nothread bootloaders, the
wake implementation waits on a k_sem, patch to poll a volatile bool
variable if CONFIG_MULTITHREADING=n

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-06-09 19:58:47 +02:00
Chaitanya Tata
8c2a903829 drivers: spi: nrfx_spim: chunk transfers exceeding EasyDMA MAXCNT
The reworked SPIM driver passes the whole continuous chunk returned by
spi_context_max_continuous_chunk() straight to the common transfer
layer, which rejects anything larger than the controller MAXCNT with
-EINVAL. On SoCs with a small EasyDMA MAXCNT (e.g. nRF91 SPIM with 13
bits, max 8191 bytes) a transfer of 8192 bytes or more fails outright.

The old monolithic driver used to cap the chunk to the MAXCNT limit and
let the event handler walk the rest of the buffer. That behaviour was
lost in the rework, so any caller pushing a buffer larger than MAXCNT
now breaks. One example is the nRF70 firmware patch download, which
copies the patch in 8192 byte chunks and ends up corrupting RPU memory,
leading to a boot signature mismatch.

Restore the cap in transfer_start() so an oversized chunk is split
across multiple EasyDMA transfers, with the remainder handled by the
next call from the event handler once the current chunk completes.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Assisted-by: Cursor:Opus4.8
2026-06-09 11:56:44 +02:00
Ofir Shemesh
ee1034e60d spi: dw: promote fifo_depth to uint16_t to support 256-entry FIFOs
The DTS binding documents fifo-depth range as 2-256, but the
struct field is uint8_t which silently overflows 256 to 0.
Widen to uint16_t so the full hardware range is representable.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2026-06-07 19:17:52 +02:00
Sylvio Alves
5e5d574dfa drivers: spi: esp32: add axi gdma slot and cache maintenance
On SoCs with AXI GDMA, derive the DMA slot from the trigger
peripheral ID base. Flush the tx buffer and invalidate the rx
buffer around the transfer so CPU and DMA see coherent data.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-03 18:27:15 -04:00
Jérôme Pouiller
233545d1e6 drivers: spi: siwx91x: Simplify DMA configuration
SPI_SILABS_SIWX91X_GSPI_DMA and SPI_SILABS_SIWX91X_GSPI_DMA_MAX_BLOCKS are
redundant. We can achieve the same by checking if
SPI_SILABS_SIWX91X_GSPI_DMA_MAX_BLOCKS > 0.

Then, rather than pulling the DMA if one device use it, automatically use
the DMA it exist (the user can still disable it by settings DMA_MAX_BLOCKS
== 0).

Thanks to that change, we can remove allthe #ifdef in the SPI driver.
A test in spi_siwx91x_is_dma_enabled_instance() is sufficient to make the
DMA relative functions orphans.

Then, we can enable the dma instances in the board DTS, so the user just
have to set DMA=y to enable DMA in the drivers.

The two errors cases are:
  - DMA=y while referenced DMA instance in the DT is disabled. The user get
    a compilation error
  - DMA=n (or DMA driver is disabled) but the user explicitly set
    DMA_MAX_BLOCKS > 0. The user get an error during runtime.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2026-06-03 13:05:03 +02:00
Jérôme Pouiller
7b8aadcade drivers: spi: siwx91x: No longer need to split the descriptors
Until now, the SPI driver had to take care about the size of the blocks
sent to the DMA. There were several drawbacks:
  - The SPI driver need to know the DMA internal parameter and the SPI
    driver has configured for a specific DMA hardware block.
  - For large transfer, the user has to allocate a large number of
    descriptor in the SPI driver. The user had to know the DMA block size
    of set the right parameter and the descriptors were duplicated with the
    DMA driver (which store them in the hardware format).

However, our DMA drivers now automatically split the large blocks. So the
SPI driver no longer need to do that.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2026-06-03 13:05:03 +02:00
Shan Pen
9436dad631 drivers: spi: renesas_ra8: add RTIO submit fallback
Add the default SPI RTIO submit hook for RA8 SPI-B.

Signed-off-by: Shan Pen <bricle031@gmail.com>
2026-06-03 08:26:24 +02:00
Amneesh Singh
9969745801 drivers: update interrupt handling to use "flags" instead of "sense"
Update all drivers to use "flags" instead of "sense" when accessing
interrupt properties from device tree. This aligns with the updated
interrupt controller bindings that now consistently use "flags" as
the cell name for the IRQ type field.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
2026-06-01 12:38:26 -04:00
Robert Hancock
e8b2a9b0ed drivers: spi: Added ZynqMP Generic Quad SPI driver
Add a driver for the Generic Quad SPI hardware that is part of the
Xilinx MPSoC. This is mostly commonly used with QSPI flash devices which
are also used for initial image loading, but can also be used with other
SPI devices.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2026-06-01 12:37:10 -04:00
Raffael Rostagno
f127e9f846 drivers: spi: esp32: Sleep retention
Add sleep retention support for GSPI driver. When peripheral
power down is enabled for light sleep, register data is lost,
so REGDMA backup is needed to mantein peripheral operational.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-05-29 22:05:37 +02:00
Sofian Elmotiem
fddc5c2ce0 drivers: spi: mcux_flexcomm: check return value of init_common
spi_mcux_init_common() can fail, propagate the error on TURN_ON
instead of silently ignoring it.

Signed-off-by: Sofian Elmotiem <sofianelmotiem@gmail.com>
2026-05-27 21:34:21 -04:00
CHEN Xing
a46abafa51 drivers: spi: mchp: add flexcom spi driver
Add microchip flexcom spi driver.

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
2026-05-26 15:20:07 +02:00
Yuzhuo Liu
676624295f drivers: spi: add Realtek Bee series driver
Add SPI driver support for Realtek Bee series SoCs,
including RTL87x2G and RTL8752H.

This driver supports:
- Master and Slave operation modes
- Polling, Interrupt, and DMA transfer modes
- Transmit (TX) and Receive (RX) functionality

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-05-25 13:37:42 +02:00
cyliang tw
28a3113d97 drivers: spi: support Nuvoton numaker usci-spi
Add Nuvoton numaker series usci-spi controller.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2026-05-22 18:26:30 +02:00
Sudarshan Iyengar
6593588562 drivers: spi: dw: add frequency validation in configuration path
Validate the SPI bus frequency supplied via spi_config before it is
used to compute the baud-rate clock divider to prevent the following
faults:

- A zero frequency causes an integer division-by-zero when computing
  the clock divider, resulting in a hardware fault or an undefined
  value being written to the SPI_BAUDR register.

- A frequency exceeding half of the input core clock produces a
  divider value less than the minimum of 2 required by the
  DesignWare SSI databook (section 6.2.2), overclocking the
  peripheral and causing undefined bus behaviour.

Return -EINVAL for a zero frequency and -EINVAL for a frequency
greater than clk_hz / 2, surfacing the error to the caller rather
than silently misconfiguring the hardware.

Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
2026-05-22 18:24:00 +02:00
Bjarki Arge Andreasen
b2085e6cd6 drivers: spi: nrfx_spim_common: Limit freq by max_freq of controller
When configuring the nRF SPIM, the frequency needs to be limited by
the max frequency of the SPIM, which is specified in the devicetree.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-05-22 18:23:57 +02:00
Rick Tsao
19606761aa drivers: spi: atcspi200: fix SPI clock change during DMA and build error
Fix SPI clock frequency being modified during DMA transfers.

Fix regression in DMA configuration structure update.

Signed-off-by: Rick Tsao <rick592@andestech.com>
2026-05-22 18:23:36 +02:00
Rick Tsao
35596683d2 drivers: spi: atcspi200: fix non-8-bit word size and NULL buffer handling
Fix incorrect behavior for non-8-bit SPI word sizes.

Fix the handling when both TX and RX buffers are NULL.

Signed-off-by: Rick Tsao <rick592@andestech.com>
2026-05-22 18:23:36 +02:00
Sylvio Alves
26bcd68a40 drivers: esp32: use zephyr cache api for dma coherency
Replace direct esp_cache_msync() calls in the ESP32 GDMA and
SPI master drivers with the portable sys_cache_data_*() API.

Zephyr's API is a compile-time no-op when CACHE_MANAGEMENT is
disabled, so the same source compiles cleanly on every ESP32
SoC and stays cost-free where there is no writeback cache.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-05-20 19:22:10 -07:00
Peter van der Perk
b2b3274f05 spi: lpspi: rtio: FIFO tune and DMA support
Improve the LPSPI RTIO FIFO path by increasing the fifo
watermark if possible, this reduces IRQ load. Add DMA
support

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-05-20 20:04:45 -04:00
Nicolas Pitre
90d1963745 sys: util: move lowercase min/max/clamp to a new minmax.h
Since commit 37717b229f ("sys: util: rename Z_MIN Z_MAX Z_CLAMP to min
max and clamp"), <zephyr/sys/util.h> unconditionally defines function-
like macros named `min`, `max`, and `clamp` in the global namespace (in
C mode). util.h gets pulled in transitively by very broad headers,
including the POSIX layer's <pthread.h>, so any third-party C code that
uses these names as ordinary identifiers (e.g. XNNPACK's static `clamp`
helper and its public `clamp` struct field) fails to build as soon as
<pthread.h> is included.

Following the approach used by Linux, move the lowercase `min`, `max`,
`min3`, `max3`, and `clamp` macros (and their helpers) into a new
<zephyr/sys/minmax.h> header that has to be included explicitly by
source files that want them. util.h keeps the uppercase MIN/MAX/CLAMP,
so most code is unaffected; only the (much smaller) set of files that
actually use the lowercase variants needs to pick up the new include.

Fixes #107853.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-05-19 17:49:24 -04:00
Davide Di Lello
82741b2614 drivers: infineon: Update copyright for Infineon
Update structure of the copyright

Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
2026-05-12 22:19:02 +02:00
Mohamed Azhar
c6a8bfb516 drivers: spi: microchip: update slave mode in spi g1 driver
Move SSDE enable after preload to prevent premature SSL interrupts
Fix DMA fallback to always have ISR variables available

Signed-off-by: Mohamed Azhar <mohamed.azhar@microchip.com>
2026-05-12 17:18:34 +02:00
Jamie McCrae
ceb26f67f0 drivers: Add support for dts RAM configuration
Allows using the chosen SRAM node for RAM configuration without
using Kconfig values

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-05-11 08:45:38 +02:00
Quang Le
6d2b6de690 drivers: spi: Initial support for RZ/V2H, V2N
Add SPI driver support for Renesas RZ/V2H, V2N.

Signed-off-by: Quang Le <quang.le.eb@bp.renesas.com>
2026-05-03 20:30:58 -05:00
Quang Le
d75577d307 drivers: spi: Update SPI driver for RZ/N2L, T2L, T2M
- Add DMA support for SPI on RZ/N2L, T2M since the previously supported
  had not support DMA.
- Add initial support SPI driver for board RZ/T2L.

Signed-off-by: Quang Le <quang.le.eb@bp.renesas.com>
2026-05-03 20:30:58 -05:00
Zhaoxiang Jin
879c298251 spi: nxp: lpspi: use reset controller when available
add reset controller support to the NXP LPSPI driver and
use reset controller APIs if available.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-05-01 09:42:15 +02:00