Commit graph

1372 commits

Author SHA1 Message Date
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
Pisit Sawangvonganan
dcd0a2756d drivers: spi: remove '&' when assigning init_fn
Remove address-of operator ('&') when assigning `init_fn`
function pointer in `DEVICE_DT_INST_DEFINE` macro.

This change aims to maintain consistency among the drivers in
`drivers/spi`, ensuring that all function pointer assignments
follow the same pattern.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 06:08:04 -04:00
Fin Maaß
d71ad169d4 drivers: spi: litex: add litespi driver
add litespi driver for flash.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-01 12:39:02 +02:00
Fin Maaß
0f3955cc80 drivers: spi: litex: rework spi driver
rework the litex spi driver.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-01 12:39:02 +02:00
Fin Maaß
9a7037683d drivers: spi: litex: rename driver
rename litex spi driver.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-01 12:39:02 +02:00
Hao Luo
6ed058887e drivers: spi: simplified spi_ambiq_xfer function
Simplified spi transfer process to make it more readable

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-07-28 07:29:28 +03:00
Hao Luo
8379f64393 drivers: bluetooth: hci_ambiq: get the spi cfg from the device
Use the SPI configuration from the SPI device for data transaction.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-07-28 07:29:28 +03:00
Hao Luo
3faaaaba59 drivers: spi: Change to use software controlled cs in default
Added support for software controlled cs in Ambiq SPI drivers

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-07-28 07:29:28 +03:00
Liam Beguin
67544a6d2d spi: shell: add missing newline character
Add missing newline in help string.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
2024-07-12 09:12:47 -04:00
Alberto Escolar Piedras
0cf89bb8b4 drivers/spi/spi_xlnx_axi_quadspi: Build fix w CONFIG_SPI_ASYNC
Fix a build error when CONFIG_SPI_ASYNC is set.
The issue was detected by CI

```
spi_xlnx_axi_quadspi.c: In function 'xlnx_quadspi_isr':
spi_xlnx_axi_quadspi.c:489:21: error: 'ctx' undeclared
  489 |                 if (ctx->asynchronous) {
      |                     ^~~
```

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-07-10 19:13:46 -04:00
Nazar Palamar
bf17ba9d43 driver: spi: psoc6: fix build error in driver
fix build error related to pinctrl.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-07-08 15:51:21 +02:00
Chang Feng
971a0d1d93 driver: spi: gd32: fix spi reg clear wrong flag
SPI DMATEN and DMAREN flags are in SPI_CTL1 register. fixed wrong register.

Signed-off-by: Chang Feng <chang_196700@hotmail.com>
2024-07-01 09:16:22 +02:00
Adrien MARTIN
fd90c9ba21 drivers: spi: gecko: propagate spi config error
This commit catch the return code of the spi_config function and
early returns on error so that high level spi transfer api gets
the error too.

Signed-off-by: Adrien MARTIN <adrienmar@kickmaker.net>
2024-06-28 21:53:22 +02:00
Jordan Yates
91f8c1aea9 everywhere: replace #if IS_ENABLED() as per docs
Replace `#if IS_ENABLED()` with `#if defined()` as recommended by the
documentation of `IS_ENABLED`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-28 07:20:32 -04:00
Fin Maaß
115d3d8aa7 drivers: spi: litex: add missing include
add missing include of `soc.h`.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-06-27 10:55:09 -04:00
Hao Luo
d1eea369b1 drivers: ambiq: Add dependencies to avoid showing to non-ambiq platforms
Fixed the Kconfig.ambiq under i2c and spi so that they don't litter.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-06-27 08:59:40 -04:00
Johan Carlsson
79a2e2445d drivers: spi: mcux_flexcomm: fix invalid dma config for last tx packets.
fixes an incorrect dma configuration. When lpc dma driver was extended
with gather/scatter support the spi dma driver stopped working.

Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
2024-06-27 08:50:39 -04:00
Jordan Yates
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Tomasz Bursztyka
b0e327bd9c drivers/spi: Fix context release in case of error
SPI context has to be released even in case of error.

Fixes: #72782

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@proton.me>
2024-06-22 05:39:55 -04:00
Ioannis Damigos
c7da55ef2c spi_smartbond: check that DMA controllers were provided
Check that DMA controllers were provided in
spi_smartbond_dma_deconfig()

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-18 14:36:38 -04:00