Commit graph zephyr/drivers/spi
Author SHA1 Message Date
Lin Yu-Cheng
dd5f8c483b drivers: spi: spi_rts5912_spi: Add clock-frequency setting from dtsi
The clock-frequency value in dtsi can be used to change
the bus frequency for rts5912 driver and
it support in the range between 15000 to 50000000.

Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
2025-12-16 10:10:35 +01:00
Jérôme Pouiller
3fbaa29bba drivers: spi: siwx91x: Drop GSPI_MAX_BAUDRATE_FOR_DYNAMIC_CLOCK
Currently, clk_div_factor is force to 1 if user request more than 110MHz.
However, in this case, gspi_siwx91x_get_divider() will never return 2 or
more, unless the input clock is >= 220MHz. The si91x is not designed for
such high clock frequency. So, this case has never been tested.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-12-11 16:34:33 -05:00
Jérôme Pouiller
0623e6f390 drivers: spi: siwx91x: Simplify gspi_siwx91x_pick_lower_freq()
Since actual_hz is no more needed, we can simplify
gspi_siwx91x_pick_lower_freq().

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-12-11 16:34:33 -05:00
Jérôme Pouiller
918426ff30 drivers: spi: siwx91x: clk_div_factor can't be 0
In gspi_siwx91x_config(), clk_div_factor can't be < 1. Therefore, we can
remove the dead code.

This code has been tested with tests/drivers/spi/spi_loopback, with a PLL
clock configured to 160MHz and a bus clock to 80MHz with success. I have
not found the case where change in GSPI_CLK_CONFIG are required.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-12-11 16:34:33 -05:00
Jérôme Pouiller
1c356d0ed1 drivers: spi: siwx91x: Fix use of GSPI_DATA_SAMPLE_EDGE
Until now, GSPI_DATA_SAMPLE_EDGE was enabled as soon as the user requested
> 40Mhz (even if the actual frequency was in fact 40Mhz). However, at 40MHz
and at 80MHz, use of GSPI_DATA_SAMPLE_EDGE generated read errors on the
last bit of the transaction:

    Buffer contents are different:
     [...],0xaa,0xaa,0xaa,0xaa,
    vs:
     [...],0xaa,0xaa,0xaa,0xab,

I have not found any case where GSPI_DATA_SAMPLE_EDGE is useful, so this
patch just remove this parameter.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-12-11 16:34:33 -05:00
Jérôme Pouiller
115241c645 drivers: spi: siwx91x: Simplify error management
In functions requiring to lock/release resources, it is less error prone to
have only one exit point and user goto to manage errors.

The behavior of the new code is exactly identical to the initial one.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-12-11 16:34:33 -05:00
Jérôme Pouiller
88b39fd6f9 drivers: spi: siwx91x: Simplify gspi_siwx91x_config()
The bit_rate variable does not bring any benefit.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-12-11 16:34:33 -05:00
Alexandre Rey
0b52928625 driver: spi: mcux_dspi: remove obsolete rx_bufs check
The guard against rx_bufs == NULL was originally added to prevent a
DMA misconfiguration observed when no RX buffer was provided.

The issue can no longer be reproduced, and the check was incomplete
since it did not cover rx_bufs->buffers == NULL or rx_bufs->count == 0,
which lead to the same effective condition.

Removing the check simplifies the driver and avoids blocking valid
TX-only transfers.

Signed-off-by: Alexandre Rey <alx.rey@icloud.com>
2025-12-11 09:20:10 +02:00
Axel Utech
ae69e60dad drivers: spi: sam: Fix configuring with more than 4 chip selects
If spi_sam_configure() is called with more than 4 chip selects the
current check fails even if the pins are used as gpios. The variable
spi_csr_idx already has the correct index to be checked and must be
used in this check.

Signed-off-by: Munawar Ali <ali@sofiha.de>
Signed-off-by: Axel Utech <utech@sofiha.de>
2025-12-08 06:14:08 -05:00
Sreeram Tatapudi
5ecf248ba3 drivers: infineon: Drop cat1 from the files names
Drop cat1 from the file names to enable reuse by other
category devices as well

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2025-12-07 21:19:38 -05:00
Jacky Lee
f2ab79278e driver: spi: egis_et171_spi supports clock driver
Allows "egis_et171_spi" to use basic clock information
provided by the clock driver to calculate the runtime
SPI frequency.

Signed-off-by: Jacky Lee <jacky.lee@egistec.com>
2025-12-06 11:39:09 -05:00
Srikanth Boyapally
d784a95c5c spi: cdns: Add support for slave transfers exceeding FIFO depth
Enable slave mode to handle transfers larger than FIFO depth (128 bytes)
by implementing dynamic TX threshold management.

Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
2025-12-06 11:38:51 -05:00
Srikanth Boyapally
4b75597786 spi: cdns: Fix unreliable RX not empty detection with software counter
The Cadence SPI controller has a hardware issue (Xilinx AR#65885
contains more details) where the RX_NOT_EMPTY (RNE) status bit
reports inconsistent state. This causes the driver to unreliably
detect when RX FIFO contains valid data, leading to transfer
failures and test hangs.

Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
2025-12-06 11:38:51 -05:00
Guillaume Gautier
fbb2848ef2 drivers: spi: stm32: fix spi rtio with fifo-enable
This commit fixes the SPI RTIO transfers when the fifo-enable property is
enabled.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-12-05 14:55:32 -05:00
Guillaume Gautier
133da1c017 drivers: spi: stm32: extend data size support
Extend the number of SPI data sizes supported for series that allow it.
The driver uses the new property st,stm32-data-width to create a table
with all compatible data widths and to check if the SPI instance
support the required width (some instances may have a limited set
of widths compared to others on the same SoC).

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-12-05 14:55:32 -05:00
Guillaume Gautier
f91258d17e drivers: spi: stm32: invert ll_func_spi_dma_busy logic
Inverts ll_func_spi_dma_busy logic so that the function returns true if
the SPI DMA is busy (as suggested by the name) instead of the other way
around.
Also completes the check for H7-compatible with the LL_SPI_IsActiveFlag_EOT
function when transfer size is set.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-12-05 14:55:32 -05:00
Sai Santhosh Malae
f8b5b77348 drivers: spi: siwx91x: Guard callback registration
Guard callback registration with CONFIG_SPI_ASYNC to avoid
build error for blocking SPI transfers using DMA

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-12-05 14:54:54 -05:00
Sai Santhosh Malae
d4b551b3fb drivers: spi: siwx91x: Swap write and read data inside GSPI controller
Swap the write and read data paths within the GSPI controller to ensure
correct data is seen on the SPI lines during 16-bit transfers.

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-12-05 14:54:54 -05:00
Sai Santhosh Malae
b6cef6fbf6 drivers: spi: siwx91x: Align mosi_overrun to 32 bytes
Updated mosi_overrun alignment from 4 bytes to 32 bytes to
ensure compatibility with the GPDMA driver. This prevents
alignment-related errors during DMA transfers.

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-12-05 14:54:54 -05:00
Sai Santhosh Malae
9ebba6821b drivers: spi: siwx91x: Add support for higher burst rates using GPDMA
Enable higher SPI burst sizes when using GPDMA to improve throughput.
Bursts are only enabled when both TX and RX channels use GPDMA and
the SPI clock frequency is at least 10 MHz, as DMA flow control is
unreliable at lower SPI rates.

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-12-05 14:54:54 -05:00
Sai Santhosh Malae
23c8db4f8c drivers: spi: siwx91x: Add helper to round GSPI freq to valid range
Add gspi_siwx91x_pick_lower_freq() to select the nearest lower
supported GSPI clock frequency based on the requested value.
The GSPI clock can operate only at discrete frequencies such as
80 MHz, 40 MHz, 26.6 MHz, 20 MHz, and so on (80 MHz divided by
integer factors). If the requested frequency does not match one
of these valid steps, it is rounded down to the nearest lower
supported frequency.

The driver now logs both the requested and the actual programmed
frequency along with the divider value, helping users verify the
effective SPI clock configuration.

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-12-05 14:54:54 -05:00
Guillaume Gautier
a0ffee2b92 drivers: spi: stm32: add support for baudrate prescaler bypass
Some STM32 SPI have the ability to bypass the baudrate prescaler, which is
equivalent to having a prescaler of 1.
Adds this new value in the prescaler calculation if available.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-12-05 11:09:59 -05:00
Mathieu Choplain
6cb3ea5510 drivers: spi: stm32: remove ll in driver's file name
The `ll` part of driver's file name indicates that the implementation uses
the STM32Cube Low Level ("LL") library, which is not interesting because
there is only *one* STM32 driver implementation anyways. Addtionnally, the
presence of `ll` among STM32 drivers is not consistent.

Get rid of it for this class's driver to match most other STM32 drivers.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-12-04 14:00:34 -05:00
Mathieu Choplain
208b3ef5ba drivers: spi: stm32: configure proper DMA burst length
The burst length unit is bytes, not number of transfers. This had not been
an issue since the DMA driver historically ignored the values, but has now
become one since they are used and (most importantly for us) validated.

Fixes broken 16-bit on STM32N6 series.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-12-04 05:23:02 -05:00
Martin Hoff
ff3637bf83 soc: silabs: siwx91x: enabled clock control by default for siwx91x soc
Enable clock control by default for siwx91x SoCs. Moreover, most
drivers for siwx91x soc depend on clock control, but didn't declare
it.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-12-02 15:18:53 -05:00
Martin Hoff
d5c45b10e5 drivers: spi: siwx91x: ensure device runtime is released on error
Added calls to pm_device_runtime_put() to ensure proper device runtime
management when configuration or DMA transceive operations fail.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-12-01 11:11:23 +01:00
Aksel Skauge Mellbye
a83b19b3f9 soc: silabs: Fix clock control dependency declarations
Most drivers for Series 2 depend on clock control, but didn't
declare it. Enable clock control by default for Series 2 SoCs.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-12-01 11:11:14 +01:00
Nikodem Kastelik
ad1e5ac253 nordic: update and align to nrfx 4.0.1
New nrfx release contains major rework of nrfx drivers
instantiation making it easier to integrate with dts nodes.
Now, nrfx driver instances can no longer be `const`
because they contain driver runtime state.
Additionally, all nrfx drivers return `errno` error codes
instead of deprecated `nrfx_err_t`.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-11-27 14:45:17 +01:00
Camille BAUD
2c8912e223 drivers: spi: Introduce Basic BFLB SPI driver
Introduce spi driver with basic features

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-11-27 11:27:45 +01:00
Qingsong Gou
d3037c6361 drivers: spi: add spi driver for sf32lb platform
Add spi driver for sifli sf32lb platform

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
2025-11-26 12:17:32 -05:00
John Batch
5c2332c7d4 drivers: spi: Removing devicetree references to cat1-spi-pdl
Removing references to infineon,cat1-spi-pdl from the device tree files.
Updates the driver bindings and driver file to look at the
infineon,cat1-spi binding and uses a Kconfig option to select Legacy HAL
implementation instead.

See https://github.com/zephyrproject-rtos/zephyr/pull/98035 for context.

Signed-off-by: John Batch <john.batch@infineon.com>
2025-11-26 12:13:48 -05:00
Lin Yu-Cheng
c6b8128ac7 drivers: spi: add spi driver for rts5912
Add spi driver for Realtek rts5912

Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
2025-11-18 17:44:43 -05:00
Declan Snyder
687935bb68 drivers: spi_mcux_flexcomm: Abbreviate ctx
I was getting real tired of typing this out, can't believe it hasn't
already been done.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-11-18 17:42:34 -05:00
Declan Snyder
7cb3fca42e drivers: spi_mcux_flexcomm: Fix length unit mixups in DMA path
This driver had a lot of regressions introduced by commits that were
clearly mixing up what values had units of bytes and what values had
units of words. Fix the issues in the DMA path of the driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-11-18 17:42:34 -05:00
Declan Snyder
93b766f4f8 drivers: spi_mcux_flexcomm: Remove asserts
The asserts are hard to debug and unrecoverable, they just say kernel
panicked but difficult to realize where and why, it's better to return
an error and log message clearly from spi driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-11-18 17:42:34 -05:00
Declan Snyder
45cade7822 drivers: spi_mcux_flexcomm: Remove wrong assert
It is not illegal to provide an RX len with no buffer.
It just means the controller should clock out that many
words but not store them in memory. So remove the assert
and just avoid null dereference.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-11-18 17:42:34 -05:00
Declan Snyder
d3818d4365 drivers: spi_mcux_flexcomm: Refactor get_last_tx_word
Refactor this function to return an error code, instead of assert.
Put the data into a pointed argument instead.
Refactor other functions to make sure to
propogate this error all the way up the call stack.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-11-18 17:42:34 -05:00
Declan Snyder
2a7f651c1f drivers: spi_mcux_flexcomm: Skip xfer if empty
If the transfer is empty we do nothing. Avoids assert in later code
paths.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-11-18 17:42:34 -05:00
Jamie McCrae
828183f45a drivers: spi: spi_nrfx_spim: Fix not guarding deinit function
Fixes an issue with an unused function being defined if
CONFIG_DEVICE_DEINIT_SUPPORT was disabled

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-18 08:09:24 -05:00
Jordan Yates
463a6fe8b9 spi: nrfx_spim: cleanup PM usage
Release the PM constraint at the end of the context in which it was
requested (`transceive`), instead of in a semi-related function
(`finalize_spi_transaction`) which is also called by other API functions
(`spi_release`). Asynchronous usage is released in the transaction
complete callback.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-13 20:34:37 -05:00
Khoa Tran
7c529fbd0c drivers: spi: Initial driver support for SCI B SPI on Renesas RA
Add SCI B SPI driver support for Renesas RA

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
2025-11-13 20:33:44 -05:00
Terry Geng
cf3839f5ad drivers: spi: spi_pico_pio: Free sm resources when reconfiguring
When SPI spec is reconfigured, avoid reallocating another sm and properly
free the loaded sm programs before attempting to load new programs.

Fix #94416.

Signed-off-by: Terry Geng <terry@terriex.com>
2025-11-13 20:32:41 -05:00
Bindu S
fb954189ee drivers: spi: Added LPSS DMA support for SPI
Enabled intel LPSS DMA interface using dw common to support
usage of internal DMA in LPSS SPI to transfer and
receive data.

Signed-off-by: Bindu S <bindu.s@intel.com>
2025-11-13 20:31:31 -05:00
Declan Snyder
2f51f06d6f drivers: flexcomm spi: Fix 0 length xfer in dma path
If rx and tx length are both 0 in dma path then do nothing.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-11-13 23:11:23 +02:00
Khaoula Bidani
c28d779432 drivers: spi: stm32: Fix race condition causing lockup in half-duplex mode
This patch adds a check for the EOT (End Of Transfer) flag
inside the polling loop in spi_stm32_half_duplex_switch_to_receive().
If EOT is set, the transfer is already complete and the loop
is exited, preventing the lockup.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2025-11-03 16:59:05 +02:00
Declan Snyder
70e45b7039 drivers: spi_mcux_flexcomm: Fix spi slave count check
The current implementation checking for the validity of the spi slave
number is wrong. First of all, there is an off by one error where it
allows SPI_CHIP_SELECT_COUNT value as a valid slave, when really it
should be that value minus one. Secondly, it doesn't take into account
the fact that having software controlled GPIO CS can technically have
any number of slaves on the bus. So fix by finding the max of these two
values and fixing the off by one mistake. Also, for RW612, only one HW
native CS is available due to SOC pinmux limitations.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-10-31 22:40:40 +02:00
Mohamed Moawad
3559dd93ea drivers: spi: dw: Skip version detection on aux-reg platforms
The version register is not accessible through aux-reg interface,
So skip it entirely on platforms with aux-reg device tree property.

Signed-off-by: Mohamed Moawad <moawad@synopsys.com>
2025-10-28 20:17:26 -04:00
Tim Pambor
084609a7bb drivers: spi: shell: fix deprecation warning
Remove deprecated delay parameter from SPI DT macro.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-10-28 20:11:39 -04:00
Jérôme Pouiller
e515c414a8 drivers: spi: siwx91x: Fix compatibility with gpdma
Because of limitation of gpdma, DMA Rx won't run if user doesn't specify
destination buffer.

Thus, the DMA Rx may stop before the end of the full transaction. So, wait
on DMA Tx instead.

Then, the SPI data won't be consumed by the DMA. We need to properly reset
the fifo before to start a new transaction (it is better to ensure we start
with a clean state before every transaction).

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-10-28 08:46:48 -07:00
Brett Peterson
8e4e766c09 drivers: spi: add psc3 and pse84 support
- Updating spi_ifx_cat1_pdl driver to support psc3 and pse84 devices

Signed-off-by: Brett Peterson <brett.peterson@infineon.com>
2025-10-24 20:17:57 -04:00