Skip to content

Commit febd0cf

Browse files
committed
doc: nrf: drivers: Add documentation for sQSPI MSPI shim driver
Add a few words about the purpose of the driver and how to configure it, along with examples of dts overlays for supported SoCs. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 75a08d3 commit febd0cf

File tree

3 files changed

+184
-1
lines changed

3 files changed

+184
-1
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
/doc/nrf/drivers/suit_flash_ipuc.rst @nrfconnect/ncs-charon-doc
102102
/doc/nrf/drivers/images/flash_ipuc/* @nrfconnect/ncs-charon-doc
103103
/doc/nrf/drivers/hw_cc3xx.rst @nrfconnect/ncs-aegir-doc
104+
/doc/nrf/drivers/mspi_sqspi.rst @annwoj
104105
/doc/nrf/drivers/paw3212.rst @nrfconnect/ncs-si-bluebagel-doc
105106
/doc/nrf/drivers/pmw3360.rst @nrfconnect/ncs-si-bluebagel-doc
106107
/doc/nrf/drivers/sensor_sim.rst @nrfconnect/ncs-cia-doc

doc/nrf/drivers/mspi_sqspi.rst

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
.. _mspi_sqspi:
2+
3+
sQSPI MSPI shim driver
4+
######################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
This driver integrates the :ref:`sQSPI` soft peripheral with the Zephyr MSPI API, enabling control over the peripheral.
11+
This allows for communication with devices that use MSPI bus-based Zephyr drivers, such as flash chips or displays.
12+
13+
Configuration
14+
*************
15+
16+
To configure the sQSPI MSPI shim driver with the devicetree, complete the following steps:
17+
18+
1. Specify the base address of the sQSPI registers in RAM by creating the :dtcompatible:`nordic,nrf-sqspi` node within the RAM region reserved for the soft peripheral.
19+
#. Specify an interrupt for communication between the application and FLPR cores, and determine the pins for sQSPI operation.
20+
Provide this information in the properties of the node labeled as ``cpuflpr_vpr``.
21+
#. If the ``execution-memory`` property exists in the ``cpuflpr_vpr`` node, delete it to ensure the FLPR core does not use the Nordic VPR coprocessor launcher (see the :kconfig:option:`CONFIG_NORDIC_VPR_LAUNCHER` Kconfig option).
22+
23+
For RAM configuration details on supported SoCs, refer to the following guides:
24+
25+
* :ref:`nRF54L15 RAM configuration <nrf54L15_porting_guide_ram_configuration>`
26+
* :ref:`nRF54H20 RAM configuration <nrf54H20_porting_guide_ram_configuration>` - On the nRF54H20 SoC, ensure the RAM region reserved for the sQSPI is labeled ``softperiph_ram`` to set it as non-cacheable in the MPU configuration.
27+
28+
See the following configuration example for the nRF54L15 SoC:
29+
30+
.. code-block:: devicetree
31+
32+
&pinctrl {
33+
sqspi_default: sqspi_default {
34+
group1 {
35+
psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
36+
<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
37+
<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>;
38+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
39+
};
40+
group2 {
41+
psels = <NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
42+
<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
43+
<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
44+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
45+
bias-pull-up;
46+
};
47+
};
48+
49+
sqspi_sleep: sqspi_sleep {
50+
group1 {
51+
low-power-enable;
52+
psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
53+
<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
54+
<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>,
55+
<NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
56+
<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
57+
<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
58+
};
59+
};
60+
};
61+
62+
&cpuflpr_vpr {
63+
pinctrl-0 = <&sqspi_default>;
64+
pinctrl-1 = <&sqspi_sleep>;
65+
pinctrl-names = "default", "sleep";
66+
interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>;
67+
status = "okay";
68+
};
69+
70+
/ {
71+
reserved-memory {
72+
#address-cells = <1>;
73+
#size-cells = <1>;
74+
ranges;
75+
76+
softperiph_ram: memory@2003c000 {
77+
reg = <0x2003c000 0x4000>;
78+
ranges = <0 0x2003c000 0x4000>;
79+
#address-cells = <1>;
80+
#size-cells = <1>;
81+
82+
sqspi: sqspi@3c00 {
83+
compatible = "nordic,nrf-sqspi";
84+
#address-cells = <1>;
85+
#size-cells = <0>;
86+
reg = <0x3c00 0x200>;
87+
status = "okay";
88+
zephyr,pm-device-runtime-auto;
89+
};
90+
};
91+
};
92+
};
93+
94+
For the nRF54H20 SoC, you must also reserve a RAM region for data buffers used in sQSPI transfers, accessible by the FLPR core.
95+
Indicate this region to the shim driver using the ``memory-regions`` property in the sQSPI node.
96+
If you initiate an MSPI transfer with a buffer outside this region, the shim driver will temporarily allocate a buffer within the region and correctly transfer data between the two buffers - before transmitting (TX) or after receiving (RX).
97+
To avoid overhead from automatic allocation and copying, allocate buffers statically using :c:macro:`DMM_MEMORY_SECTION`.
98+
The shim driver will then directly pass these buffers to the sQSPI.
99+
100+
The following example configuration for the nRF54H20 SoC sets up the necessary parameters:
101+
102+
.. code-block:: devicetree
103+
104+
&pinctrl {
105+
sqspi_default: sqspi_default {
106+
group1 {
107+
psels = <NRF_PSEL(SDP_MSPI_SCK, 7, 0)>,
108+
<NRF_PSEL(SDP_MSPI_CS0, 7, 5)>,
109+
<NRF_PSEL(SDP_MSPI_DQ0, 7, 1)>;
110+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
111+
};
112+
group2 {
113+
psels = <NRF_PSEL(SDP_MSPI_DQ1, 7, 2)>,
114+
<NRF_PSEL(SDP_MSPI_DQ2, 7, 3)>,
115+
<NRF_PSEL(SDP_MSPI_DQ3, 7, 4)>;
116+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
117+
bias-pull-up;
118+
};
119+
};
120+
121+
sqspi_sleep: sqspi_sleep {
122+
group1 {
123+
low-power-enable;
124+
psels = <NRF_PSEL(SDP_MSPI_SCK, 7, 0)>,
125+
<NRF_PSEL(SDP_MSPI_CS0, 7, 5)>,
126+
<NRF_PSEL(SDP_MSPI_DQ0, 7, 1)>,
127+
<NRF_PSEL(SDP_MSPI_DQ1, 7, 2)>,
128+
<NRF_PSEL(SDP_MSPI_DQ2, 7, 3)>,
129+
<NRF_PSEL(SDP_MSPI_DQ3, 7, 4)>;
130+
};
131+
};
132+
};
133+
134+
&cpuflpr_vpr {
135+
pinctrl-0 = <&sqspi_default>;
136+
pinctrl-1 = <&sqspi_sleep>;
137+
pinctrl-names = "default", "sleep";
138+
interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>;
139+
status = "okay";
140+
/delete-property/ execution-memory;
141+
};
142+
143+
/delete-node/ &cpuflpr_code_data;
144+
/delete-node/ &cpuapp_cpuflpr_ipc_shm;
145+
/delete-node/ &cpuflpr_cpuapp_ipc_shm;
146+
/delete-node/ &cpuapp_cpuflpr_ipc;
147+
148+
&ram21_region {
149+
status = "okay";
150+
151+
softperiph_ram: memory@0 {
152+
reg = <0 0x4000>;
153+
ranges;
154+
#address-cells = <1>;
155+
#size-cells = <1>;
156+
157+
sqspi: sqspi@3e00 {
158+
compatible = "nordic,nrf-sqspi";
159+
#address-cells = <1>;
160+
#size-cells = <0>;
161+
reg = <0x3e00 0x200>;
162+
zephyr,pm-device-runtime-auto;
163+
memory-regions = <&sqspi_buffers>;
164+
};
165+
};
166+
167+
sqspi_buffers: memory@4000 {
168+
compatible = "zephyr,memory-region";
169+
reg = <0x4000 0x4000>;
170+
#memory-region-cells = <0>;
171+
zephyr,memory-region = "SQSPI_BUFFERS";
172+
zephyr,memory-attr = <DT_MEM_CACHEABLE>;
173+
};
174+
};
175+
176+
API documentation
177+
*****************
178+
179+
| Header file: :file:`include/zephyr/drivers/mspi.h`
180+
| Source file: :file:`drivers/mspi/mspi_sqspi.c`
181+
182+
.. doxygengroup:: mspi_interface

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ Drivers
382382

383383
This section provides detailed lists of changes by :ref:`driver <drivers>`.
384384

385-
|no_changes_yet_note|
385+
* Added the :ref:`mspi_sqspi` that allows for communication with devices that use MSPI bus-based Zephyr drivers.
386386

387387
Wi-Fi drivers
388388
-------------

0 commit comments

Comments
 (0)