Skip to content

Commit df154a1

Browse files
committed
tests: drivers: spi: loopback: Add test for pico-spi-pio driver with DMA.
With the addition of a new overlay file that specifies DMA channels. Signed-off-by: Terry Geng <[email protected]>
1 parent 277cb92 commit df154a1

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include <zephyr/dt-bindings/dma/rpi-pico-dma-rp2040.h>
2+
3+
&dma {
4+
status = "okay";
5+
};
6+
7+
&pinctrl {
8+
pio0_spi0_default: pio0_spi0_default {
9+
/* gpio 17 is used for chip select, not assigned to the PIO */
10+
group1 {
11+
pinmux = <PIO0_P18>, <PIO0_P19>;
12+
};
13+
group2 {
14+
pinmux = <PIO0_P16>;
15+
input-enable;
16+
};
17+
};
18+
};
19+
20+
&pio0 {
21+
status = "okay";
22+
23+
pio0_spi0: pio0_spi0 {
24+
pinctrl-0 = <&pio0_spi0_default>;
25+
pinctrl-names = "default";
26+
27+
compatible = "raspberrypi,pico-spi-pio";
28+
status = "okay";
29+
dmas = <&dma 0 0 0>, <&dma 1 0 0>;
30+
dma-names = "tx", "rx";
31+
#address-cells = <1>;
32+
#size-cells = <0>;
33+
clocks = <&clocks RPI_PICO_CLKID_CLK_SYS>;
34+
miso-gpios = <&gpio0 16 0>;
35+
cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
36+
clk-gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
37+
mosi-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
38+
39+
slow@0 {
40+
compatible = "test-spi-loopback-slow";
41+
reg = <0>;
42+
spi-max-frequency = <500000>;
43+
};
44+
fast@0 {
45+
compatible = "test-spi-loopback-fast";
46+
reg = <0>;
47+
spi-max-frequency = <14000000>;
48+
};
49+
};
50+
};

tests/drivers/spi/spi_loopback/testcase.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ tests:
205205
- DTC_OVERLAY_FILE="boards/rpi_pico_pio.overlay"
206206
- EXTRA_CONF_FILE="overlay-rpi-pico-pio.conf"
207207
platform_allow: rpi_pico
208+
drivers.spi.pio_spi_dma.loopback:
209+
extra_args:
210+
- DTC_OVERLAY_FILE="boards/rpi_pico_pio_dma.overlay"
211+
- EXTRA_CONF_FILE="overlay-rpi-pico-pio.conf"
212+
extra_configs:
213+
- CONFIG_SPI_RPI_PICO_PIO_DMA=y
214+
- CONFIG_DMA=y
215+
- CONFIG_PRINTK=y
216+
platform_allow: rpi_pico
208217
drivers.spi.mcux_flexio_spi.loopback:
209218
extra_args: DTC_OVERLAY_FILE="overlay-mcux-flexio-spi.overlay"
210219
filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and

0 commit comments

Comments
 (0)