zephyr/dts/bindings
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 dts: bindings: adc: add MAX11102-MAX11117 2023-09-14 08:32:46 -05:00
alh
arc
arm dts: infineon: SCB declaration 2023-05-10 16:49:59 +09:00
audio drivers: audio: tas6422dac: add driver 2023-09-13 16:27:11 +02:00
auxdisplay drivers: auxdisplay: Add driver for PTC PT6314 VFD controller 2023-07-14 12:09:03 +02:00
base dt: Make zephyr,memory-attr a capabilities bitmask 2023-09-15 12:46:54 +02:00
bluetooth drivers: bluetooth: hci: spi: add small read delay 2023-07-05 14:15:18 +02:00
can dts: bindings: can: add binding for ti,tcan4x5x 2023-09-11 19:55:44 +02:00
charger charger: Sample sbs charger driver with tests 2023-09-07 13:03:13 -04:00
clock driver: clock_control: npcx: add support for npcx4 series 2023-08-24 10:42:33 +01:00
coredump
counter drivers: counter: add snps apb timer 2023-08-16 10:20:31 +02:00
cpu dts/riscv: add missing riscv,isa fields and modify existing ones 2023-09-14 14:34:34 +02:00
crypto dts: nRF: Add missing headermask binding for NRF_CCM 2023-09-05 10:04:57 +02:00
dac drivers: dac: Add driver for mcux lpdac 2023-09-11 19:55:26 +02:00
dai
debug
dfpmcch
dfpmccu
disk
display drivers: display: ssd1306: determin sh1106 by dts compatibility 2023-09-13 14:23:24 -07:00
dma drivers: dma: add DMA driver for NXP PXP engine 2023-07-25 09:10:52 +02:00
dsa
edac
espi
ethernet ethernet: phy_mii: get the MDIO bus with DT_INST_BUS 2023-08-17 13:29:45 -05:00
flash_controller dts: bindings: flash-controller: Add smartbond QSPI parameters 2023-08-22 12:16:16 +02:00
fpga
fs
fuel-gauge drivers: fuelgauge: Add TI BQ27z746 driver 2023-09-13 12:05:04 +02:00
gpio drivers: gpio: Add Intel SEDI gpio driver 2023-09-12 10:56:08 +02:00
hda
hwinfo
hwspinlock drivers: hwspinlock: implement sqn hwspinlock driver 2023-08-16 20:46:55 +02:00
i2c dts: bindings: i2c: Add RasbperryPi Pico I2C 2023-09-11 11:10:12 +02:00
i2s
i3c
ieee802154
iio dts: bindings: afe: add current sense amplifier 2023-06-24 18:54:33 +02:00
input modules: lvgl: input: add zephyr,lvgl-encoder-input device binding 2023-09-13 11:35:04 +02:00
interrupt-controller drivers: interrupt-controller: Add VIM Interrupt Controller support 2023-09-04 10:53:09 +02:00
ipc ipc_service: open-amp: Align VRINGs 2023-07-18 11:04:46 +00:00
ipm drivers: ipm: add init version of sedi ipm driver 2023-09-08 14:43:17 +02:00
kscan input: remove cap1203 kscan-like state report 2023-07-25 11:25:51 +02:00
led drivers: led: Add Onsemi ncp5623c driver 2023-08-04 10:47:31 -05:00
led_strip
lora
mbox mbox: Add NXP MU as a MBOX device 2023-09-14 14:34:05 +02:00
mdio drivers: mdio: add adin2111 2023-05-26 09:50:09 -04:00
memory-controllers
memory-window
mfd mfd: Add NCT38xx multi-function driver 2023-09-11 11:00:47 +02:00
mhu
mipi-dsi drivers: mipi_dsi: dsi_mcux: make DPI mode optional 2023-07-25 09:08:59 +02:00
misc drivers: misc: add NXP S32 eMIOS driver 2023-09-06 11:44:00 +02:00
mm
mmc
mmu_mpu
modem drivers/modem: Add generic cellular modem driver 2023-08-30 13:48:51 +02:00
mtd drivers: mb85rc: support use of multiple modules as a single one 2023-08-30 17:38:21 +02:00
net/wireless
neural_net
options
ospi dts: bindings: ospi: add ospim io ports 2023-06-21 16:06:00 +02:00
pcie drivers: pcie: Enable filtering PCIe devices by class-rev 2023-05-14 18:17:33 -04:00
peci
phy
pinctrl drivers: pinctrl: Add more config options for Ambiq Apollo4 2023-08-25 10:31:58 +02:00
pm_cpu_ops drivers: pm_cpu_ops: Add support for multiple PSCI versions 2023-07-25 16:58:01 +00:00
power dts: bindings: Add new ambiq-pwrcfg binding 2023-08-04 10:48:58 +02:00
power-domain
ps2 drivers: ps2: microchip: Low power and wakeup enabled 2023-06-17 07:59:07 -04:00
pwm drivers: pwm: stm32: support capturing on four channels 2023-09-07 09:42:25 +02:00
qspi drivers: memc: add NXP S32 QSPI controller 2023-07-26 09:44:14 +02:00
regulator dts: regulator: Fix reoccurring typo in properties 2023-09-13 17:34:27 -04:00
reserved-memory
reset drivers: reset: Add reset controller for Intel Agilex5 platform 2023-07-25 16:58:01 +00:00
retained_mem
retention
riscv dts/bindings/riscv: don't enforce riscv,isa values with enum array 2023-09-14 14:34:34 +02:00
rng
rtc drivers: rtc: rtc_fake: fff rtc driver added 2023-08-24 22:06:51 +01:00
sd drivers: sdhc: allow bandwidth selection 2023-09-13 16:20:59 +02:00
sdhc driver: sdhc: added atmel SAM4E hsmci driver 2023-09-14 16:46:12 -05:00
sensor dts: sensor: bosch,bmi270: Move interrupt handling to parent binding 2023-09-13 16:26:24 +02:00
serial dts: bindings: Add new binding ambiq,uart 2023-08-04 10:48:58 +02:00
shi
sip_svc dts: arm64: intel: Change compat string for Intel Agilex SiP SMC driver. 2023-09-15 09:26:49 +02:00
smbus
sound
spi drivers: spi: Initial version of the Infineon CAT1 SPI driver 2023-09-12 10:55:01 +02:00
sram
syscon
tach
tcpc
test devicetree: Add 'zephyr,memory-attr' and DT helpers 2023-07-25 11:22:10 +02:00
timer drivers: counter: Add support for rpi_pico timer 2023-09-13 16:18:44 +02:00
timestamp
usb drivers: usb_dc_mcux: Add Pinctrl defines 2023-05-26 17:53:37 -04:00
usb-c USB-C: genVIF: Cleanup and add support to pick static data from input 2023-05-26 13:54:43 -04:00
video
virtualization drivers: virtualization: Add interface for ivshmem-v2 2023-05-14 18:17:33 -04:00
w1
watchdog drivers: watchdog: wdt_mcux_imx_wdog: add pinctrl support 2023-08-31 20:19:33 +02:00
wifi drivers: wifi: esp_at: handle external reset sources 2023-07-05 14:14:51 +02:00
xen dts: bindings: xen: add xen,xen.yaml file 2023-09-15 11:15:00 +01:00
vendor-prefixes.txt drivers: display: ssd1306: determin sh1106 by dts compatibility 2023-09-13 14:23:24 -07:00