Skip to content

Commit 6fecc43

Browse files
mariopajamariopaja-zal
authored andcommitted
drivers: memc: add driver for stm32 ospi psram
Add a driver for STM32 OSPI PSRAM in memory mapped mode. Enable OSPI PSRAM on b_u585i_iot02a. Signed-off-by: Mario Paja <[email protected]>
1 parent c7e6034 commit 6fecc43

File tree

8 files changed

+685
-0
lines changed

8 files changed

+685
-0
lines changed

boards/st/b_u585i_iot02a/b_u585i_iot02a-common.dtsi

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) 2021 Linaro Limited
33
* Copyright (c) 2024 STMicroelectronics
4+
* Copyright (c) 2025 ZAL Zentrum für Angewandte Luftfahrtforschung GmbH
45
*
56
* SPDX-License-Identifier: Apache-2.0
67
*/
@@ -9,6 +10,7 @@
910
#include <st/u5/stm32u585aiixq-pinctrl.dtsi>
1011
#include "arduino_r3_connector.dtsi"
1112
#include <zephyr/dt-bindings/input/input-event-codes.h>
13+
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
1214

1315
/ {
1416
leds {
@@ -43,6 +45,13 @@
4345
volt-sensor1 = &vbat4;
4446
eeprom-0 = &eeprom0;
4547
};
48+
49+
psram: memory@90000000 {
50+
compatible = "zephyr,memory-region";
51+
reg = <0x90000000 DT_SIZE_M(8)>;
52+
zephyr,memory-region = "PSRAM";
53+
zephyr,memory-attr = <(DT_MEM_ARM(ATTR_MPU_RAM))>;
54+
};
4655
};
4756

4857
&clk_hsi48 {
@@ -126,6 +135,27 @@ stm32_lp_tick_source: &lptim1 {
126135
};
127136
};
128137

138+
&octospi1 {
139+
pinctrl-0 = <&octospim_p1_clk_pb10 &octospim_p1_ncs_pb11
140+
&octospim_p1_io0_pf8 &octospim_p1_io1_pf9
141+
&octospim_p1_io2_pf7 &octospim_p1_io3_pf6
142+
&octospim_p1_io4_ph2 &octospim_p1_io5_pi0
143+
&octospim_p1_io6_pc3 &octospim_p1_io7_pd7
144+
&octospim_p1_dqs_pe3>;
145+
pinctrl-names = "default";
146+
status = "okay";
147+
148+
memc: aps6408l: memory@0 {
149+
compatible = "st,stm32-ospi-psram";
150+
reg = <0>;
151+
size = <DT_SIZE_M(64)>; /* 64 Mbits */
152+
max-frequency = <DT_FREQ_M(133)>;
153+
fixed-latency;
154+
burst-length = <3>;
155+
status = "okay";
156+
};
157+
};
158+
129159
&octospi2 {
130160
pinctrl-0 = <&octospim_p2_clk_pf4 &octospim_p2_ncs_pi5
131161
&octospim_p2_io0_pf0 &octospim_p2_io1_pf1

drivers/memc/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ zephyr_linker_sources_ifdef(CONFIG_MEMC_STM32_SDRAM SECTIONS memc_stm32_sdra
3030

3131
zephyr_library_sources_ifdef(CONFIG_MEMC_STM32_XSPI_PSRAM memc_stm32_xspi_psram.c)
3232
zephyr_linker_sources_ifdef(CONFIG_MEMC_STM32_XSPI_PSRAM SECTIONS memc_stm32_xspi_psram.ld)
33+
zephyr_library_sources_ifdef(CONFIG_MEMC_STM32_OSPI_PSRAM memc_stm32_ospi_psram.c)
34+
zephyr_linker_sources_ifdef(CONFIG_MEMC_STM32_OSPI_PSRAM SECTIONS memc_stm32_ospi_psram.ld)

drivers/memc/Kconfig.stm32

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2020 Teslabs Engineering S.L.
2+
# Copyright (c) 2025 ZAL Zentrum für Angewandte Luftfahrtforschung GmbH
23
# SPDX-License-Identifier: Apache-2.0
34

45
config MEMC_STM32
@@ -40,3 +41,15 @@ config MEMC_STM32_XSPI_PSRAM
4041
select PINCTRL
4142
help
4243
Enable STM32 XSPI Memory Controller.
44+
45+
config MEMC_STM32_OSPI_PSRAM
46+
bool "STM32 OSPI PSRAM"
47+
default y
48+
depends on DT_HAS_ST_STM32_OSPI_PSRAM_ENABLED
49+
select USE_STM32_HAL_OSPI
50+
select USE_STM32_LL_DLYB
51+
select USE_STM32_HAL_DMA_EX
52+
select USE_STM32_HAL_DMA
53+
select PINCTRL
54+
help
55+
Enable STM32 OSPI PSRAM Controller driver.

0 commit comments

Comments
 (0)