zephyr/drivers/adc
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
..
adc_ads1x1x.c adc: ads1x1x: improve behaviour during i2c errors 2023-08-16 17:05:44 +02:00
adc_ads114s0x.c drivers: adc: configurable acquisition time for ADS114s0x 2023-07-24 13:21:13 +00:00
adc_ads1112.c drivers: adc: Add support for TI ADS1112 ADCs 2023-06-17 07:49:59 -04:00
adc_ads1119.c drivers: adc_ads1119: Fix using wrong status bit 2023-01-27 18:09:49 +09:00
adc_ads7052.c adc: ADS7052 correct spi configuration 2023-05-03 08:46:37 -05:00
adc_b91.c
adc_cc13xx_cc26xx.c drivers: ti: cc13xx/cc26xx: implement ADC driver 2022-11-04 17:31:59 -04:00
adc_cc32xx.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
adc_common.c
adc_context.h drivers: adc: configurable wait for completion timeout 2023-07-19 15:22:33 +00:00
adc_emul.c drivers: adc: adc_emul: Move semicolon to allow for multi-instancing 2023-04-20 10:48:33 +02:00
adc_esp32.c soc: esp32s3: add ADC single-shot support 2023-08-17 10:36:20 +02:00
adc_gd32.c treewide: Update clock control API usage 2023-04-05 10:55:46 +02:00
adc_gecko.c drivers: adc: add ADC driver for EFM32 2023-07-18 11:05:39 +00:00
adc_handlers.c
adc_ifx_cat1.c drivers: cat1: Updates to support latest version of HAL/PDL 2023-09-01 09:52:25 +02:00
adc_ite_it8xxx2.c tests: drivers: Unit test for it82xx2_evb board 2023-04-19 03:48:38 -04:00
adc_lmp90xxx.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
adc_max1125x.c drivers: adc: add max1125x driver 2023-08-18 12:05:17 +02:00
adc_max11102_17.c drivers: adc: add driver for MAX11102-MAX11117 2023-09-14 08:32:46 -05:00
adc_mchp_xec.c adc: adc_mchp_xec: fix CONFIG_PM_DEVICE compilation 2023-03-28 17:36:32 -04:00
adc_mcp320x.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
adc_mcux_12b1msps_sar.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
adc_mcux_adc12.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
adc_mcux_adc16.c dma: callback with 2 status codes for successful transfers 2023-05-08 09:57:32 +02:00
adc_mcux_lpadc.c drivers: lpadc: fix ADC command chaining 2023-07-12 09:25:44 +02:00
adc_npcx.c driver: adc: npcx: remove threshold-reg-offset DT property 2023-09-08 14:43:37 +02:00
adc_nrfx_adc.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
adc_nrfx_saadc.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
adc_nxp_s32_adc_sar.c drivers: adc: add NXP S32 ADC SAR driver 2023-07-28 08:55:38 -05:00
adc_rpi_pico.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
adc_sam0.c drivers: adc: sam0: fix compliation for feature SAMs for C21. 2022-10-25 15:48:13 -07:00
adc_sam_afec.c treewide: Update clock control API usage 2023-04-05 10:55:46 +02:00
adc_sam.c drivers: adc: adc_sam: Introduce Atmel SAM ADC driver 2023-03-23 09:41:00 +01:00
adc_shell.c drivers: adc: add MAX11102-MAX11117 to ADC shell 2023-09-14 08:32:46 -05:00
adc_smartbond_gpadc.c drivers: adc: add adc support for Smartbond devices 2023-05-22 12:41:42 +02:00
adc_smartbond_sdadc.c drivers: adc: add adc support for Smartbond devices 2023-05-22 12:41:42 +02:00
adc_stm32.c dt: Make zephyr,memory-attr a capabilities bitmask 2023-09-15 12:46:54 +02:00
adc_test.c device: remove redundant init functions 2023-04-19 10:00:25 +02:00
adc_tla2021.c drivers: tla2021: Add driver 2023-07-03 09:30:54 +02:00
adc_vf610.c drivers/adc: imx6sx ADC support. 2023-05-08 16:42:40 +02:00
adc_xmc4xxx.c drivers: adc: Add ADC xmc4xxx drivers 2022-12-20 14:17:23 +01:00
CMakeLists.txt drivers: adc: add driver for MAX11102-MAX11117 2023-09-14 08:32:46 -05:00
iadc_gecko.c drivers: adc: iadc_gecko: select proper bits from sample 2023-07-18 16:21:09 +02:00
Kconfig drivers: adc: add driver for MAX11102-MAX11117 2023-09-14 08:32:46 -05:00
Kconfig.adc_emul
Kconfig.ads1x1x adc: Move to using select in Kconfig for I2C & SPI busses 2022-08-12 17:39:21 +02:00
Kconfig.ads114s0x drivers: adc: configurable wait for completion timeout 2023-07-19 15:22:33 +00:00
Kconfig.ads1112 drivers: adc: Add support for TI ADS1112 ADCs 2023-06-17 07:49:59 -04:00
Kconfig.ads1119 adc: Move to using select in Kconfig for I2C & SPI busses 2022-08-12 17:39:21 +02:00
Kconfig.ads7052 adc: Add TI ADS7052 SPI driver 2023-04-07 16:23:17 -05:00
Kconfig.b91
Kconfig.cc13xx_cc26xx drivers: ti: cc13xx/cc26xx: implement ADC driver 2022-11-04 17:31:59 -04:00
Kconfig.cc32xx
Kconfig.esp32 drivers: adc: esp32: Add support for single-shot conversion 2022-12-23 23:45:05 +00:00
Kconfig.gd32
Kconfig.gecko drivers: adc: add ADC driver for EFM32 2023-07-18 11:05:39 +00:00
Kconfig.ifx_cat1 driver: adc: infineon: Adding ADC driver 2023-04-27 10:16:23 -07:00
Kconfig.it8xxx2 ITE: drivers/adc: Add config of ADC reference voltage full-scale 3300mV 2023-02-23 08:59:54 +01:00
Kconfig.lmp90xxx crc: Make the build of crc function dependent on a Kconfig 2022-11-23 13:30:00 +01:00
Kconfig.max1125x drivers: adc: add max1125x driver 2023-08-18 12:05:17 +02:00
Kconfig.max11102_17 drivers: adc: add driver for MAX11102-MAX11117 2023-09-14 08:32:46 -05:00
Kconfig.mcp320x adc: Move to using select in Kconfig for I2C & SPI busses 2022-08-12 17:39:21 +02:00
Kconfig.mcux drivers: adc: rewrite mcux LPADC driver 2023-03-23 08:58:44 +00:00
Kconfig.npcx
Kconfig.nrfx
Kconfig.nxp_s32 drivers: adc: add NXP S32 ADC SAR driver 2023-07-28 08:55:38 -05:00
Kconfig.rpi_pico drivers: adc: Add support for RaspberryPi Pico ADC 2022-09-06 17:11:19 +02:00
Kconfig.sam drivers: adc: adc_sam: Introduce Atmel SAM ADC driver 2023-03-23 09:41:00 +01:00
Kconfig.sam0
Kconfig.sam_afec
Kconfig.smartbond drivers: adc: add adc support for Smartbond devices 2023-05-22 12:41:42 +02:00
Kconfig.stm32 drivers: adc: stm32: allow to use multiple ADCs with STM32F3 series 2023-05-22 15:26:26 +02:00
Kconfig.test
Kconfig.tla2021 drivers: tla2021: Add driver 2023-07-03 09:30:54 +02:00
Kconfig.vf610 drivers/adc: imx6sx ADC support. 2023-05-08 16:42:40 +02:00
Kconfig.xec driver: adc: microchip: Keep single adc driver for MEC devices 2023-03-23 11:43:30 -04:00
Kconfig.xmc4xxx drivers: adc: Add ADC xmc4xxx drivers 2022-12-20 14:17:23 +01:00