Skip to content

Commit dd90248

Browse files
Raymond0225dkalowsk
authored andcommitted
test: spi_loopback: nxp: Add Flexio spi test support
Add overlay file for RT1170 EVK and simply existing flexio spi overlay file for RT1060 EVKC and RT1064 EVK. One flexio-spi interface for both slow and fast tests. Fast baud rate set to 16Mbps now. Signed-off-by: Raymond Lei <[email protected]>
1 parent 581e7ff commit dd90248

File tree

4 files changed

+82
-39
lines changed

4 files changed

+82
-39
lines changed

drivers/spi/spi_mcux_flexio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ static void spi_flexio_master_init(FLEXIO_SPI_Type *base, flexio_spi_master_conf
199199
timerConfig.timerEnable = kFLEXIO_TimerEnableOnTriggerHigh;
200200
timerConfig.timerStop = kFLEXIO_TimerStopBitEnableOnTimerDisable;
201201
timerConfig.timerStart = kFLEXIO_TimerStartBitEnabled;
202-
/* Low 8-bits are used to configure baudrate. */
202+
/* Low 8-bits are used to configure baud rate. */
203203
timerDiv = (uint16_t)(srcClock_Hz / masterConfig->baudRate_Bps);
204204

205-
/* Add protection if the required band rate overflows.
206-
* FLEXIO input freq can't meet required band rate. Max band rate can
205+
/* Add protection if the required baud rate overflows.
206+
* FLEXIO input freq can't meet required baud rate. Max baud rate can
207207
* not exceed 1/4 of input freq. You can raise input freq or lower
208-
* bandrate required to remove this warning.
208+
* baud rate required to remove this warning.
209209
*/
210210
if (timerDiv < 4) {
211211
timerDiv = 4;
@@ -214,7 +214,7 @@ static void spi_flexio_master_init(FLEXIO_SPI_Type *base, flexio_spi_master_conf
214214
timerDiv += timerDiv & 1UL;
215215

216216
if (masterConfig->baudRate_Bps != (srcClock_Hz / timerDiv)) {
217-
LOG_WRN("Bandrate req:%uKbps, got:%uKbps",
217+
LOG_WRN("baud rate req:%uKbps, got:%uKbps",
218218
(uint32_t)(masterConfig->baudRate_Bps / 1000),
219219
(uint32_t)(srcClock_Hz / (timerDiv*1000)));
220220
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&lpspi1 {
8+
dmas = <&edma0 0 36>, <&edma0 1 37>;
9+
dma-names = "rx", "tx";
10+
status = "disabled";
11+
};
12+
13+
14+
&pinctrl {
15+
pinmux_flexio2spi1: pinmux_flexio2spi1 {
16+
group0 {
17+
pinmux = <&iomuxc_gpio_ad_29_gpio9_io28>, /* cs */
18+
<&iomuxc_gpio_ad_28_flexio2_flexio28>, /* sck */
19+
<&iomuxc_gpio_ad_30_flexio2_flexio30>, /* sdo */
20+
<&iomuxc_gpio_ad_31_flexio2_flexio31>; /* sdi */
21+
drive-strength = "high";
22+
slew-rate = "slow";
23+
24+
};
25+
};
26+
};
27+
28+
29+
&flexio2 {
30+
status = "okay";
31+
32+
flexio2spi1: flexio2spi1 {
33+
compatible = "nxp,flexio-spi";
34+
cs-gpios = <&gpio9 28 GPIO_ACTIVE_LOW>;
35+
#address-cells = <1>;
36+
#size-cells = <0>;
37+
sdo-pin = <30>;
38+
sdi-pin = <31>;
39+
sck-pin = <28>;
40+
pinctrl-0 = <&pinmux_flexio2spi1>;
41+
pinctrl-names = "default";
42+
status = "okay";
43+
44+
slow@0 {
45+
compatible = "test-spi-loopback-slow";
46+
reg = <0>;
47+
spi-max-frequency = <500000>;
48+
};
49+
fast@0 {
50+
compatible = "test-spi-loopback-fast";
51+
reg = <0>;
52+
spi-max-frequency = <16000000>;
53+
};
54+
};
55+
};
Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
/*
22
* Copyright (c) 2024, STRIM, ALC
3+
* Copyright (c) 2025, NXP
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
67

8+
/* On RT1060 EVKC, SPI loopback test, short J17-9 and J17-10
9+
* On RT1064 EVK, SPI loopback test, short J24-9 and J24-10
10+
*/
11+
712
&pinctrl {
813
pinmux_flexio3spi0: pinmux_flexio3spi0 {
914
group0 {
1015
pinmux =
1116
<&iomuxc_gpio_ad_b0_03_gpio1_io03>, /* cs */
1217
<&iomuxc_gpio_ad_b1_10_flexio3_flexio10>, /* sck */
13-
<&iomuxc_gpio_ad_b1_01_flexio3_flexio01>, /* sdo */
14-
<&iomuxc_gpio_ad_b1_04_flexio3_flexio04>; /* sdi */
15-
drive-strength = "r0-6";
16-
slew-rate = "slow";
17-
nxp,speed = "150-mhz";
18-
};
19-
};
20-
pinmux_flexio3spi1: pinmux_flexio3spi1 {
21-
group0 {
22-
pinmux =
23-
<&iomuxc_gpio_ad_b0_02_gpio1_io02>, /* cs */
24-
<&iomuxc_gpio_ad_b1_11_flexio3_flexio11>, /* sck */
2518
<&iomuxc_gpio_ad_b1_00_flexio3_flexio00>, /* sdo */
26-
<&iomuxc_gpio_ad_b1_05_flexio3_flexio05>; /* sdi */
19+
<&iomuxc_gpio_ad_b1_01_flexio3_flexio01>; /* sdi */
2720
drive-strength = "r0-6";
2821
slew-rate = "slow";
2922
nxp,speed = "150-mhz";
3023
};
3124
};
25+
3226
};
3327

3428
&flexio3 {
@@ -39,8 +33,8 @@
3933
#address-cells = <1>;
4034
#size-cells = <0>;
4135
cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
42-
sdo-pin = <1>;
43-
sdi-pin = <4>;
36+
sdo-pin = <0>;
37+
sdi-pin = <1>;
4438
sck-pin = <10>;
4539
pinctrl-0 = <&pinmux_flexio3spi0>;
4640
pinctrl-names = "default";
@@ -50,28 +44,13 @@
5044
reg = <0>;
5145
spi-max-frequency = <500000>;
5246
};
53-
};
54-
flexio3_spi1: flexio3_spi1 {
55-
compatible = "nxp,flexio-spi";
56-
status = "okay";
57-
#address-cells = <1>;
58-
#size-cells = <0>;
59-
cs-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
60-
sdo-pin = <0>;
61-
sdi-pin = <5>;
62-
sck-pin = <11>;
63-
pinctrl-0 = <&pinmux_flexio3spi1>;
64-
pinctrl-names = "default";
47+
6548
fast@0 {
6649
status = "okay";
6750
compatible = "test-spi-loopback-fast";
6851
reg = <0>;
69-
spi-max-frequency = <4000000>;
52+
spi-max-frequency = <16000000>;
7053
};
7154
};
72-
};
7355

74-
/* pinmux_lpspi3 overlaps pinmux_flexio3spi1 */
75-
&lpspi3 {
76-
status = "disabled";
7756
};

tests/drivers/spi/spi_loopback/testcase.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,21 @@ tests:
196196
extra_args: DTC_OVERLAY_FILE="overlay-mcux-flexio-spi.overlay"
197197
filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
198198
CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
199-
platform_allow: mimxrt1064_evk
199+
platform_allow:
200+
- mimxrt1064_evk
201+
- mimxrt1060_evk/mimxrt1062/qspi
202+
drivers.spi.mimxrt1170_evk_mimxrt1176_cm7_flexio_spi.loopback:
203+
extra_args: DTC_OVERLAY_FILE="boards/mimxrt1170_evk_mimxrt1176_cm7_flexio_spi.overlay"
204+
filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
205+
CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
206+
platform_allow:
207+
- mimxrt1170_evk/mimxrt1176/cm7
200208
drivers.spi.mimxrt1040evk_flexio_spi.loopback:
201209
extra_args: DTC_OVERLAY_FILE="boards/mimxrt1040_evk_flexio_spi.overlay"
202210
filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
203211
CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
204-
platform_allow: mimxrt1040_evk
212+
platform_allow:
213+
- mimxrt1040_evk
205214
drivers.spi.nrf54h_fast_2mhz:
206215
extra_args:
207216
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"

0 commit comments

Comments
 (0)