Skip to content

Commit 0741603

Browse files
nika-nordicanangl
authored andcommitted
[nrf fromlist] tests: drivers: spi: nordic: add fast SPI to overlays
SPIM12x have more capabilities than SPIM13x, so it should be tested separately. Upstream PR: zephyrproject-rtos/zephyr#73545 Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
1 parent 0b44283 commit 0741603

12 files changed

+346
-22
lines changed

tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_common.dtsi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
owned-channels = <7>;
5353
};
5454

55-
dut_spi: &spi130 {
55+
&spi130 {
5656
compatible = "nordic,nrf-spim";
5757
status = "okay";
5858
pinctrl-0 = <&spi130_default_alt>;
@@ -63,6 +63,7 @@ dut_spi: &spi130 {
6363
dut_spi_dt: test-spi-dev@0 {
6464
compatible = "vnd,spi-device";
6565
reg = <0>;
66+
spi-max-frequency = <DT_FREQ_M(8)>;
6667
};
6768
};
6869

tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
#include "nrf54h20dk_nrf54h20_common.dtsi"
77

8-
&dut_spi {
8+
&spi130 {
99
memory-regions = <&cpuapp_dma_region>;
1010
};
1111

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&pinctrl {
8+
spi121_default_alt: spi121_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
11+
<NRF_PSEL(SPIM_MISO, 7, 0)>,
12+
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
13+
};
14+
};
15+
16+
spi121_sleep_alt: spi121_sleep_alt {
17+
group1 {
18+
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
19+
<NRF_PSEL(SPIM_MISO, 7, 0)>,
20+
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
21+
low-power-enable;
22+
};
23+
};
24+
25+
spis131_default_alt: spis131_default_alt {
26+
group1 {
27+
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
28+
<NRF_PSEL(SPIS_MISO, 1, 9)>,
29+
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
30+
<NRF_PSEL(SPIS_CSN, 0, 11)>;
31+
};
32+
};
33+
34+
spis131_sleep_alt: spis131_sleep_alt {
35+
group1 {
36+
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
37+
<NRF_PSEL(SPIS_MISO, 1, 9)>,
38+
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
39+
<NRF_PSEL(SPIS_CSN, 0, 11)>;
40+
low-power-enable;
41+
};
42+
};
43+
};
44+
45+
&gpio0 {
46+
status = "okay";
47+
};
48+
49+
&spi121 {
50+
compatible = "nordic,nrf-spim";
51+
status = "okay";
52+
pinctrl-0 = <&spi121_default_alt>;
53+
pinctrl-1 = <&spi121_sleep_alt>;
54+
pinctrl-names = "default", "sleep";
55+
overrun-character = <0x00>;
56+
memory-regions = <&dma_fast_region>;
57+
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
58+
dut_spi_dt: test-spi-dev@0 {
59+
compatible = "vnd,spi-device";
60+
reg = <0>;
61+
spi-max-frequency = <DT_FREQ_M(8)>;
62+
};
63+
};
64+
65+
dut_spis: &spi131 {
66+
compatible = "nordic,nrf-spis";
67+
status = "okay";
68+
def-char = <0x00>;
69+
pinctrl-0 = <&spis131_default_alt>;
70+
pinctrl-1 = <&spis131_sleep_alt>;
71+
pinctrl-names = "default", "sleep";
72+
memory-regions = <&cpuapp_dma_region>;
73+
/delete-property/rx-delay-supported;
74+
/delete-property/rx-delay;
75+
};

tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpurad.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
#include "nrf54h20dk_nrf54h20_common.dtsi"
77

8-
&dut_spi {
8+
&spi130 {
99
memory-regions = <&cpurad_dma_region>;
1010
};
1111

tests/drivers/spi/spi_controller_peripheral/testcase.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,53 @@ common:
77
platform_allow: |
88
nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp nrf54h20dk/nrf54h20/cpuapp
99
nrf54h20dk/nrf54h20/cpurad
10-
integration_platforms:
11-
- nrf52840dk/nrf52840
1210
1311
tests:
1412
drivers.spi.spi_mode0:
1513
extra_configs:
1614
- CONFIG_TESTED_SPI_MODE=0
1715
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/250khz.overlay"
16+
integration_platforms:
17+
- nrf52840dk/nrf52840
1818

1919
drivers.spi.spi_mode1:
2020
extra_configs:
2121
- CONFIG_TESTED_SPI_MODE=1
2222
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/500khz.overlay"
23+
integration_platforms:
24+
- nrf52840dk/nrf52840
2325

2426
drivers.spi.spi_mode2:
2527
extra_configs:
2628
- CONFIG_TESTED_SPI_MODE=2
2729
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/1mhz.overlay"
30+
integration_platforms:
31+
- nrf52840dk/nrf52840
2832

2933
drivers.spi.spi_mode3:
3034
extra_configs:
3135
- CONFIG_TESTED_SPI_MODE=3
3236
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/2mhz.overlay"
37+
integration_platforms:
38+
- nrf52840dk/nrf52840
3339

3440
drivers.spi.spi_4MHz:
3541
extra_configs:
3642
- CONFIG_TESTED_SPI_MODE=2
3743
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/4mhz.overlay"
44+
integration_platforms:
45+
- nrf52840dk/nrf52840
3846

3947
drivers.spi.spi_8MHz:
4048
extra_configs:
4149
- CONFIG_TESTED_SPI_MODE=1
4250
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/8mhz.overlay"
51+
integration_platforms:
52+
- nrf52840dk/nrf52840
53+
54+
drivers.spi.spi_fast:
55+
extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
56+
platform_exclude:
57+
- nrf52840dk/nrf52840
58+
- nrf54l15pdk/nrf54l15/cpuapp
59+
- nrf54h20dk/nrf54h20/cpurad
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&pinctrl {
8+
spi121_default_alt: spi121_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
11+
<NRF_PSEL(SPIM_MISO, 7, 0)>,
12+
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
13+
};
14+
};
15+
16+
spi121_sleep_alt: spi121_sleep_alt {
17+
group1 {
18+
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
19+
<NRF_PSEL(SPIM_MISO, 7, 0)>,
20+
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
21+
low-power-enable;
22+
};
23+
};
24+
25+
spis131_default_alt: spis131_default_alt {
26+
group1 {
27+
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
28+
<NRF_PSEL(SPIS_MISO, 1, 9)>,
29+
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
30+
<NRF_PSEL(SPIS_CSN, 0, 11)>;
31+
};
32+
};
33+
34+
spis131_sleep_alt: spis131_sleep_alt {
35+
group1 {
36+
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
37+
<NRF_PSEL(SPIS_MISO, 1, 9)>,
38+
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
39+
<NRF_PSEL(SPIS_CSN, 0, 11)>;
40+
low-power-enable;
41+
};
42+
};
43+
};
44+
45+
&gpio0 {
46+
status = "okay";
47+
};
48+
49+
&spi121 {
50+
compatible = "nordic,nrf-spim";
51+
status = "okay";
52+
pinctrl-0 = <&spi121_default_alt>;
53+
pinctrl-1 = <&spi121_sleep_alt>;
54+
pinctrl-names = "default", "sleep";
55+
overrun-character = <0x00>;
56+
memory-regions = <&dma_fast_region>;
57+
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
58+
dut_spi_dt: test-spi-dev@0 {
59+
compatible = "vnd,spi-device";
60+
reg = <0>;
61+
spi-max-frequency = <DT_FREQ_M(8)>;
62+
};
63+
};
64+
65+
dut_spis: &spi131 {
66+
compatible = "nordic,nrf-spis";
67+
status = "okay";
68+
def-char = <0x00>;
69+
pinctrl-0 = <&spis131_default_alt>;
70+
pinctrl-1 = <&spis131_sleep_alt>;
71+
pinctrl-names = "default", "sleep";
72+
memory-regions = <&cpuapp_dma_region>;
73+
/delete-property/rx-delay-supported;
74+
/delete-property/rx-delay;
75+
};
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&pinctrl {
8+
spi130_default_alt: spi130_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
11+
<NRF_PSEL(SPIM_MISO, 0, 6)>,
12+
<NRF_PSEL(SPIM_MOSI, 0, 8)>;
13+
};
14+
};
15+
16+
spi130_sleep_alt: spi130_sleep_alt {
17+
group1 {
18+
psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
19+
<NRF_PSEL(SPIM_MISO, 0, 6)>,
20+
<NRF_PSEL(SPIM_MOSI, 0, 8)>;
21+
low-power-enable;
22+
};
23+
};
24+
25+
spis131_default_alt: spis131_default_alt {
26+
group1 {
27+
psels = <NRF_PSEL(SPIS_SCK, 0, 1)>,
28+
<NRF_PSEL(SPIS_MISO, 0, 7)>,
29+
<NRF_PSEL(SPIS_MOSI, 0, 9)>,
30+
<NRF_PSEL(SPIS_CSN, 0, 11)>;
31+
};
32+
};
33+
34+
spis131_sleep_alt: spis131_sleep_alt {
35+
group1 {
36+
psels = <NRF_PSEL(SPIS_SCK, 0, 1)>,
37+
<NRF_PSEL(SPIS_MISO, 0, 7)>,
38+
<NRF_PSEL(SPIS_MOSI, 0, 9)>,
39+
<NRF_PSEL(SPIS_CSN, 0, 11)>;
40+
low-power-enable;
41+
};
42+
};
43+
44+
};
45+
46+
&gpio0 {
47+
status = "okay";
48+
};
49+
50+
&gpiote130 {
51+
status = "okay";
52+
owned-channels = <7>;
53+
};
54+
55+
&cpuapp_dma_region {
56+
status = "okay";
57+
};
58+
59+
&spi130 {
60+
compatible = "nordic,nrf-spim";
61+
status = "okay";
62+
pinctrl-0 = <&spi130_default_alt>;
63+
pinctrl-1 = <&spi130_sleep_alt>;
64+
pinctrl-names = "default", "sleep";
65+
overrun-character = <0x00>;
66+
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
67+
dut_spi_dt: test-spi-dev@0 {
68+
compatible = "vnd,spi-device";
69+
reg = <0>;
70+
spi-max-frequency = <500000>;
71+
};
72+
memory-regions = <&cpuapp_dma_region>;
73+
};
74+
75+
dut_spis: &spi131 {
76+
compatible = "nordic,nrf-spis";
77+
status = "okay";
78+
def-char = <0x00>;
79+
pinctrl-0 = <&spis131_default_alt>;
80+
pinctrl-1 = <&spis131_sleep_alt>;
81+
pinctrl-names = "default", "sleep";
82+
memory-regions = <&cpuapp_dma_region>;
83+
/delete-property/rx-delay-supported;
84+
/delete-property/rx-delay;
85+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&spi130 {
8+
status = "reserved";
9+
interrupt-parent = <&cpuppr_clic>;
10+
};
11+
12+
&spi131 {
13+
status = "reserved";
14+
interrupt-parent = <&cpuppr_clic>;
15+
};
16+
17+
&shared_ram3x_region {
18+
status = "okay";
19+
};
20+
21+
&gpio0 {
22+
status = "reserved";
23+
};

tests/drivers/spi/spi_error_cases/src/main.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,6 @@ ZTEST(spi_error_cases, test_unsupported_frequency)
176176
zassert_equal(rv, -EINVAL, "Got %d instead", rv);
177177
}
178178

179-
ZTEST(spi_error_cases, test_CS_unsupported_on_slave)
180-
{
181-
int slave_rv;
182-
struct spi_config spis_config_invalid = spis_config;
183-
struct gpio_dt_spec test_gpio = { DEVICE_DT_GET(DT_NODELABEL(gpio0)), 10, GPIO_ACTIVE_LOW };
184-
185-
spis_config_invalid.cs.gpio = test_gpio;
186-
187-
slave_rv = spi_transceive(spis_dev, &spis_config_invalid, tdata.stx_set, tdata.srx_set);
188-
zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv);
189-
}
190-
191179
ZTEST(spi_error_cases, test_spis_scattered_tx_buf_not_supported)
192180
{
193181
int slave_rv;

0 commit comments

Comments
 (0)