Skip to content

stm32 xspi bindings fixes dtc warnings #88646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions boards/st/nucleo_n657x0_q/nucleo_n657x0_q_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,10 @@ zephyr_udc0: &usbotg_hs1 {
<&rcc STM32_CLOCK(AHB5, 13)>;
status = "okay";

mx25um51245g: ospi-nor-flash@70000000 {
mx25um51245g: ospi-nor-flash@0 {
compatible = "st,stm32-xspi-nor";
reg = <0x70000000 DT_SIZE_M(64)>; /* 512 Mbits */
reg = <0>;
size = <DT_SIZE_M(512)>; /* 512 Mbits */
ospi-max-frequency = <DT_FREQ_M(200)>;
spi-bus-width = <XSPI_OCTO_MODE>;
data-rate = <XSPI_DTR_TRANSFER>;
Expand Down
5 changes: 3 additions & 2 deletions boards/st/stm32h573i_dk/stm32h573i_dk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@

status = "okay";

mx25lm51245: ospi-nor-flash@90000000 {
mx25lm51245: ospi-nor-flash@0 {
compatible = "st,stm32-xspi-nor";
reg = <0x90000000 DT_SIZE_M(64)>; /* 512 Mbits */
reg = <0>;
size = <DT_SIZE_M(512)>; /* 512 Mbits */
ospi-max-frequency = <DT_FREQ_M(50)>;
spi-bus-width = <XSPI_OCTO_MODE>;
data-rate = <XSPI_DTR_TRANSFER>;
Expand Down
10 changes: 6 additions & 4 deletions boards/st/stm32n6570_dk/stm32n6570_dk_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,10 @@ zephyr_udc0: &usbotg_hs1 {
<&rcc STM32_CLOCK(AHB5, 13)>;
status = "okay";

memc: aps256xxn_obr: memory@90000000 {
memc: aps256xxn_obr: memory@0 {
compatible = "st,stm32-xspi-psram";
reg = <0x90000000 DT_SIZE_M(32)>; /* 256 Mbits */
reg = <0>;
size = <DT_SIZE_M(256)>; /* 256 Mbits */
fixed-latency;
io-x16-mode;
read-latency = <4>;
Expand All @@ -273,9 +274,10 @@ zephyr_udc0: &usbotg_hs1 {
<&rcc STM32_CLOCK(AHB5, 13)>;
status = "okay";

mx66uw1g45g: ospi-nor-flash@70000000 {
mx66uw1g45g: ospi-nor-flash@0 {
compatible = "st,stm32-xspi-nor";
reg = <0x70000000 DT_SIZE_M(128)>; /* 1 Gbits */
reg = <0>;
size = <DT_SIZE_M(1024)>; /* 1Gbits */
ospi-max-frequency = <DT_FREQ_M(200)>;
spi-bus-width = <XSPI_OCTO_MODE>;
data-rate = <XSPI_DTR_TRANSFER>;
Expand Down
13 changes: 13 additions & 0 deletions doc/releases/migration-guide-4.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,19 @@ SPI
* Renamed the device tree property ``port_sel`` to ``port-sel``.
* Renamed the device tree property ``chip_select`` to ``chip-select``.

xSPI
====

* On STM32 devices, external memories device tree descriptions for size and address are now split
in two separate properties to comply with specification recommendations.

For instance, following external flash description ``reg = <0x70000000 DT_SIZE_M(64)>; /* 512 Mbits /``
is changed to ``reg = <0>;`` ``size = <DT_SIZE_M(512)>; / 512 Mbits */``.

Note that the property gives the actual size of the memory device in bits.
Previous mapping address information is now described in xspi node at SoC dtsi level.


Other subsystems
****************

Expand Down
6 changes: 3 additions & 3 deletions drivers/flash/flash_stm32_xspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ LOG_MODULE_REGISTER(flash_stm32_xspi, CONFIG_FLASH_LOG_LEVEL);
(_CONCAT(HAL_XSPIM_, DT_STRING_TOKEN(STM32_XSPI_NODE, prop))), \
((default_value)))

/* Get the base address of the flash from the DTS node */
#define STM32_XSPI_BASE_ADDRESS DT_INST_REG_ADDR(0)
/* Get the base address of the flash from the DTS st,stm32-xspi node */
#define STM32_XSPI_BASE_ADDRESS DT_REG_ADDR_BY_IDX(STM32_XSPI_NODE, 1)

#define STM32_XSPI_RESET_GPIO DT_INST_NODE_HAS_PROP(0, reset_gpios)

Expand Down Expand Up @@ -2413,7 +2413,7 @@ static const struct flash_stm32_xspi_config flash_stm32_xspi_cfg = {
.pclken = pclken,
.pclk_len = DT_NUM_CLOCKS(STM32_XSPI_NODE),
.irq_config = flash_stm32_xspi_irq_config_func,
.flash_size = DT_INST_REG_SIZE(0),
.flash_size = DT_INST_PROP(0, size) / 8, /* In Bytes */
.max_frequency = DT_INST_PROP(0, ospi_max_frequency),
.data_mode = DT_INST_PROP(0, spi_bus_width), /* SPI or OPI */
.data_rate = DT_INST_PROP(0, data_rate), /* DTR or STR */
Expand Down
2 changes: 1 addition & 1 deletion drivers/memc/memc_stm32_xspi_psram.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ static const struct memc_stm32_xspi_psram_config memc_stm32_xspi_cfg = {
.pclken_mgr = {.bus = DT_CLOCKS_CELL_BY_NAME(STM32_XSPI_NODE, xspi_mgr, bus),
.enr = DT_CLOCKS_CELL_BY_NAME(STM32_XSPI_NODE, xspi_mgr, bits)},
#endif
.memory_size = DT_INST_REG_ADDR_BY_IDX(0, 1),
.memory_size = DT_INST_PROP(0, size) / 8, /* In Bytes */
};

static struct memc_stm32_xspi_psram_data memc_stm32_xspi_data = {
Expand Down
4 changes: 2 additions & 2 deletions dts/arm/st/h5/stm32h562.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@

xspi1: spi@47001400 {
compatible = "st,stm32-xspi";
reg = <0x47001400 0x400>;
reg = <0x47001400 0x400>, <0x90000000 DT_SIZE_M(256)>;
interrupts = <78 0>;
clock-names = "xspix", "xspi-ker";
clocks = <&rcc STM32_CLOCK(AHB4, 20U)>,
<&rcc STM32_SRC_PLL1_Q OCTOSPI1_SEL(1)>;
#address-cells = <1>;
#size-cells = <1>;
#size-cells = <0>;
status = "disabled";
};

Expand Down
8 changes: 4 additions & 4 deletions dts/arm/st/n6/stm32n6.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -687,27 +687,27 @@

xspi1: xspi@58025000 {
compatible = "st,stm32-xspi";
reg = <0x58025000 0x1000>;
reg = <0x58025000 0x1000>, <0x90000000 DT_SIZE_M(256)>;
interrupts = <170 0>;
clock-names = "xspix", "xspi-ker", "xspi-mgr";
clocks = <&rcc STM32_CLOCK(AHB5, 5)>,
<&rcc STM32_SRC_HCLK5 XSPI1_SEL(0)>,
<&rcc STM32_CLOCK(AHB5, 13)>;
#address-cells = <1>;
#size-cells = <1>;
#size-cells = <0>;
status = "disabled";
};

xspi2: spi@5802a000 {
compatible = "st,stm32-xspi";
reg = <0x5802A000 0x1000>;
reg = <0x5802A000 0x1000>, <0x70000000 DT_SIZE_M(256)>;
interrupts = <171 0>;
clock-names = "xspix", "xspi-ker", "xspi-mgr";
clocks = <&rcc STM32_CLOCK(AHB5, 12)>,
<&rcc STM32_SRC_HCLK5 XSPI2_SEL(0)>,
<&rcc STM32_CLOCK(AHB5, 13)>;
#address-cells = <1>;
#size-cells = <1>;
#size-cells = <0>;
status = "disabled";
};

Expand Down
3 changes: 3 additions & 0 deletions dts/bindings/flash_controller/st,stm32-xspi-nor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ include:
- spi-bus-width
- data-rate
properties:
size:
required: true
description: Flash Memory size in bits
spi-bus-width:
type: int
required: true
Expand Down
5 changes: 5 additions & 0 deletions dts/bindings/memory-controllers/st,stm32-xspi-psram.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ properties:
reg:
required: true

size:
type: int
required: true
description: Flash Memory size in bits

fixed-latency:
type: boolean
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
/* On stm32 XSPI, external flash is mapped in XIP region at address given by the reg property. */

#define EXTFLASH_NODE DT_INST(0, st_stm32_xspi_nor)
#define EXTFLASH_ADDR DT_REG_ADDR(DT_INST(0, st_stm32_xspi_nor))
#define EXTFLASH_SIZE DT_REG_SIZE(DT_INST(0, st_stm32_xspi_nor))
#define EXTFLASH_ADDR DT_REG_ADDR_BY_IDX(DT_PARENT(EXTFLASH_NODE), 1)
#define EXTFLASH_SIZE DT_PROP(EXTFLASH_NODE, size) / 8

#elif defined(CONFIG_FLASH_MSPI_NOR) && defined(CONFIG_SOC_NRF54H20_CPUAPP)

Expand Down