Commit graph

1291 commits

Author SHA1 Message Date
Fin Maaß
b8999973d3 drivers: spi: litex: add flush of rx buffer
this flushes the rx buffer before the
start of a new transaction. It is needed
because the litex bios is not always
reading the rx buffer.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-29 14:18:41 -05:00
Johan Carlsson
a3530d6a43 drivers: spi: mcux_flexcomm: use rxignore bit instead of dummy read.
when no rx data need to be read set the rxignore bits.
with this change the dma setup is faster and no unnecessary
dummy writes are done to memory.

Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
2024-10-29 14:16:56 -05:00
Johan Carlsson
ff5afd8a9a drivers: spi: mcux_flexcomm: wait for specific dma tx status.
when sending multiple bytes only the DMA_STATUS_COMPLETE
status is interesting. otherwise the semaphore will be signaled twice.

Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
2024-10-29 14:16:36 -05:00
Hao Luo
1e5cdb110a drivers: spi: Add SPI device support for Apollo3 SoCs
This commit adds spi device support for Apollo3 SoCs.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-10-26 11:31:11 +02:00
Hao Luo
05531647ee drivers: spi: remove unused variables
Removed unused variables to get rid of warning

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-10-23 11:19:56 +02:00
Luis Ubieda
1fdf6e64fb spi: sam: Refactor driver to use SPI RTIO common APIs
- Following similar approach followed on spi_mcux_lpspi driver.
- Enabling DMA by default when SPI RTIO is selected to favor
non-blocking transfers.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-10-22 18:30:24 -04:00
Dimitrije Lilic
15ec1f2016 driver: spi: MAX32 add RTIO support plus refactor
Implements the SPIO RTIO API. Refactors internal transcive
fucntios to work with both existing SPI API and RTIO functions.

When SPI_RTIO is enabled the spi_transcieve call translates
the request into an RTIO transaction placed in the queue
that device will execute.

Include the latest refacor changes of RTIO.

Signed-off-by: Dimitrije Lilic <dimitrije.lilic@orioninc.com>
2024-10-22 20:42:20 +02:00
Hao Luo
a1cd2d6c83 drivers: pm: add pm_policy_state_lock for drivers
Added pm_policy_state_lock to prevent memory power
off during data transfer

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-10-22 14:14:34 +02:00
Teresa Zepeda Ventura
6773f33445 drivers: spi: gecko: add new driver for SPI communication via EUSART
Added a new driver to support SPI communication via EUSART. Since the
Silabs EFR32MG24 family SoCs have only one USART, EUSART support is
necessary for implementing SPI functionality.

Signed-off-by: Teresa Zepeda Ventura <teresa.zvent@gmail.com>
2024-10-21 12:46:21 +02:00
Daniel Gaston Ochoa
f05fb41587 drivers: spi: stm32h7: Avoid unnecessary FIFO flush
The RxFIFO is already flushed any time a transceive operation
finishes, there is no need for doing it also before the
transaction start.

The aim of this change is to simplify the logic and to
(potentially) reduce the minimum time between transactions.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2024-10-18 09:17:46 +02:00
Florian Weber
0d9cdf0990 drivers: sensors: rtio
Inform the executor of a submissions completion with -ENOMEM
if the size of the workq is not big enough.

Signed-off-by: Florian Weber <Florian.Weber@live.de>
2024-10-17 15:37:49 -04:00
Hao Luo
e7a64f74a8 drivers: i2c: add runtime put for error path
The previous error path incorrectly returned without
calling runtime put async

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-10-16 12:26:17 +02:00
Emilio Benavente
82a192c8a9 boards: nxp: Removing CONFIG_PINCTRL from the boards defconfig
The Drivers using Pinctrl should be turning Pinctrl on
this should not be the responsibility of the board. This
commit removes CONFIG_PINCTRL from the boards side for nxp boards.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-10-15 19:09:45 -04:00
Declan Snyder
ca829e1b77 include: spi: Clarify data frame units and meaning
Make clear in the include/ header that data frame size
is the same thing as word size for the context of this API.

Also, add some comments to the spi_context to make it easier
for driver writers to understand how to use the functions,
by noting the meaning of the dfs and len parameters to the update
functions. Otherwise it takes some time to understand what they mean.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-10-14 13:03:10 +02:00
Declan Snyder
a6eb068e3c drivers: spi_mcux_lpspi: clang-format
Clang format the lpspi driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-10-10 10:07:55 +02:00
Ioannis Damigos
6c6a1e550c da1469x: Remove CONFIG_PINCTRL from all defconfig files
Remove CONFIG_PINCTRL from all defconfig files.

Fixes #78619

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-10-08 16:57:41 +02:00
Yong Cong Sin
52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01:00
Daniel Gaston Ochoa
bce51b7706 drivers: spi: stm32h7: avoid unnecessary suspend
The SPI stm32 H7 driver always suspends the SPI transaction
when finishing the transceive operation. This, according to
the stm32 H7 datasheet, must only be done when the SPI master
is configured as receive-only, and the driver always
configures it as full-duplex.

Hence, remove this unnecessary operation for clarify and for
a potential reduction in the minimum time between SPI
transceive operations.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2024-10-02 14:42:48 +01:00
Aksel Skauge Mellbye
d82acdc4e4 drivers: spi: gecko: Use clock control on Series 2
Use clock control driver to configure peripheral clock on
Series 2 devices.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-09-30 17:12:01 +01:00
Declan Snyder
30a8f87d6a drivers: spi_mcux_lpspi: Fix synchronous DMA CS
Fix the chip select when using the synchronous API with DMA path.

Note need to use TxDataRequest flag instead of ModuleBusy flag now
because module busy flag will not deassert until PCS deasserts.

This does not fix CS for the non-DMA path, because that would require a
large driver rework.

Do not skip configuration when calling transceive with the same spi_cfg
because we need to write a new command word.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-09-26 03:33:05 -04:00
Declan Snyder
0186bfb2d0 drivers: spi_mcux_lpspi: Enable debug mode
When CONFIG_DEBUG is turned on, enable debug mode for the LPSPI.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-09-26 03:33:05 -04:00
Bill Waters
eb19d32588 drivers: Remove CONFIG_PINCTRL in defconfig files
The CONFIG_PINCTRL setting is removed from the board
_defconfig files.  And "select PINCTRL" is added to
the appropriate driver files.

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2024-09-23 18:08:14 -04:00
Filip Kokosinski
0abc9fb8be boards: remove CONFIG_PINCTRL from defconfig files of FE310-based boards
This commit removes the y-selection of the `CONFIG_PINCTRL` Kconfig option
in FE310-based boards defconfig files.

It also makes drivers used in FE310 y-select `CONFIG_PINCTRL` if pinmuxing
is needed.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-09-20 13:14:41 +02:00
Pisit Sawangvonganan
a9800e2ea7 style: drivers: adjust return usage in void functions
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
  `foo();`
  `return;`
- Remove unnecessary `return` statements when
  they don't affect control flow.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-18 09:56:16 +02:00
Quy Tran
3ccd52b657 drivers: spi: update casting for MSTP register
Update casting for MSTP register in SPI driver

Signed-off-by: Quy Tran <quy.tran.pz@renesas.com>
2024-09-17 20:10:46 -04:00
Luis Ubieda
00abc5a661 spi: rtio: Move spi_rtio_copy to spi_rtio
To group all common APIs for SPI RTIO.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-09-16 20:19:51 +02:00
Luis Ubieda
bd8a23f719 spi: rtio: Extract common APIs into separate file
Extracted common SPI RTIO operations from the spi_mcux_lpspi driver
into spi_rtio, which should be common across RTIO drivers.

Tested with spi_loopback with and without CONFIG_SPI_RTIO. Ran on
mimxrt1010_evk.

Also, verified the other SPI RTIO driver (spi_sam) is not broken by
these changes (tested building for target: robokit1 with the same
conditions as above).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-09-16 20:19:51 +02:00
Luis Ubieda
b135cc5e46 spi: spi_mcux_lpspi: Removed spin lock from iodev_start
Does not seem to be required. This allows hiding away the spin lock APIs.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-09-16 20:19:51 +02:00
Luis Ubieda
7510a17c18 spi: mcux_lpspi: Refactor driver to extract common RTIO functionality
As a step to make them common code: spi_rtio.c.
Verified this refactorization builds and passes spi_loopback, both with
CONFIG_SPI_RTIO enabled, as well as disabled. Tested on mimxrt1010_evk.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-09-16 20:19:51 +02:00
Pisit Sawangvonganan
847a4eaad2 style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Tahsin Mutlugun
6b14bbc13c drivers: spi: spi_max32: Add DMA support
Add DMA support to MAX32 SPI driver.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2024-09-10 14:39:51 +01:00
Sylvio Alves
8233b70ece espressif: clean up unused code
Remove all entries that as not being used.
This also update hal to re-enable warning flags
as such as -Wno-unused-variable.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-09-09 13:55:39 -04:00
Luis Ubieda
64a038aca3 spi: all: Add default iodev_submit to drivers without native support
So that all SPI drivers are compatible with RTIO APIs.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-09-05 11:44:32 -05:00
Luis Ubieda
3efc69ebd3 spi: rtio: Add default iodev_submit handler
To emulate SPI RTIO behavior for drivers that do not have native
support yet.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-09-05 11:44:32 -05:00
Duy Phuong Hoang. Nguyen
bec9952ce8 driver: spi: Add initial support for spi driver on ra8
Add initial SPI driver support for RA8 MCUs

Signed-off-by: Duy Phuong Hoang. Nguyen <duy.nguyen.xa@renesas.com>
2024-09-04 21:28:19 +02:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Anke Xiao
04ae22eb22 drivers: spi: update spi_mcux_flexio.c
After testing the flexio spi_loopback on the ke1xz platform,
it is found that the master transfer and receive are not
synchronized. So add loop code to wait for the master transfer
to complete for frdm_ke17z and frdm_ke17z512 platforms.

Signed-off-by: Anke Xiao <anke.xiao@nxp.com>
2024-08-28 06:50:50 -04:00
Raffael Rostagno
2ea9483009 drivers: spi: esp32c2: esp8684: Add support
Addded support to SPI2 module for ESP32C2 and ESP8684 devices

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-26 17:06:02 +02:00
Marcio Ribeiro
b9ccaaea53 drivers: spi: esp32: fix exception in mode 3 & soft-ctrld CS
Fixes division by zero exception when SPI is configured to operate in mode3
whit CS controlled by software.

Such exception occurred because data->dfs is listed as the denominator in
a division inside the spi_esp32_transfer() function which is called from
spi_esp32_configure() (before assigning a value to data->dfs) inside
transceive() in the condition where mode 3 is chosen as the SPI operating
mode and the chip select is configured to be software-controlled.

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2024-08-23 15:50:03 +01:00
Raffael Rostagno
90c6106926 drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
bb746cdcc5 drivers: esp32: esp_intr_alloc return condition
Add checks to return value of esp_intr_alloc to avoid drivers init
returning 0 when interrupt allocation fails.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
0b3a34cdca drivers: esp32: Interrupts priority configuration
Allows configuring interrupts priority in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Pisit Sawangvonganan
1bcae0ea9f style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Zhengwei Wang
4a7adb3d9d drivers: spi: pm: Add power management support for Ambiq Apollo3 SoCs SPI
Add power management support for Apollo3/Apollo3P SPI, and
automatically enables device runtime power management

Signed-off-by: Zhengwei Wang <zwang@ambiq.com>
2024-08-20 10:32:52 +02:00
Ha Duong Quang
3bff3168f5 drivers: spi_nxp_s32: update to RTD 2.0.0
Update to use rtd function to upadte Keep CS asserted
after the next transfer.

Signed-off-by: Ha Duong Quang <ha.duongquang@nxp.com>
2024-08-20 10:32:32 +02:00
Sadik Ozer
d42301bc8c drivers: spi: Fix twister build issue
Update spi_bitbang_transceive_async function parameter to it match
with correct one that declared in struct

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2024-08-19 15:18:09 -04:00
Tom Burdick
caa0c0a467 rtio: Split the rx and tx buffer unions
Transmit/write buffers are expected to be constant values given to the
operation to transmit but not mutate. Seperate the OP_TX and OP_RX
operation description unions.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-08-17 08:55:01 -04:00
Sadik Ozer
420f230b9f drivers: spi: Select PINCTRL for MAX32 MCUs
PINCTRL require to be selected for SPI

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2024-08-16 16:29:55 +01:00
Richard Wheatley
5ab83d8fee drivers: spi: remove old ambiq mspi
Remove the old Ambiq MSPI

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2024-08-11 19:18:09 -05:00
Richard Wheatley
188fc58c72 drivers: update AMBIQ drivers to use proper base address
REG_X_BASEADDR will be removed from all hal files.
This forces the use of the peripheral base address
Define MSPI_PORT macro for chip drivers

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2024-08-11 19:18:09 -05:00