zephyr/drivers/spi
Carlo Caione e4a125b6a4 dt: Make zephyr,memory-attr a capabilities bitmask
This is the final step in making the `zephyr,memory-attr` property
actually useful.

The problem with the current implementation is that `zephyr,memory-attr`
is an enum type, this is making very difficult to use that to actually
describe the memory capabilities. The solution proposed in this PR is to
use the `zephyr,memory-attr` property as an OR-ed bitmask of memory
attributes.

With the change proposed in this PR it is possible in the DeviceTree to
mark the memory regions with a bitmask of attributes by using the
`zephyr,memory-attr` property. This property and the related memory
region can then be retrieved at run-time by leveraging a provided helper
library or the usual DT helpers.

The set of general attributes that can be specified in the property are
defined and explained in
`include/zephyr/dt-bindings/memory-attr/memory-attr.h` (the list can be
extended when needed).

For example, to mark a memory region in the DeviceTree as volatile,
non-cacheable, out-of-order:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_VOLATILE |
			       DT_MEM_NON_CACHEABLE |
			       DT_MEM_OOO )>;
   };

The `zephyr,memory-attr` property can also be used to set
architecture-specific custom attributes that can be interpreted at run
time. This is leveraged, among other things, to create MPU regions out
of DeviceTree defined memory regions on ARM, for example:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-region = "NOCACHE_REGION";
       zephyr,memory-attr = <( DT_ARM_MPU(ATTR_MPU_RAM_NOCACHE) )>;
   };

See `include/zephyr/dt-bindings/memory-attr/memory-attr-mpu.h` to see
how an architecture can define its own special memory attributes (in
this case ARM MPU).

The property can also be used to set custom software-specific
attributes. For example we can think of marking a memory region as
available to be used for memory allocation (not yet implemented):

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_NON_CACHEABLE |
			       DT_MEM_SW_ALLOCATABLE )>;
   };

Or maybe we can leverage the property to specify some alignment
requirements for the region:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_CACHEABLE |
			       DT_MEM_SW_ALIGN(32) )>;
   };

The conventional and recommended way to deal and manage with memory
regions marked with attributes is by using the provided `mem-attr`
helper library by enabling `CONFIG_MEM_ATTR` (or by using the usual DT
helpers).

When this option is enabled the list of memory regions and their
attributes are compiled in a user-accessible array and a set of
functions is made available that can be used to query, probe and act on
regions and attributes, see `include/zephyr/mem_mgmt/mem_attr.h`

Note that the `zephyr,memory-attr` property is only a descriptive
property of the capabilities of the associated memory  region, but it
does not result in any actual setting for the memory to be set. The
user, code or subsystem willing to use this information to do some work
(for example creating an MPU region out of the property) must use either
the provided `mem-attr` library or the usual DeviceTree helpers to
perform the required work / setting.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-09-15 12:46:54 +02:00
..
CMakeLists.txt drivers: spi: Initial version of the Infineon CAT1 SPI driver 2023-09-12 10:55:01 +02:00
Kconfig drivers: spi: Initial version of the Infineon CAT1 SPI driver 2023-09-12 10:55:01 +02:00
Kconfig.ambiq drivers: spi: Add Ambiq MSPI driver 2023-09-08 14:44:12 +02:00
Kconfig.andes_atcspi200 drivers: spi: add Andes atcspi200 driver 2022-09-07 15:34:47 +02:00
Kconfig.b91 drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.bitbang drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.cc13xx_cc26xx drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.dw drivers: spi: add Data Fusion Subsystem SPI driver 2023-05-22 15:25:19 +02:00
Kconfig.esp32 drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.gd32 drivers: spi: gd32: Add support DMA transfer 2023-01-11 08:50:56 -08:00
Kconfig.gecko drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.ifx_cat1 drivers: spi: Initial version of the Infineon CAT1 SPI driver 2023-09-12 10:55:01 +02:00
Kconfig.litex drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.mchp_mss_qspi drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.mcux_dspi drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.mcux_flexcomm drivers: all: mcux: remove conditional support for pinctrl 2023-04-24 13:34:22 +02:00
Kconfig.mcux_lpspi drivers: all: mcux: remove conditional support for pinctrl 2023-04-24 13:34:22 +02:00
Kconfig.nrfx drivers: spi_nrfx_spis: Enable required SPI_SLAVE option in Kconfig 2023-08-17 11:02:24 +02:00
Kconfig.numaker drivers: spi: support for Nuvoton numaker series 2023-08-09 08:24:38 +00:00
Kconfig.nxp_s32 arch: support nocache for Cortex-R52 2022-12-12 10:39:31 +01:00
Kconfig.oc_simple drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.opentitan drivers: spi: Add OpenTitan SPI driver 2023-05-10 16:48:46 +09:00
Kconfig.pl022 drivers: spi: pl022: Add support DMA transfer 2023-04-07 13:20:16 +02:00
Kconfig.psoc6 drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.pw drivers: spi: Add Intel SPI penwell driver 2023-03-21 13:39:33 +01:00
Kconfig.rpi_pico drivers: spi: spi_pico_pio: Add basic support for SPI via PIO 2023-09-01 16:36:41 +02:00
Kconfig.rv32m1_lpspi drivers: all: rv32m1: remove conditional support for pinctrl 2023-04-24 13:34:22 +02:00
Kconfig.sam spi: SAM add RTIO support 2023-04-03 09:51:02 +02:00
Kconfig.sam0 drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.sifive drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.smartbond drivers: spi: Add driver for smartbond 2023-04-20 10:32:40 +02:00
Kconfig.spi_emul drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.stm32 drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.test drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.xec_qmspi drivers: spi: Microchip XEC QMSPI-LDMA fix spi buffer usage 2023-04-11 16:57:56 +02:00
Kconfig.xlnx drivers: spi: Update drivers to use devicetree Kconfig symbol 2022-07-25 09:38:30 +02:00
Kconfig.xmc4xxx drivers: spi: xmc4xxx: Add DMA support 2023-04-25 12:23:26 +02:00
mspi_ambiq.c drivers: spi: Add Ambiq MSPI driver 2023-09-08 14:44:12 +02:00
spi_ambiq.c drivers: spi: Add Ambiq SPI driver 2023-08-25 10:31:58 +02:00
spi_andes_atcspi200.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
spi_andes_atcspi200.h drivers: spi: add Andes atcspi200 driver 2022-09-07 15:34:47 +02:00
spi_b91.c drivers: spi: add spi_cs_is_gpio(_dt) helpers 2023-04-24 21:29:55 +02:00
spi_bitbang.c drivers: gpio: use gpio_is_ready_dt helper function 2023-08-28 08:48:35 -05:00
spi_cc13xx_cc26xx.c drivers: spi: add spi_cs_is_gpio(_dt) helpers 2023-04-24 21:29:55 +02:00
spi_context.h drivers: stm32: SPI: cannot send several buffers if frame size is 16 bits 2023-04-28 10:05:30 +02:00
spi_dw.c drivers: spi: fix spi_dw interrupt mask 2023-05-30 10:49:47 -04:00
spi_dw.h drivers: spi: fix spi_dw interrupt mask 2023-05-30 10:49:47 -04:00
spi_dw_regs.h drivers: spi: add Data Fusion Subsystem SPI driver 2023-05-22 15:25:19 +02:00
spi_emul.c emul: Only add enabled DT nodes to bus emulators 2023-07-12 09:25:18 +02:00
spi_esp32_spim.c bugfix: esp32: spi: correct idle polarity and mode configuration 2023-08-29 10:25:45 +02:00
spi_esp32_spim.h drivers: spi: esp32: add option to handle lines state 2023-08-03 12:15:18 -04:00
spi_gd32.c drivers: spi: add spi_cs_is_gpio(_dt) helpers 2023-04-24 21:29:55 +02:00
spi_gecko.c dts: spi: silabs: make peripheral-id property optional 2023-01-17 15:37:27 -06:00
spi_handlers.c drivers: spi: add spi_cs_is_gpio(_dt) helpers 2023-04-24 21:29:55 +02:00
spi_ifx_cat1.c drivers: spi: Initial version of the Infineon CAT1 SPI driver 2023-09-12 10:55:01 +02:00
spi_litespi.c device: remove redundant init functions 2023-04-19 10:00:25 +02:00
spi_litespi.h drivers: spi: spi_litespi: Update driver registers 2022-05-27 15:27:11 -07:00
spi_ll_stm32.c dt: Make zephyr,memory-attr a capabilities bitmask 2023-09-15 12:46:54 +02:00
spi_ll_stm32.h stm32h7: spi: Use TXC instead of EOT 2023-08-30 10:21:05 +02:00
spi_mchp_mss_qspi.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
spi_mcux_dspi.c dma: callback with 2 status codes for successful transfers 2023-05-08 09:57:32 +02:00
spi_mcux_flexcomm.c drivers: spi: mcux_flexcomm: fix DMA bug for 2-byte transfers 2023-07-19 10:36:23 -05:00
spi_mcux_lpspi.c drivers: spi: mcux_lpspi: allow to configure data pins 2023-08-01 09:51:16 +02:00
spi_nrfx_common.c drivers: spi_nrfx_*: Add support for optional WAKE line 2023-08-01 11:07:21 +02:00
spi_nrfx_common.h drivers: spi_nrfx_*: Add support for optional WAKE line 2023-08-01 11:07:21 +02:00
spi_nrfx_spi.c drivers: spi: spi_nrfx_spi: Add CPOL handling on SCK pin 2023-08-09 18:31:28 +00:00
spi_nrfx_spim.c drivers: spi: spi_nrfx_spim: Add CPOL handling on SCK pin 2023-08-09 18:31:28 +00:00
spi_nrfx_spis.c drivers: gpio: use gpio_is_ready_dt helper function 2023-08-28 08:48:35 -05:00
spi_numaker.c drivers: spi: support for Nuvoton numaker series 2023-08-09 08:24:38 +00:00
spi_nxp_s32.c spi: nxp_s32: use spi_cs_is_gpio() in config initializer 2023-08-14 18:11:04 +00:00
spi_nxp_s32.h drivers: spi: introduce SPI driver for NXP S32 2022-11-24 09:37:24 +01:00
spi_oc_simple.c drivers: spi: add spi_cs_is_gpio(_dt) helpers 2023-04-24 21:29:55 +02:00
spi_oc_simple.h device: Apply driver_api/data attributes rename everywhere 2020-08-11 19:30:53 +02:00
spi_opentitan.c drivers: spi: Add OpenTitan SPI driver 2023-05-10 16:48:46 +09:00
spi_pl022.c spi: pl022: remove shadow variables 2023-08-10 08:14:12 +00:00
spi_psoc6.c drivers: spi: psoc6: Fix spi_psoc6_transceive calls 2022-09-01 01:02:50 +09:00
spi_pw.c drivers: spi: add spi_cs_is_gpio(_dt) helpers 2023-04-24 21:29:55 +02:00
spi_pw.h drivers: spi: Add Intel SPI penwell driver 2023-03-21 13:39:33 +01:00
spi_rpi_pico_pio.c drivers: spi: spi_pico_pio: Add basic support for SPI via PIO 2023-09-01 16:36:41 +02:00
spi_rtio.c spi: Add RTIO support to SPI 2023-04-03 09:51:02 +02:00
spi_rv32m1_lpspi.c drivers: all: rv32m1: remove conditional support for pinctrl 2023-04-24 13:34:22 +02:00
spi_sam.c rtio: Use mpsc for submission and completion queue 2023-05-10 00:39:43 +09:00
spi_sam0.c drivers: spi: sam0: fix DMA init for parts with MCLK peripheral 2023-04-20 10:48:21 +02:00
spi_sifive.c drivers: spi: add spi_cs_is_gpio(_dt) helpers 2023-04-24 21:29:55 +02:00
spi_sifive.h drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
spi_signal.c includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
spi_smartbond.c drivers: spi: Add driver for smartbond 2023-04-20 10:32:40 +02:00
spi_test.c drivers: spi: spi_test: use the subsystem common init priority 2023-08-24 15:35:37 +02:00
spi_xec_qmspi.c spi: mec15xx: add pinctrl for mec15xx/mec1501 qmspi 2022-09-21 18:05:32 +00:00
spi_xec_qmspi_ldma.c drivers: spi: Microchip MEC172x SPI fix for Zephyr 3.4 breakage 2023-09-13 12:01:18 +02:00
spi_xlnx_axi_quadspi.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
spi_xmc4xxx.c drivers: spi: xmc4xxx: Fix comp with interrupt enabled and dma disabled 2023-05-03 14:23:32 +09:00