Commit graph

1372 commits

Author SHA1 Message Date
Tran Van Quy
243b4d46af boards: renesas: Add board device tree support for SPI on EK-RA4M1
- Add board devicetree support for SPI driver on Renesas EK-RA4M1

Signed-off-by: Tran Van Quy <quy.tran.pz@renesas.com>
2025-02-03 14:01:59 +01:00
Declan Snyder
62b911feea spi_nxp_lpspi: Rewrite driver, fix native chip sel
To fix the native hardware chip select, we need to rewrite this driver
to not use the MCUX SDK handle abstraction, which does not fit the
zephyr use case.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-30 20:26:36 +01:00
Declan Snyder
0bb7ccbb0c drivers: spi_context: Functions for remaining len
Add functions to get remaining length in the transfer. Refactor a bit to
avoid duplicate code for the for loop that is the same as in the total
length function.

The difference between the total length and left length function is that
the current buffer total length is counted in the former and the current
buffer remaining length is counted in the latter.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-30 20:26:36 +01:00
Declan Snyder
9966d29957 dts: nxp,lpspi: Fifo property and fix delay desc
Add properties for describing RX and TX fifo sizes.

Also reformat some descriptions and fix the description of the
transfer-delay property which was incorrect. Since zephyr spi bufs are
not continuous, every possible Zephyr LPSPI driver must use
continuous transfer mode, for which the meaning of this delay has
nothing to do with the chip select.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-30 20:26:36 +01:00
Fabio Baltieri
7ee8b49c4a spi_shell: add shell device filtering
Add shell device filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-29 04:17:47 +01:00
Luis Ubieda
832810e650 spi: shell: Add command to include CS GPIO in SPI device
This allows to configure a GPIO pin as a CS line, in order to perform
spi transfers to a particular device in the bus.

Example usage for using GPIO1.12 with GPIO_ACTIVE_LOW:
`spi cs gpio1 12 0x01`

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-01-27 11:02:55 +01:00
TOKITA Hiroshi
da6bf19560 drivers: spi: pl022: Enable PINCTRL conjuction with dt prop 'pinctrl-0'
If there is a pinctrl-0 property, PINCTRL will be enabled in
conjunction with it.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-01-27 11:02:23 +01:00
Declan Snyder
8978f663ae spi_nxp_lpspi: Save RAM by having driver data ptr
Make a pointer to data that is specific to a certain type of LPSPI
driver, instead of having all of it in the struct whether it is used
or not.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-27 08:55:31 +01:00
Declan Snyder
31a2b4f374 drivers: spi_nxp_lpspi: Add tristate output config
Add DT property to configure the LPSPI instance to use tristated output
instead of retained output when PCS is negated.

Turn on the config on a couple boards for test coverage.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-27 08:55:13 +01:00
Tahsin Mutlugun
4c41ec7bea drivers: spi: spi_max32: Stop DMA if transaction times out
If DMA-based transaction fails, usually due to a timeout, DMA channels
may need to be explicitly stopped otherwise further calls to transceive
function will immediately return due to DMA constantly being busy.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-01-24 11:00:27 +01:00
Tahsin Mutlugun
2e6f250127 drivers: spi: spi_max32: Handle hardware chip selection
Hardware chip select is originally handled by the HAL driver. However, a
finer grained control is needed to keep CS asserted between requests and
deassert it after last request is completed. Workaround this problem by
handling hardware chip select in Zephyr driver.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-01-24 11:00:27 +01:00
Aksel Skauge Mellbye
14a00f259f drivers: spi: silabs: eusart: Always enable peripheral
The EUSART peripheral must always be enabled in configure(), as
its enable state gets cleared when the state machine is unretained
in deep sleep. The rest of the config registers are retained,
so they can continue to not be repainted on every configure() if
the context is the same as last time.

Remove unnecessary duplicated enable at the end of configure(),
the SPIInit HAL function already performs enable.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-01-23 16:30:47 +01:00
Declan Snyder
e531c709c0 spi_mcux_lpspi: Determine lpflexcomm by inst
Determine proper irq setup depending whether the spi is wrapped in an
lpflexcomm or not on an instance basis since some platforms have some
wrapped and some not.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-21 19:28:01 +01:00
Yishai Jaffe
62ea40bb9e drivers: spi: silabs: remove gecko from name
Gecko is being phased out so we changed every mention of gecko in the
silabs spi drivers

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-01-16 22:43:59 +01:00
Pieter De Gendt
0e8aed7393 drivers: spi: spi_mcux_ecspi: Fix data size when using 16/32 bit transfers
The data size is set using a burst length, the data size for 8/16/32 is
always 1 in those cases.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-15 19:05:09 +01:00
Pieter De Gendt
7250e987e5 drivers: spi: spi_mcux_ecspi: Ignore chip select channel with cs-gpios
The internal chip selects are limited to 4, however when using GPIOS
does not pose this limitation.
Also set internal channel to 0 if GPIOS are used.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-15 19:05:09 +01:00
Haiyue Wang
03eb4791a4 drivers: spi: stm32: correct the operation flag type
The commit 2c3165d187 ("drivers: spi: add opaque type to encode SPI
operation flags") introduces new type for operation flag, since it is
16/32-bit depending on CONFIG_SPI_EXTENDED_MODES.

Use the new type for safe, if the function 'spi_stm32_shift_frames' may
use extended operation flag later.

Signed-off-by: Haiyue Wang <haiyuewa@163.com>
2025-01-15 01:38:39 +01:00
Nazar Palamar
415cc17c54 drivers: ifx_cat1: Updates to support latest version of HAL/PDL
- Refactoring to support latest versions of HAL/PDL

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2025-01-14 20:49:14 +01:00
Gerson Fernando Budke
ea7922195b clocks: atmel: sam0: Fix gclk and mclk clock bindings
The Atmel SAM0 SoC enable peripherals clocks in distinct places: PM and
MCLK. The old devices had defined the peripheral clock enable bit at PM.
On the newer devices this was extracted on a dedicated memory section
called Master Clock (MCLK). This change excludes the dedicated bindings
in favor of a generic approach that cover all cases.

Now the clocks properties is complemented by the atmel,assigned-clocks
property. It gives the liberty to user to customize the clock source
from a generic clock or configure the direct connections.

All peripherals drivers were reworked with the newer solution.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-01-14 20:49:03 +01:00
Declan Snyder
6cbe52b23c spi_nxp_lpspi: Move DMA-based code to own file
The DMA-based path of the lpspi driver is basically
almost a driver of it's own, move it to it's own file.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-14 15:39:04 +01:00
Declan Snyder
1d5cd0308c spi_nxp_lpspi: Move RTIO driver into own file
There is (almost) a whole separate driver for RTIO,
move this code to its own file and move shared code
and definitions to a common file.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-14 15:39:04 +01:00
Declan Snyder
b8a6e0b457 spi_mcux_lpspi: Move to own subfolder
Move this driver to its own subfolder to organize it
since there will be new files added for this hardware.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-14 15:39:04 +01:00
Riku Karjalainen
5011ebad3b drivers: spi: stm32 half duplex support
Add support for SPI_HALF_DUPLEX flag for STM32 SPI driver

Signed-off-by: Riku Karjalainen <riku.karjalainen@vaisala.com>
2025-01-09 09:51:29 +01:00
Dong Wang
6ab5c00336 drivers: sedi: Update device definition macros to use DT_INST variants
Updated various device definition macros to use the DT_INST variants for
consistency and improved readability.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2025-01-08 19:10:52 +01:00
Jordan Yates
13df3b9f62 spi: context: update state when already locked
Update the context state parameters when the context is already locked.
This allows changing the callback information for asynchronous
operations while the context is locked.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-01-07 00:25:33 +01:00
Jordan Yates
ebc2ca59e3 spi: spi_context: extract lock condition
Extract the lock condition to a dedicated variable to make future
changes clearer.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-01-07 00:25:33 +01:00
Andrzej Głąbek
59c94db6f0 drivers: spi_nrfx_spim: Add clock requests for fast SPIM instances
Fast SPIM instances (SPIM120 and SPIM121) for correct operation require
the highest frequency from the global HSFLL. This commit adds needed
clock controller requests to the driver. When the runtime device power
management is enabled, the frequency is requested as long as the SPIM
is resumed, otherwise it is requested for the duration of transfers.

This commit also adds a missing call to `pm_device_runtime_put()` when
SPIM reconfiguration fails.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-12-21 15:04:58 +01:00
Aksel Skauge Mellbye
6b65d60d49 drivers: spi: gecko: eusart: Support LSB first and GPIO CS
Propagate bit ordering and type of CS pin to HAL layer. Previously,
the driver assumed MSB first and EUSART hardware CS control.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-12-20 18:32:22 +01:00
Aksel Skauge Mellbye
ab9af6f161 drivers: spi: gecko: usart: Implement lock
Implement the SPI context lock in the USART SPI driver for
EFM32/EFR32.

Remove incorrect -EBUSY error when spi_release() is called while
there are still bytes in the TX FIFO. This condition does not
cause the act of releasing the lock to fail.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-12-20 16:05:53 +01:00
Aksel Skauge Mellbye
c6689a7943 drivers: spi: gecko: usart: Support CS active high and LSB first
Enable SPI flags that are easily supportable by hardware.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-12-20 16:05:53 +01:00
Yishai Jaffe
1b4cef325b shell: use shell_device_get_binding
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-18 15:32:10 +01:00
Michal Morsisko
c4923b6be0 drivers: spi_bitbang: Make SPI_LINES_OCTAL explicitly unsupported flag
Prevent the driver from perfroming transfer when SPI_LINES_OCTAL flag
is specified, as this driver supports only SPI_LINES_DUAL for now.

Signed-off-by: Michal Morsisko <morsisko@gmail.com>
2024-12-16 20:52:44 +01:00
Michal Morsisko
b76b2bbc8c drivers: spi_bitbang: Add support for SPI_TRANSFER_LSB flag
Add support for sending and receiving the least significant bit first
for the spi_bitbang driver. This driver can now be used with
SPI_TRANFER_LSB flag.

Signed-off-by: Michal Morsisko <morsisko@gmail.com>
2024-12-16 20:52:44 +01:00
Adam Kondraciuk
e8a327329a drivers: spi: nrfx_spim: Add support for device runtime PM
Enable the device runtime power management on the SPIM shim.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2024-12-16 18:26:39 +01:00
Declan Snyder
42511c80ba spi_mcux_lpspi: Move RTIO code to rtio functions
To facilitate changing this driver, decouple rtio from functions not
specific to RTIO. This also requires moving the sdk driver handle
creation outside of the configure call. An effect of this is we can
stop initializing an unused sdk driver handle for the dma path.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-12-14 01:04:28 +01:00
Declan Snyder
377e6bdf98 spi_mcux_lpspi: More precise configuration checks
These changes:
* Fix the check of the word size to be more useful
  - check min frame size instead of max
  - check for min word size requirement
  - add a clarifying comment about what the word size represents in
    hardware since the nomenclature from zephyr does not match the nxp
    references
* Add a clarifying comment about half duplex being supported by hardware
* Add LPSPI_ namespace to defines
* Change chip select error message to be more clear about the problem
* Move the check of the clock device being ready to the lpspi init,
  instead of checking it every time on configure. It probably also makes
  more sense to not ready the lpspi device if the clock is not ready.
* Move the bare-metal configuration of bit fields AFTER the SDK Init
  call.
* Return the proper error code if clock control call errors.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-12-14 01:04:28 +01:00
Dane Wagner
c4e840af56 drivers: spi: Call correct SPI device definition macros
If CONFIG_SPI_STATS is enabled, the device state for all SPI controller
drivers must contain the SPI stats. This space is allocated by calling
Z_SPI_INIT_FN as part of the device definition; this is done automatically
when using SPI_DEVICE_DT_DEFINE instead of DEVICE_DT_DEFINE. If space for
statistics is not properly allocated but CONFIG_SPI_STATS is enabled, an
unexpected write to memory outside of the stats region may occur on a SPI
transfer. This commit uses SPI_DEVICE_DT_DEFINE or
SPI_DEVICE_DT_INST_DEFINE for all in-tree SPI controller drivers.

Signed-off-by: Dane Wagner <dane.wagner@gmail.com>
2024-12-06 22:23:20 +01:00
Manuel Argüelles
0aa73c8685 dts: bindings: rename nxp,kinetis-dspi compatible
Rename "nxp,kinetis-dspi" compatible to "nxp,dspi" to remove the
device family from its name.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2024-12-06 22:22:51 +01:00
Ilya Tagunov
3fb8860f3e drivers: spi: dw: fix DesignWare spelling in Kconfig prompts
Just a minor spelling alignment of user-visible prompts.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
2024-12-06 12:13:45 +01:00
Ilya Tagunov
bc8ef12429 drivers: spi: dw: select PINCTRL if necessary
DesignWare SPI driver may use pinctrl configuration if it's provided
for the nodes.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
2024-12-06 12:13:45 +01:00
Ian Morris
6682a10183 drivers: spi: smartbond: remove default enabling of dma acceleration
The Smartbond SPI driver enables DMA acceleration by default. However
no DMA configuration is provided in the SPI node, resulting in run
time errors when the SPI interface is used. Instead, the application
should explicitly enable DMA acceleration and select the DMA channels
and priorities.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2024-12-06 10:01:42 +01:00
Gerard Marull-Paretas
813fc4d6bb drivers: all: cc12xx_cc26xx: select PINCTRL
select PINCTRL when needed instead of relying on board-level options.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-12-05 15:18:01 +01:00
Gerard Marull-Paretas
f3a125e018 drivers: all: telink-b91: select PINCTRL
Select PINCTRL as needed.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-12-05 15:17:47 +01:00
Reto Schneider
ea205bcf8e drivers: spi: Sort CMake and Kconfig files alphabetically
By sorting the lines alphabetically, merge conflicts can be reduced.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-12-05 07:45:08 +01:00
Yishai Jaffe
812347fae8 drivers: spi: Place API into iterable section
Add wrapper DEVICE_API macro to all spi_driver_api instances.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-02 22:07:50 +00:00
Manuel Argüelles
4ab9172c92 dts: bindings: rename nxp,imx-lpspi compatible
Rename "nxp,imx-lpspi" compatible to "nxp,lpspi" to remove the
device family from its name.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2024-12-02 22:06:47 +00:00
McAtee Maxwell
3024392d35 SOC: Remove config PINCTRL from xmc4xxx soc
- Move selection of CONFIG_PINCTRL from soc to individual
	  drivers
	- in accordance with issue #78619

Signed-off-by: McAtee Maxwell <maxwell.mcatee@infineon.com>
2024-12-02 22:05:16 +00:00
Declan Snyder
7271000fe5 drivers: spi_mcux_lpspi: Clean up DMA path
Clean up DMA path of code.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
2c884a9274 drivers: spi_mcux_lpspi: Optimize dma callback
Optimize DMA callback by cleaning up the code and storing less debug
logging strings.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
5dbe322c9b drivers: spi_mcux_lpspi: Clean up configure func
Do all input validation etc BEFORE setting up configuration,
instead of mixing these things everywhere. Also condense the formatting
of the code.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00