Skip to content

Commit 69bb782

Browse files
committed
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 bandrate set to 16Mbps now. Signed-off-by: Raymond Lei <raymond.lei@nxp.com>
1 parent d33f289 commit 69bb782

File tree

4 files changed

+85
-39
lines changed

4 files changed

+85
-39
lines changed

drivers/spi/spi_mcux_flexio.c

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

210-
/* Add protection if the required band rate overflows.
211-
* FLEXIO input freq can't meet required band rate. Max band rate can
210+
/* Add protection if the required baud rate overflows.
211+
* FLEXIO input freq can't meet required baud rate. Max baud rate can
212212
* not exceed 1/4 of input freq. You can raise input freq or lower
213-
* bandrate required to remove this warning.
213+
* baud rate required to remove this warning.
214214
*/
215215
if (timerDiv < 4) {
216216
timerDiv = 4;
@@ -219,7 +219,7 @@ static void spi_flexio_master_init(FLEXIO_SPI_Type *base, flexio_spi_master_conf
219219
timerDiv += timerDiv & 1UL;
220220

221221
if (masterConfig->baudRate_Bps != (srcClock_Hz / timerDiv)) {
222-
LOG_WRN("Bandrate req:%uKbps, got:%uKbps",
222+
LOG_WRN("baud rate req:%uKbps, got:%uKbps",
223223
(uint32_t)(masterConfig->baudRate_Bps / 1000),
224224
(uint32_t)(srcClock_Hz / (timerDiv*1000)));
225225
}
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: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,24 @@ tests:
228228
extra_args: DTC_OVERLAY_FILE="overlay-mcux-flexio-spi.overlay"
229229
filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
230230
CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
231-
platform_allow: mimxrt1064_evk
231+
platform_allow:
232+
- mimxrt1064_evk
233+
- mimxrt1060_evk/mimxrt1062/qspi
234+
- mimxrt1060_evk@B/mimxrt1062/qspi
235+
- mimxrt1060_evk@C/mimxrt1062/qspi
236+
drivers.spi.mimxrt1170_evk_mimxrt1176_cm7_flexio_spi.loopback:
237+
extra_args: DTC_OVERLAY_FILE="boards/mimxrt1170_evk_mimxrt1176_cm7_flexio_spi.overlay"
238+
filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
239+
CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
240+
platform_allow:
241+
- mimxrt1170_evk@A/mimxrt1176/cm7
242+
- mimxrt1170_evk@B/mimxrt1176/cm7
232243
drivers.spi.mimxrt1040evk_flexio_spi.loopback:
233244
extra_args: DTC_OVERLAY_FILE="boards/mimxrt1040_evk_flexio_spi.overlay"
234245
filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
235246
CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
236-
platform_allow: mimxrt1040_evk
247+
platform_allow:
248+
- mimxrt1040_evk
237249
drivers.spi.nrf54h_fast_2mhz:
238250
extra_args:
239251
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"

0 commit comments

Comments
 (0)