Skip to content

Commit ac50f8a

Browse files
galakcarlescufi
authored andcommitted
tests: spi_loopback: Rework test
* Move test to using devicetree for various "device" params. * Move test to using spi_dt_spec to simplify code Signed-off-by: Kumar Gala <[email protected]>
1 parent d5b0bd5 commit ac50f8a

File tree

103 files changed

+909
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+909
-294
lines changed

tests/drivers/spi/spi_loopback/Kconfig

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,5 @@ mainmenu "SPI Loopback Test"
44

55
source "Kconfig.zephyr"
66

7-
config SPI_LOOPBACK_DRV_NAME
8-
string "SPI device name to use for test"
9-
10-
config SPI_LOOPBACK_CS_GPIO
11-
bool "SPI port CS pin is controlled via a GPIO port during test"
12-
depends on GPIO
13-
14-
config SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME
15-
string "The GPIO port which is used to control CS"
16-
depends on SPI_LOOPBACK_CS_GPIO
17-
default "GPIO_0"
18-
19-
config SPI_LOOPBACK_CS_CTRL_GPIO_PIN
20-
int "The GPIO PIN which is used to act as a CS pin"
21-
depends on SPI_LOOPBACK_CS_GPIO
22-
default 0
23-
24-
config SPI_LOOPBACK_SLAVE_NUMBER
25-
int "Slave number from 0 to host controller slave limit"
26-
default 0
27-
28-
config SPI_LOOPBACK_SLOW_FREQ
29-
int "The frequency in Hz to use when testing in slow mode"
30-
default 500000
31-
32-
config SPI_LOOPBACK_FAST_FREQ
33-
int "The frequency in Hz to use when testing in fast mode"
34-
default 16000000
35-
367
config SPI_LOOPBACK_MODE_LOOP
378
bool "Configure the SPI in LOOP mode, so that no extra wiring is needed"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_2"
21
CONFIG_SPI_STM32_INTERRUPT=y
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2022 Kumar Gala <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&spi2 {
8+
slow@0 {
9+
compatible = "test-spi-loopback-slow";
10+
reg = <0>;
11+
spi-max-frequency = <500000>;
12+
};
13+
fast@0 {
14+
compatible = "test-spi-loopback-fast";
15+
reg = <0>;
16+
spi-max-frequency = <16000000>;
17+
};
18+
};

tests/drivers/spi/spi_loopback/boards/96b_stm32_sensor_mez.conf

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2022 Kumar Gala <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&spi4 {
8+
cs-gpios = <&gpioe 11 GPIO_ACTIVE_LOW>;
9+
slow@0 {
10+
compatible = "test-spi-loopback-slow";
11+
reg = <0>;
12+
spi-max-frequency = <500000>;
13+
};
14+
fast@0 {
15+
compatible = "test-spi-loopback-fast";
16+
reg = <0>;
17+
spi-max-frequency = <16000000>;
18+
};
19+
};
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
CONFIG_SPI_LOOPBACK_DRV_NAME="SERCOM1"
1+
CONFIG_GPIO=y
22
CONFIG_SPI_LOOPBACK_MODE_LOOP=y
3-
CONFIG_SPI_LOOPBACK_CS_GPIO=y
4-
CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME="PORTA"
5-
CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_PIN=7
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2022 Kumar Gala <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&sercom1 {
8+
cs-gpios = <&porta 7 GPIO_ACTIVE_LOW>;
9+
slow@0 {
10+
compatible = "test-spi-loopback-slow";
11+
reg = <0>;
12+
spi-max-frequency = <500000>;
13+
};
14+
fast@0 {
15+
compatible = "test-spi-loopback-fast";
16+
reg = <0>;
17+
spi-max-frequency = <16000000>;
18+
};
19+
};
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
CONFIG_SPI_LOOPBACK_DRV_NAME="SERCOM4"
2-
CONFIG_SPI_LOOPBACK_CS_GPIO=y
3-
CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME="PINMUX_A"
4-
CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_PIN=3
1+
CONFIG_GPIO=y
2+
CONFIG_SPI_ASYNC=n
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2022 Kumar Gala <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&sercom4 {
8+
cs-gpios = <&porta 3 GPIO_ACTIVE_LOW>;
9+
slow@0 {
10+
compatible = "test-spi-loopback-slow";
11+
reg = <0>;
12+
spi-max-frequency = <500000>;
13+
};
14+
fast@0 {
15+
compatible = "test-spi-loopback-fast";
16+
reg = <0>;
17+
spi-max-frequency = <16000000>;
18+
};
19+
};

tests/drivers/spi/spi_loopback/boards/arty_a7_arm_designstart_m1.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
# SPDX-License-Identifier: Apache-2.0
55
#
66

7-
CONFIG_SPI_LOOPBACK_DRV_NAME="DAPLINK_SINGLE_SPI_0"
87
CONFIG_SPI_LOOPBACK_MODE_LOOP=y

0 commit comments

Comments
 (0)