Skip to content

Commit bee81df

Browse files
nordic-bamijhedberg
authored andcommitted
tests: drivers: flash: Test newly introduced MSPI driver features
These features are: - soft reset - 4B addressing (SPI mode) - supply gpios Signed-off-by: Bartosz Miller <[email protected]>
1 parent 07809ad commit bee81df

File tree

5 files changed

+112
-0
lines changed

5 files changed

+112
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&mx25uw63 {
8+
status = "okay";
9+
mspi-max-frequency = <DT_FREQ_K(256)>;
10+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&pinctrl {
8+
9+
/delete-node/ exmif_default;
10+
/delete-node/ exmif_sleep;
11+
12+
exmif_default: exmif_default {
13+
group1 {
14+
psels = <NRF_PSEL(EXMIF_CK, 6, 0)>,
15+
<NRF_PSEL(EXMIF_RWDS, 6, 2)>,
16+
<NRF_PSEL(EXMIF_DQ0, 6, 7)>,
17+
<NRF_PSEL(EXMIF_DQ1, 6, 5)>,
18+
<NRF_PSEL(EXMIF_DQ2, 6, 10)>,
19+
<NRF_PSEL(EXMIF_DQ3, 6, 9)>,
20+
<NRF_PSEL(EXMIF_DQ4, 6, 11)>,
21+
<NRF_PSEL(EXMIF_DQ5, 6, 8)>,
22+
<NRF_PSEL(EXMIF_DQ6, 6, 6)>,
23+
<NRF_PSEL(EXMIF_DQ7, 6, 4)>;
24+
nordic,drive-mode = <NRF_DRIVE_H0H1>;
25+
};
26+
};
27+
28+
exmif_sleep: exmif_sleep {
29+
group1 {
30+
low-power-enable;
31+
psels = <NRF_PSEL(EXMIF_CK, 6, 0)>,
32+
<NRF_PSEL(EXMIF_RWDS, 6, 2)>,
33+
<NRF_PSEL(EXMIF_DQ0, 6, 7)>,
34+
<NRF_PSEL(EXMIF_DQ1, 6, 5)>,
35+
<NRF_PSEL(EXMIF_DQ2, 6, 10)>,
36+
<NRF_PSEL(EXMIF_DQ3, 6, 9)>,
37+
<NRF_PSEL(EXMIF_DQ4, 6, 11)>,
38+
<NRF_PSEL(EXMIF_DQ5, 6, 8)>,
39+
<NRF_PSEL(EXMIF_DQ6, 6, 6)>,
40+
<NRF_PSEL(EXMIF_DQ7, 6, 4)>;
41+
};
42+
};
43+
44+
};
45+
46+
&gpio6 {
47+
status = "okay";
48+
};
49+
50+
&exmif {
51+
status = "okay";
52+
pinctrl-0 = <&exmif_default>;
53+
pinctrl-1 = <&exmif_sleep>;
54+
pinctrl-names = "default", "sleep";
55+
ce-gpios = <&gpio6 3 GPIO_ACTIVE_LOW>;
56+
};
57+
58+
&mx25uw63 {
59+
status = "okay";
60+
mspi-max-frequency = <DT_FREQ_M(50)>;
61+
mspi-io-mode = "MSPI_IO_MODE_SINGLE";
62+
use-4byte-addressing;
63+
initial-soft-reset;
64+
};

tests/drivers/flash/common/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
/ {
8+
zephyr,user {
9+
test-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
10+
};
11+
};
12+
13+
&gpio0 {
14+
status = "okay";
15+
};
16+
717
&gpio6 {
818
status = "okay";
919
zephyr,pm-device-runtime-auto;
@@ -16,4 +26,5 @@
1626

1727
&mx25uw63 {
1828
status = "okay";
29+
supply-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
1930
};

tests/drivers/flash/common/src/main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <zephyr/drivers/flash.h>
1010
#include <zephyr/devicetree.h>
1111
#include <zephyr/storage/flash_map.h>
12+
#include <zephyr/drivers/gpio.h>
1213

1314
#if defined(CONFIG_NORDIC_QSPI_NOR)
1415
#define TEST_AREA_DEV_NODE DT_INST(0, nordic_qspi_nor)
@@ -327,6 +328,22 @@ ZTEST(flash_driver, test_flash_erase)
327328
zassert_not_equal(expected[0], erase_value, "These values shall be different");
328329
}
329330

331+
ZTEST(flash_driver, test_supply_gpios_control)
332+
{
333+
if (!DT_NODE_HAS_PROP(TEST_AREA_DEV_NODE, supply_gpios)) {
334+
ztest_test_skip();
335+
}
336+
337+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), test_gpios)
338+
const struct gpio_dt_spec test_gpio =
339+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), test_gpios);
340+
zassert_true(gpio_is_ready_dt(&test_gpio), "Test GPIO is not ready\n");
341+
zassert_ok(gpio_pin_configure_dt(&test_gpio, GPIO_INPUT | GPIO_PULL_DOWN),
342+
"Failed to configure test pin\n");
343+
zassert_equal(gpio_pin_get(test_gpio.port, test_gpio.pin), 1, "Supply GPIO is not set\n");
344+
#endif
345+
}
346+
330347
struct test_cb_data_type {
331348
uint32_t page_counter; /* used to count how many pages was iterated */
332349
uint32_t exit_page; /* terminate iteration when this page is reached */

tests/drivers/flash/common/testcase.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,13 @@ tests:
183183
extra_args:
184184
- DTC_OVERLAY_FILE="./boards/${BOARD}_qspi_nor.overlay"
185185
- CONF_FILE="./prj.conf ./boards/${BOARD}_qspi_nor.conf"
186+
drivers.flash.common.mspi_single_io.4B_addr_soft_reset:
187+
platform_allow:
188+
- nrf54h20dk/nrf54h20/cpuapp
189+
extra_args:
190+
- EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_single_io_4B_addr_sreset.overlay
191+
drivers.flash.common.mspi_low_frequency:
192+
platform_allow:
193+
- nrf54h20dk/nrf54h20/cpuapp
194+
extra_args:
195+
- EXTRA_DTC_OVERLAY_FILE=boards/mx25uw63_low_freq.overlay

0 commit comments

Comments
 (0)