Skip to content

Commit 477ff70

Browse files
JPHutchinscarlescufi
authored andcommitted
test: drivers: flash: build spi_nor.c wp & hold
Test spi_nor.c driver builds with or without wp-gpios and hold-gpios. Signed-off-by: J.P. Hutchins <[email protected]>
1 parent 19ba93c commit 477ff70

File tree

3 files changed

+134
-0
lines changed

3 files changed

+134
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2023 Intercreate, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Build test for jedec,spi-nor compatible (drivers/flash/spi_nor.c)
7+
*/
8+
9+
/ {
10+
aliases {
11+
spi-flash0 = &mx25v1635fzui;
12+
};
13+
};
14+
15+
/delete-node/ &mx25r64;
16+
17+
&pinctrl {
18+
spi0_default: spi0_default {
19+
group1 {
20+
psels = <NRF_PSEL(SPIM_SCK, 1, 9)>,
21+
<NRF_PSEL(SPIM_MOSI, 0, 11)>,
22+
<NRF_PSEL(SPIM_MISO, 0, 12)>;
23+
};
24+
};
25+
26+
spi0_sleep: spi0_sleep {
27+
group1 {
28+
psels = <NRF_PSEL(SPIM_SCK, 1, 9)>,
29+
<NRF_PSEL(SPIM_MOSI, 0, 11)>,
30+
<NRF_PSEL(SPIM_MISO, 0, 12)>;
31+
low-power-enable;
32+
};
33+
};
34+
};
35+
36+
&spi0 {
37+
compatible = "nordic,nrf-spim";
38+
status = "okay";
39+
cs-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; // mx25v16
40+
pinctrl-0 = <&spi0_default>;
41+
pinctrl-1 = <&spi0_sleep>;
42+
pinctrl-names = "default", "sleep";
43+
44+
mx25v1635fzui: mx25v1635fzui@0 {
45+
compatible = "jedec,spi-nor";
46+
status = "okay";
47+
reg = <0>;
48+
spi-max-frequency = <8000000>; // chip supports 80Mhz, SPI0 supports 8MHz
49+
size = <0x1000000>; // bits
50+
has-dpd;
51+
t-enter-dpd = <10000>;
52+
t-exit-dpd = <45000>;
53+
jedec-id = [ C2 23 15 ];
54+
sfdp-bfp = [
55+
e5 20 f1 ff ff ff ff 00 44 eb 08 6b 08 3b 04 bb
56+
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
57+
10 d8 00 ff 23 72 f1 00 82 ec 04 c2 44 83 48 44
58+
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
59+
];
60+
};
61+
};
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2023 Intercreate, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Build test for jedec,spi-nor compatible (drivers/flash/spi_nor.c) wp-gpios and hold-gpios
7+
*/
8+
9+
/ {
10+
aliases {
11+
spi-flash0 = &mx25v1635fzui;
12+
};
13+
};
14+
15+
/delete-node/ &mx25r64;
16+
17+
&pinctrl {
18+
spi0_default: spi0_default {
19+
group1 {
20+
psels = <NRF_PSEL(SPIM_SCK, 1, 9)>,
21+
<NRF_PSEL(SPIM_MOSI, 0, 11)>,
22+
<NRF_PSEL(SPIM_MISO, 0, 12)>;
23+
};
24+
};
25+
26+
spi0_sleep: spi0_sleep {
27+
group1 {
28+
psels = <NRF_PSEL(SPIM_SCK, 1, 9)>,
29+
<NRF_PSEL(SPIM_MOSI, 0, 11)>,
30+
<NRF_PSEL(SPIM_MISO, 0, 12)>;
31+
low-power-enable;
32+
};
33+
};
34+
};
35+
36+
&spi0 {
37+
compatible = "nordic,nrf-spim";
38+
status = "okay";
39+
cs-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; // mx25v16
40+
pinctrl-0 = <&spi0_default>;
41+
pinctrl-1 = <&spi0_sleep>;
42+
pinctrl-names = "default", "sleep";
43+
44+
mx25v1635fzui: mx25v1635fzui@0 {
45+
compatible = "jedec,spi-nor";
46+
status = "okay";
47+
reg = <0>;
48+
spi-max-frequency = <8000000>; // chip supports 80Mhz, SPI0 supports 8MHz
49+
size = <0x1000000>; // bits
50+
hold-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
51+
wp-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
52+
has-dpd;
53+
t-enter-dpd = <10000>;
54+
t-exit-dpd = <45000>;
55+
jedec-id = [ C2 23 15 ];
56+
sfdp-bfp = [
57+
e5 20 f1 ff ff ff ff 00 44 eb 08 6b 08 3b 04 bb
58+
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
59+
10 d8 00 ff 23 72 f1 00 82 ec 04 c2 44 83 48 44
60+
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
61+
];
62+
};
63+
};

tests/drivers/flash/common/testcase.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,13 @@ tests:
7979
platform_allow: mr_canhubk3
8080
extra_configs:
8181
- CONFIG_FLASH_NXP_S32_QSPI_NOR_SFDP_RUNTIME=y
82+
drivers.flash.common.spi_nor:
83+
platform_allow: nrf52840dk_nrf52840
84+
extra_args:
85+
- OVERLAY_CONFIG=boards/nrf52840dk_flash_spi.conf
86+
- DTC_OVERLAY_FILE=boards/nrf52840dk_spi_nor.overlay
87+
drivers.flash.common.spi_nor_wp_hold:
88+
platform_allow: nrf52840dk_nrf52840
89+
extra_args:
90+
- OVERLAY_CONFIG=boards/nrf52840dk_flash_spi.conf
91+
- DTC_OVERLAY_FILE=boards/nrf52840dk_spi_nor_wp_hold.overlay

0 commit comments

Comments
 (0)