Skip to content

Commit 1d8dc00

Browse files
icsys-omhcarlescufi
authored andcommitted
stm32f7, stm32h7: Avoid speculative reads from QSPI
As recommended in AN4760 the memory region where the QSPI flash can be memory mapped should be configured to be Strongly ordered memory. This works around an issue where a speculative read from the CPU may cause later problems with using the QSPI bus. This avoids #57466. Signed-off-by: Ole Morten Haaland <[email protected]>
1 parent 0b573a1 commit 1d8dc00

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

dts/arm/st/f7/stm32f7.dtsi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@
4343
};
4444
};
4545

46+
quadspi_memory: memory@90000000 {
47+
compatible = "zephyr,memory-region", "mmio-sram";
48+
reg = <0x90000000 DT_SIZE_M(256)>;
49+
zephyr,memory-region = "QSPI";
50+
zephyr,memory-region-mpu = "EXTMEM";
51+
};
52+
4653
clocks {
4754
clk_hse: clk-hse {
4855
#clock-cells = <0>;

dts/arm/st/h7/stm32h7.dtsi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
};
4545
};
4646

47+
quadspi_memory: memory@90000000 {
48+
compatible = "zephyr,memory-region", "mmio-sram";
49+
reg = <0x90000000 DT_SIZE_M(256)>;
50+
zephyr,memory-region = "QSPI";
51+
zephyr,memory-region-mpu = "EXTMEM";
52+
};
53+
4754
clocks {
4855
#address-cells = <1>;
4956
#size-cells = <0>;

dts/bindings/base/zephyr,memory-region.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ properties:
2525
- "FLASH"
2626
- "PPB"
2727
- "IO"
28+
- "EXTMEM"
2829
description: |
2930
Signify that this node should result in a dedicated MPU region. The
3031
region address and size are taken from the <reg> property, while the MPU

include/zephyr/arch/arm/aarch32/mpu/arm_mpu_v7m.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@
137137
#define REGION_PPB_ATTR(size) { (STRONGLY_ORDERED_SHAREABLE | size | \
138138
P_RW_U_NA_Msk) }
139139
#define REGION_IO_ATTR(size) { (DEVICE_NON_SHAREABLE | size | P_RW_U_NA_Msk) }
140+
#define REGION_EXTMEM_ATTR(size) { (STRONGLY_ORDERED_SHAREABLE | size | \
141+
NO_ACCESS_Msk) }
140142

141143
struct arm_mpu_region_attr {
142144
/* Attributes belonging to RASR (including the encoded region size) */

0 commit comments

Comments
 (0)