Commit graph

1291 commits

Author SHA1 Message Date
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
Declan Snyder
b7c35fb569 drivers: spi_mcux_lpspi: Remove rtio prepare_start
Remove unneeded prepare_start function since all uses of it are paired
with the start function. Also, probably should not mess with chip select
before deciding to do the transfer. And just return on some error like
the rest of the driver does instead of assert.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
d6a6b11aac drivers: spi_mcux_lpspi: ErrLog dev in iodev_start
Log the device name and status if the transfer could not start,
same way as in non-RTIO path.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
47115e3afe drivers: spi_mcux_lpspi: Macro for master cfg flag
All the master transfer seemed to use the same config flags,
reuse with a macro.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
561b4347d7 drivers: spi_mcux_lpspi: Clean up next_packet func
Next packet function is way more complicated than it needs to be. Clean
it up by simplifying the code and making readable helper functions.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
af3c25a1f8 drivers: spi_mcux_lpspi: Remove commented code
Remove lines of code that are commented out.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
fa82ec0602 drivers: spi_mcux_lpspi: Remove duplicate bufsetup
This line doesn't need to be in multiple places.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
830c0a9e3c drivers: spi_mcux_lpspi: clean up transceive calls
Move transceive funtions next to each other and clean up the wrapping of
functions to eliminate the ifdefs.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
810b563ea7 drivers: spi_mcux_lpspi: Group API functions
Group the actual API functions to be next to each other.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
595e16caf6 drivers: spi_mcux_lpspi: Consolidate IRQ handle
Small change to consolidate the amount of lines of code in
the spi_mcux_isr by making a macro for the argument and removing
a line of code that was commented out.

Also move the ISR to be the first function in the file which is
common in many other drivers, instead of randomly in the middle of the
file. And move the isr callback to be next to the isr.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
e21bf37f13 drivers: spi_mcux_lpspi: Minor RTIO cleanup
Add closing comment for #ifdef and remove unnecessary
indentation of an else block. Also move the transcieve_rtio
function to be near the other rtio functions. And move function
prototypes to top of file.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
5d081c98fb drivers: spi_mcux_lpspi: Create DMA dev helpers
Create helper functions for duplicated code related to
checking for DMA devices, with readable names.

Also remove unneeded function prototype.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
d76ccdbdea drivers: spi_mcux_lpspi: Clean up init function
Do initializations in a more logical order,
remove unnecessarily duplicated code,
reorder stack variables to be in reverse christmas tree order.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
5a0d9831b1 drivers: spi_mcux_lpspi: Move init to end of file
Move init function to bottom of file by custom.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
0727566c4a drivers: spi_mcux_lpspi: Remove parent_dev field
Remove parent_dev from config struct, and simplify code for the
definition and use of the irq config function.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Declan Snyder
6607976a55 drivers: spi_mcux_lpspi: Organize top of file
Organize #includes and #defines for less redundancy
and more readability.

Shorten some macros to avoid multi line statements.

Add some comments.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-27 22:54:09 -05:00
Adam Kondraciuk
db290a62f9 drivers: spi: nrfx_spim: set/clear pins retention
Add pins retention control when GPD is enabled for SPIM.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2024-11-27 10:39:00 -05:00
Fin Maaß
a45e5f0424 drivers: spi: remove unused register
core_mmap_dummy_bits is not used by the
driver and also optional in litex.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-11-27 06:58:11 -05:00
Johan Hedberg
76400b362c drivers: spi: gecko: Add PINCTRL dependency
The gecko_eusart and gecko_usart SPI drivers should use pinctrl on all
Series 2 boards.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-11-26 15:42:02 -05:00
Khoa Nguyen
0fd6c97f98 drivers: spi: Add condition check for close before open spi
Add condition check for close before open to prevent
invalid pointer access

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2024-11-26 10:36:55 +00:00
TOKITA Hiroshi
88149afff7 soc: raspberrypi: Drop PINCTRL from Kconfig.defconfig
The `Kconfig.defconfig` is not good place for put `select PINCTRL`.
Drop `select PINCTL` from `Kconfig.defconfig` and add it at each
driver's Kconfig.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-11-25 14:42:01 +01:00
Khoa Nguyen
c312b322ad drivers: spi: Add support SPI driver for Renesas RA6, RA4, RA2
- Add SPI driver support for RA
- RA2A1 not support slave select keeping level so disable it
in Kconfig

Signed-off-by: Tri Nguyen <tri.nguyen.wj@bp.renesas.com>
Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2024-11-25 01:02:35 +01:00
cyliang tw
355d032baa boards: nuvoton: numaker: Drop PINCTRL from board defconfig
To remove CONFIG_PINCTRL from board side for numaker boards.
The Drivers using Pinctrl should be turning Pinctrl on
instead of the responsibility of the board.

Fixes #78619

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-11-20 08:23:58 -05:00
Ren Chen
06f4213e6b driver: spi: support it8xxx2 spi driver
This commit adds the it8xxx2 spi driver support.

Tested with:
- west build -p always -b it8xxx2_evb samples/drivers/spi_flash

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2024-11-16 15:20:51 -05:00
Steve Boylan
d0aced304b drivers: spi: RPi Pico PIO SPI code size and byte order.
Use minimized PIO code for 3-wire operation.

Input and output buffers are conventionally stored in bus byte order.
For 16 and 32 bit transfers, this is effectively big-endian, so
txbuf and rxbuf need to be read as such.  Those pointers also need
to be declared uint8_t * instead of void *.
In addition, tx_count and rx_count are based on dts, and refer to
whole transfers (8, 16, or 32 bits), not bytes.

Added rpi_pico.overlay to samples/sensor/magn_polling to demonstrate
32-bit word size, and updated the README.rst to make it independent
of the specific sensor.

Clean up compliance check failures.
Fix typos.
Synchronize 3-wire TX and RX cycles.
Simplify state machine synchronization
Minimize SPI bus delay time in 3-wire mode
Move clock delay to PIO code and remove k_sleep

Signed-off-by: Steve Boylan <stephen.boylan@beechwoods.com>
2024-11-16 14:00:16 -05:00
McAtee Maxwell
2fe4a37f38 Documentation: Update documenation for Infineon boards
-Update formatting and contents of index.rst for cy8ckit_062s4
	-Update formatting and contents of index.rst for cy8ckit_064s0s2_4343w
	-Update formatting and contents of index.rst for cy8cproto_062_4343w
	-Update formatting and contents of index.rst for cy8cproto_063_ble
	-Update formatting and contents of index.rst for xmc45_relax_kit
	-Update formatting and contents of index.rst for xmc47_relax_kit
	-Change all instances of "PSoC" to "PSOC" for infineon platforms

Signed-off-by: McAtee Maxwell <maxwell.mcatee@infineon.com>
2024-11-14 20:36:38 -06:00
Nazar Palamar
7e1b00d35e Infineon: board: remove CONFIG_GPIO from defconfigs
Remove CONFIG_GPIO from defconfigs for Infineon boards.
Applications, drivers will enable GPIO if need.

Added 'select GPIO' from spi/Kconfig.ifx_cat1
Added 'select GPIO' from wifi/infineon/Kconfig.airoc

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-11-14 17:27:06 -06:00
Declan Snyder
92d0287813 drivers: spi_mcux_lpspi: Fix DMA path on RT
Apparently, the previous change to fix the chip select only works on
some newer revisions of the LPSPI, and the behavior is different on
older parts like RT. For now put some #ifdef to keep the fixed CS on
MCXN but have the old behavior on RT and other platforms.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-08 15:56:06 -06:00
Jun Lin
69e85b25fe board: npcx: remove CONFIG_PINCTRL from defconfig of npcx boards
The CONFIG_PINCTRL is removed from the board's defconfig files.
Drivers which use pin control function should add "select PINCTRL"
in their Kconfig files.

Fixes #78619

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-11-07 08:59:14 -08:00
Thao Luong
c66dcd52db drivers: Select PINCTRL for renesas RA drivers
Select PINCTRL for drivers: adc, i2c, pwm, serial and spi

Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
2024-11-06 09:59:32 -08:00
Gerson Fernando Budke
0cc8f93e8a soc: atmel: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.sam*.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:43:26 -06:00
Gerson Fernando Budke
52d21d7bf0 soc: gd32: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.gd32.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:40:42 -06:00