Skip to content

Commit 15e84cb

Browse files
carlocaionecarlescufi
authored andcommitted
dts: Move to 'zephyr,memory-attr'
Move to 'zephyr,memory-attr' and use the newly introduced helpers. Signed-off-by: Carlo Caione <[email protected]>
1 parent 7483e43 commit 15e84cb

File tree

36 files changed

+55
-186
lines changed

36 files changed

+55
-186
lines changed

boards/arm/arduino_giga_r1/arduino_giga_r1_m7.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
device_type = "memory";
3030
reg = <0xc0000000 DT_SIZE_M(8)>;
3131
zephyr,memory-region = "SDRAM1";
32-
zephyr,memory-region-mpu = "RAM";
32+
zephyr,memory-attr = "RAM";
3333
};
3434

3535
aliases {

boards/arm/stm32f746g_disco/stm32f746g_disco.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
device_type = "memory";
4646
reg = <0xc0000000 DT_SIZE_M(16)>;
4747
zephyr,memory-region = "SDRAM1";
48-
zephyr,memory-region-mpu = "RAM";
48+
zephyr,memory-attr = "RAM";
4949
};
5050

5151
aliases {

boards/arm/stm32f7508_dk/stm32f7508_dk.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
device_type = "memory";
4747
reg = <0xc0000000 DT_SIZE_M(16)>;
4848
zephyr,memory-region = "SDRAM1";
49-
zephyr,memory-region-mpu = "RAM";
49+
zephyr,memory-attr = "RAM";
5050
};
5151

5252
aliases {

boards/arm/stm32f769i_disco/stm32f769i_disco.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
device_type = "memory";
2929
reg = <0xc0000000 DT_SIZE_M(16)>;
3030
zephyr,memory-region = "SDRAM1";
31-
zephyr,memory-region-mpu = "RAM";
31+
zephyr,memory-attr = "RAM";
3232
};
3333

3434
leds {

boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
device_type = "memory";
2828
reg = <0xd0000000 DT_SIZE_M(32)>;
2929
zephyr,memory-region = "SDRAM2";
30-
zephyr,memory-region-mpu = "RAM";
30+
zephyr,memory-attr = "RAM";
3131
};
3232

3333
leds {

boards/arm/stm32h7b3i_dk/stm32h7b3i_dk.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
device_type = "memory";
4949
reg = <0xd0000000 DT_SIZE_M(16)>;
5050
zephyr,memory-region = "SDRAM2";
51-
zephyr,memory-region-mpu = "RAM";
51+
zephyr,memory-attr = "RAM";
5252
};
5353

5454
transceiver0: can-phy0 {

boards/arm64/fvp_baser_aemv8r/fvp_baser_aemv8r.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
compatible = "zephyr,memory-region", "mmio-dram";
4242
reg = <0x80000000 DT_SIZE_M(2048)>;
4343
zephyr,memory-region = "DEVICE_REGION";
44-
zephyr,memory-region-mpu = "IO";
44+
zephyr,memory-attr = "IO";
4545
};
4646
};
4747
};

doc/hardware/arch/arm_cortex_m.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,8 @@ are programmed during system boot.
440440
SRAM. (An exception to this setting is when :kconfig:option:`CONFIG_MPU_GAP_FILLING` is disabled (Arm v8-M only);
441441
in that case no SRAM MPU programming is done so the access is determined by the default
442442
Arm memory map policies, allowing for privileged-only RWX permissions on SRAM).
443-
* All the memory regions defined in the devicetree with the compatible
444-
:dtcompatible:`zephyr,memory-region` and at least the property
445-
``zephyr,memory-region-mpu`` defining the MPU permissions for the memory region.
443+
* All the memory regions defined in the devicetree with the property
444+
``zephyr,memory-attr`` defining the MPU permissions for the memory region.
446445
See the next section for more details.
447446

448447
The above MPU regions are defined in :file:`soc/arm/common/cortex_m/arm_mpu_regions.c`.
@@ -453,13 +452,12 @@ configure its own fixed MPU regions in the SoC definition.
453452
Fixed MPU regions defined in devicetree
454453
---------------------------------------
455454

456-
The user can define memory regions to be allocated and created in the linker
457-
script using nodes with the :dtcompatible:`zephyr,memory-region` devicetree
458-
compatible. When the property ``zephyr,memory-region-mpu`` is present in such
459-
a node, a new MPU region will be allocated and programmed during system
460-
boot.
455+
When the property ``zephyr,memory-attr`` is present in a memory node, a new MPU
456+
region will be allocated and programmed during system boot. When used with the
457+
:dtcompatible:`zephyr,memory-region` devicetree compatible, it will result in a
458+
linker section being generated associated to that MPU region.
461459

462-
The property ``zephyr,memory-region-mpu`` is a string carrying the attributes
460+
The property ``zephyr,memory-attr`` is a string carrying the attributes
463461
for the MPU region. It is converted to a C token for use defining the attributes
464462
of the MPU region.
465463

@@ -471,7 +469,7 @@ For example, to define a new non-cacheable memory region in devicetree:
471469
compatible = "zephyr,memory-region", "mmio-sram";
472470
reg = <0x20300000 0x100000>;
473471
zephyr,memory-region = "SRAM_NO_CACHE";
474-
zephyr,memory-region-mpu = "RAM_NOCACHE";
472+
zephyr,memory-attr = "RAM_NOCACHE";
475473
};
476474
477475
This will automatically create a new MPU entry in

drivers/adc/adc_stm32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,20 +251,20 @@ static int adc_stm32_dma_start(const struct device *dev,
251251
* The entire buffer must be in a single region.
252252
* An example of how the SRAM region can be defined in the DTS:
253253
* &sram4 {
254-
* zephyr,memory-region-mpu = "RAM_NOCACHE";
254+
* zephyr,memory-attr = "RAM_NOCACHE";
255255
* };
256256
*/
257257
static bool address_in_non_cacheable_sram(const uint16_t *buffer, const uint16_t size)
258258
{
259259
/* Default if no valid SRAM region found or buffer+size not located in a single region */
260260
bool cachable = false;
261261
#define IS_NON_CACHEABLE_REGION_FN(node_id) \
262-
COND_CODE_1(DT_NODE_HAS_PROP(node_id, zephyr_memory_region_mpu), ({ \
262+
COND_CODE_1(DT_NODE_HAS_PROP(node_id, zephyr_memory_attr), ({ \
263263
const uint32_t region_start = DT_REG_ADDR(node_id); \
264264
const uint32_t region_end = region_start + DT_REG_SIZE(node_id); \
265265
if (((uint32_t)buffer >= region_start) && \
266266
(((uint32_t)buffer + size) < region_end)) { \
267-
cachable = strcmp(DT_PROP(node_id, zephyr_memory_region_mpu), \
267+
cachable = strcmp(DT_PROP(node_id, zephyr_memory_attr), \
268268
"RAM_NOCACHE") == 0; \
269269
} \
270270
}), \

drivers/dma/dma_stm32_bdma.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,11 @@ static int bdma_stm32_init(const struct device *dev)
809809
* This check verifies that the non-cachable flag is set in the DTS.
810810
* For example:
811811
* &sram4 {
812-
* zephyr,memory-region-mpu = "RAM_NOCACHE";
812+
* zephyr,memory-attr = "RAM_NOCACHE";
813813
* };
814814
*/
815-
#if DT_NODE_HAS_PROP(DT_NODELABEL(sram4), zephyr_memory_region_mpu)
816-
if (strcmp(DT_PROP(DT_NODELABEL(sram4), zephyr_memory_region_mpu), "RAM_NOCACHE") != 0) {
815+
#if DT_NODE_HAS_PROP(DT_NODELABEL(sram4), zephyr_memory_attr)
816+
if (strcmp(DT_PROP(DT_NODELABEL(sram4), zephyr_memory_attr), "RAM_NOCACHE") != 0) {
817817
LOG_ERR("SRAM4 is not set as non-cachable.");
818818
return -EIO;
819819
}

0 commit comments

Comments
 (0)