Skip to content

Commit 253f367

Browse files
committed
dts: Add MSPI configuration for STM32
This commit adds the main DTS configurations required to enable MSPI/OSPI/QSPI support on STM32. Signed-off-by: Sara Touqan <[email protected]> Signed-off-by: Sarah Younis <[email protected]> Signed-off-by: Mohammad Odeh <[email protected]>
1 parent 7fc8051 commit 253f367

File tree

3 files changed

+377
-0
lines changed

3 files changed

+377
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Copyright (c) 2025 EXALT Technologies.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: |
5+
STM32 MSPI controller representation. Enabling a stm32 mspi node in a board
6+
description would typically requires this: (pinning depends on the stm32 mcu)
7+
8+
&mspi {
9+
pinctrl-0 = <&octospi_clk_pe9 &octospi_ncs_pe10 &octospi_dqs_pe11
10+
&octospi_io0_pe12 &octospi_io1_pe13
11+
&octospi_io2_pe14 &octospi_io3_pe15
12+
&octospi_io4_pe16 &octospi_io5_pe17
13+
&octospi_io6_pe18 &octospi_io7_pe19>;
14+
15+
dmas = <&dma1 5 41 0x10000>;
16+
dma-names = "tx_rx";
17+
18+
status = "okay";
19+
};
20+
21+
compatible: "st,stm32-mspi-controller"
22+
23+
include: [base.yaml, pinctrl-device.yaml, mspi-controller.yaml]
24+
25+
bus: mspi
26+
27+
properties:
28+
reg:
29+
required: true
30+
31+
interrupts:
32+
required: true
33+
34+
pinctrl-0:
35+
required: true
36+
37+
pinctrl-names:
38+
required: true
39+
40+
clock-names:
41+
required: true
42+
43+
dmas:
44+
description: |
45+
Optional DMA channel specifier, required for DMA transactions.
46+
For example dmas for TX/RX on MSPI
47+
dmas = <&dma1 5 41 0x10000>;
48+
49+
With, in each cell of the dmas specifier:
50+
- &dma1: dma controller phandle
51+
- 5: channel number (0 to Max-Channel minus 1). From 0 to 15 on stm32u5x.
52+
- 41: slot number (request which could be given by the DMAMUX)
53+
- 0x10000: channel configuration (only for srce/dest data size, priority)
54+
55+
Notes:
56+
- On series supporting DMAMUX, the DMA phandle should be provided
57+
but DMAMUX node should also be enabled in the DTS.
58+
- For channel configuration, only the config bits priority and
59+
periph/mem datasize are used. The periph/mem datasize must be equal,
60+
0 is a correct value.
61+
- There is no Fifo used by this DMA peripheral.
62+
63+
For example dmas for TX/RX on MSPI
64+
dmas = <&dma1 5 41 0x10000>;
65+
66+
dma-names:
67+
description: |
68+
DMA channel name. If DMA should be used, expected value is "tx_rx".
69+
70+
For example
71+
dma-names = "tx_rx";
72+
73+
ssht-enable:
74+
type: boolean
75+
description: |
76+
Enables Sample Shifting half-cycle.
77+
78+
It is recommended to be enabled in STR mode and disabled in DTR mode.
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Copyright (c) 2024 STMicroelectronics
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: |
5+
STM32 MSPI controller representation. Enabling a stm32 mspi node in a board
6+
description would typically requires this: (pinning depends on the stm32 mcu)
7+
8+
&ospi {
9+
pinctrl-0 = <&octospi_clk_pe9 &octospi_ncs_pe10 &octospi_dqs_pe11
10+
&octospi_io0_pe12 &octospi_io1_pe13
11+
&octospi_io2_pe14 &octospi_io3_pe15
12+
&octospi_io4_pe16 &octospi_io5_pe17
13+
&octospi_io6_pe18 &octospi_io7_pe19>;
14+
15+
dmas = <&dma1 5 41 0x10000>;
16+
dma-names = "tx_rx";
17+
18+
status = "okay";
19+
};
20+
21+
compatible: "st,stm32-ospi-controller"
22+
23+
include: [base.yaml, pinctrl-device.yaml, mspi-controller.yaml]
24+
25+
bus: mspi
26+
27+
properties:
28+
reg:
29+
required: true
30+
31+
interrupts:
32+
required: true
33+
34+
pinctrl-0:
35+
required: true
36+
37+
pinctrl-names:
38+
required: true
39+
40+
clock-names:
41+
required: true
42+
43+
dmas:
44+
description: |
45+
Optional DMA channel specifier, required for DMA transactions.
46+
For example dmas for TX/RX on MSPI
47+
dmas = <&dma1 5 41 0x10000>;
48+
49+
With, in each cell of the dmas specifier:
50+
- &dma1: dma controller phandle
51+
- 5: channel number (0 to Max-Channel minus 1). From 0 to 15 on stm32u5x.
52+
- 41: slot number (request which could be given by the DMAMUX)
53+
- 0x10000: channel configuration (only for srce/dest data size, priority)
54+
55+
Notes:
56+
- On series supporting DMAMUX, the DMA phandle should be provided
57+
but DMAMUX node should also be enabled in the DTS.
58+
- For channel configuration, only the config bits priority and
59+
periph/mem datasize are used. The periph/mem datasize must be equal,
60+
0 is a correct value.
61+
- There is no Fifo used by this DMA peripheral.
62+
63+
For example dmas for TX/RX on MSPI
64+
dmas = <&dma1 5 41 0x10000>;
65+
66+
dma-names:
67+
description: |
68+
DMA channel name. If DMA should be used, expected value is "tx_rx".
69+
70+
For example
71+
dma-names = "tx_rx";
72+
73+
dlyb-bypass:
74+
type: boolean
75+
description: |
76+
Enables Delay Block (DLYB) Bypass.
77+
78+
ssht-enable:
79+
type: boolean
80+
description: |
81+
Enables Sample Shifting half-cycle.
82+
83+
It is recommended to be enabled in STR mode and disabled in DTR mode.
84+
85+
io-low-port:
86+
type: string
87+
enum:
88+
- "IOPORT_NONE"
89+
- "IOPORT_1_LOW"
90+
- "IOPORT_1_HIGH"
91+
- "IOPORT_2_LOW"
92+
- "IOPORT_2_HIGH"
93+
description: |
94+
Specifies which port of the OCTOSPI IO Manager is used for the IO[3:0] pins.
95+
96+
If absent, then `IOPORT_<n>_LOW` is used where `n` is the OSPI
97+
instance number.
98+
99+
Note: You might need to enable the OCTOSPI I/O manager clock to use the
100+
property. Please refer to Reference Manual.
101+
The clock can be enabled in the devicetree.
102+
103+
io-high-port:
104+
type: string
105+
enum:
106+
- "IOPORT_NONE"
107+
- "IOPORT_1_LOW"
108+
- "IOPORT_1_HIGH"
109+
- "IOPORT_2_LOW"
110+
- "IOPORT_2_HIGH"
111+
description: |
112+
Specifies which port of the OCTOSPI IO Manager is used for the IO[7:4] pins.
113+
114+
If absent, then `IOPORT_<n>_HIGH` is used where `n` is the OSPI
115+
instance number.
116+
117+
Can be set to `IOPORT_NONE` for Single SPI, Dual SPI and Quad SPI.
118+
119+
Note: You might need to enable the OCTOSPI I/O manager clock to use the
120+
property. Please refer to Reference Manual.
121+
The clock can be enabled in the devicetree.
122+
123+
clk-port:
124+
type: int
125+
enum:
126+
- 1
127+
- 2
128+
description: |
129+
Specifies which port of the OCTOSPI IO Manager is used for the clk pin.
130+
131+
If absent, then n is used where `n` is the OSPI
132+
instance number.
133+
134+
Note: You might need to enable the OCTOSPI I/O manager clock to use the
135+
property. Please refer to Reference Manual.
136+
The clock can be enabled in the devicetree.
137+
138+
dqs-port:
139+
type: int
140+
enum:
141+
- 1
142+
- 2
143+
description: |
144+
Specifies which port of the OCTOSPI IO Manager is used for the dqs pin.
145+
146+
If absent, then n is used where `n` is the OSPI
147+
instance number.
148+
149+
Note: You might need to enable the OCTOSPI I/O manager clock to use the
150+
property. Please refer to Reference Manual.
151+
The clock can be enabled in the devicetree.
152+
153+
ncs-port:
154+
type: int
155+
enum:
156+
- 1
157+
- 2
158+
description: |
159+
Specifies which port of the OCTOSPI IO Manager is used for the ncs pin.
160+
161+
If absent, then n is used where `n` is the OSPI
162+
instance number.
163+
164+
Note: You might need to enable the OCTOSPI I/O manager clock to use the
165+
property. Please refer to Reference Manual.
166+
The clock can be enabled in the devicetree.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Copyright (c) 2025 EXALT Technologies.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: |
5+
STM32 QSPI controller representation for MSPI interface. Enabling a stm32 qspi node
6+
in a board description would typically require this: (pinning depends on the stm32 mcu)
7+
8+
&qspi {
9+
pinctrl-0 = <&quadspi_clk_pe10 &quadspi_ncs_pe11
10+
&quadspi_io0_pe12 &quadspi_io1_pe13
11+
&quadspi_io2_pe14 &quadspi_io3_pe15>;
12+
13+
dmas = <&dma1 5 41 0x10000>;
14+
dma-names = "tx_rx";
15+
16+
status = "okay";
17+
};
18+
19+
compatible: "st,stm32-qspi-controller"
20+
21+
include: [base.yaml, pinctrl-device.yaml, mspi-controller.yaml]
22+
23+
bus: mspi
24+
25+
properties:
26+
reg:
27+
required: true
28+
29+
interrupts:
30+
required: true
31+
32+
pinctrl-0:
33+
required: true
34+
35+
pinctrl-names:
36+
required: true
37+
38+
clock-names:
39+
required: true
40+
41+
dmas:
42+
description: |
43+
Optional DMA channel specifier, required for DMA transactions.
44+
For example dmas for TX/RX on QSPI
45+
dmas = <&dma1 5 41 0x10000>;
46+
47+
With, in each cell of the dmas specifier:
48+
- &dma1: dma controller phandle
49+
- 5: channel number (0 to Max-Channel minus 1). From 0 to 15 on stm32u5x.
50+
- 41: slot number (request which could be given by the DMAMUX)
51+
- 0x10000: channel configuration (only for src/dest data size, priority)
52+
53+
Notes:
54+
- On series supporting DMAMUX, the DMA phandle should be provided
55+
but DMAMUX node should also be enabled in the DTS.
56+
- For channel configuration, only the config bits priority and
57+
periph/mem datasize are used. The periph/mem datasize must be equal,
58+
0 is a correct value.
59+
- There is no Fifo used by this DMA peripheral.
60+
61+
For example dmas for TX/RX on QSPI
62+
dmas = <&dma1 5 41 0x10000>;
63+
64+
dma-names:
65+
description: |
66+
DMA channel name. If DMA should be used, expected value is "tx_rx".
67+
68+
For example
69+
dma-names = "tx_rx";
70+
71+
ssht-enable:
72+
type: boolean
73+
description: |
74+
Enables Sample Shifting half-cycle.
75+
76+
It is recommended to be enabled in STR mode and disabled in DTR mode.
77+
Note: DTR support is limited on QSPI compared to OCTOSPI/XSPI.
78+
79+
flash-id:
80+
type: int
81+
enum:
82+
- 1
83+
- 2
84+
description: |
85+
Specifies which flash device is selected (for dual flash configurations).
86+
87+
If absent, then flash 1 is used.
88+
89+
dual-flash:
90+
type: boolean
91+
description: |
92+
Enables dual flash mode where two identical flash devices are connected
93+
to provide doubled capacity and/or performance.
94+
95+
Note: This is only supported on certain STM32 QSPI implementations.
96+
97+
fifo-threshold:
98+
type: int
99+
description: |
100+
FIFO threshold for QSPI operations. This determines when the FIFO
101+
threshold flag is set during indirect read/write operations.
102+
103+
Valid range is typically 1-32 bytes depending on QSPI implementation.
104+
Default is 4 bytes if not specified.
105+
106+
chip-select-high-time:
107+
type: int
108+
enum:
109+
- 1
110+
- 2
111+
- 3
112+
- 4
113+
- 5
114+
- 6
115+
- 7
116+
- 8
117+
description: |
118+
Specifies the minimum number of clock cycles that the chip select (nCS)
119+
must remain high between commands.
120+
121+
Default is 1 cycle if not specified.
122+
123+
clock-mode:
124+
type: int
125+
enum:
126+
- 0
127+
- 3
128+
description: |
129+
Specifies the clock mode (CPOL/CPHA combination):
130+
- 0: Clock stays low when nCS is released (CPOL=0, CPHA=0)
131+
- 3: Clock goes high when nCS is released (CPOL=1, CPHA=1)
132+
133+
Default is mode 0 if not specified.

0 commit comments

Comments
 (0)