common:
  depends_on: spi
  tags:
    - drivers
    - spi
    - dma
  filter: dt_compat_enabled("test-spi-loopback-slow") and
          dt_compat_enabled("test-spi-loopback-fast")
  harness: ztest
  harness_config:
    fixture: spi_loopback
tests:
  drivers.spi.loopback: {}
  drivers.spi.loopback.internal:
    filter: CONFIG_SPI_LOOPBACK_MODE_LOOP
  drivers.spi.loopback.lpspi.dma:
    filter: DT_HAS_NXP_LPSPI_ENABLED and DT_HAS_NXP_MCUX_EDMA_ENABLED
    extra_configs:
      - CONFIG_SPI_MCUX_LPSPI_DMA=y
  drivers.spi.loopback.lpspi.async.unset:
    filter: DT_HAS_NXP_LPSPI_ENABLED and DT_HAS_NXP_MCUX_EDMA_ENABLED
    extra_configs:
      - CONFIG_SPI_MCUX_LPSPI_DMA=n
      - CONFIG_SPI_ASYNC=n
  drivers.spi.loopback.lpspi.dma.async.unset:
    filter: DT_HAS_NXP_LPSPI_ENABLED and DT_HAS_NXP_MCUX_EDMA_ENABLED
    extra_configs:
      - CONFIG_SPI_MCUX_LPSPI_DMA=y
      - CONFIG_SPI_ASYNC=n
  drivers.spi.loopback.rtio:
    extra_configs:
      - CONFIG_SPI_RTIO=y
    platform_allow:
      - robokit1
      - mimxrt1170_evk/mimxrt1176/cm7
    integration_platforms:
      - robokit1
  drivers.spi.mcux_dspi_dma.loopback:
    extra_args:
      - EXTRA_CONF_FILE="overlay-mcux-dspi-dma.conf"
      - DTC_OVERLAY_FILE="overlay-mcux-dspi-dma.overlay"
    platform_allow: frdm_k64f
  drivers.spi.sam_spi_dma.loopback:
    extra_args:
      - EXTRA_CONF_FILE="overlay-sam-spi-dma.conf"
      - DTC_OVERLAY_FILE="overlay-sam-spi-dma.overlay"
    platform_allow:
      - sam_e70_xplained/same70q21
      - sam_v71_xult/samv71q21
      - robokit1
    integration_platforms:
      - sam_e70_xplained/same70q21
  drivers.spi.stm32_spi_16bits_frames.loopback:
    extra_args:
      - EXTRA_CONF_FILE="overlay-stm32-spi-16bits.conf"
      - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay"
    platform_allow:
      - nucleo_h743zi
      - nucleo_h753zi
      - nucleo_h745zi_q/stm32h745xx/m4
      - nucleo_h745zi_q/stm32h745xx/m7
    integration_platforms:
      - nucleo_h743zi
  drivers.spi.stm32_spi_dma.loopback:
    extra_args: EXTRA_CONF_FILE="overlay-stm32-spi-dma.conf"
    platform_allow:
      - b_u585i_iot02a
      - nucleo_c071rb
      - nucleo_g474re
      - nucleo_f207zg
      - nucleo_f429zi
      - nucleo_f746zg
      - nucleo_f767zi
      - nucleo_wb55rg
      - nucleo_l152re
      - nucleo_wl55jc
      - nucleo_h743zi
      - nucleo_h753zi
      - nucleo_h745zi_q/stm32h745xx/m4
      - nucleo_h745zi_q/stm32h745xx/m7
      - stm32h573i_dk
    integration_platforms:
      - nucleo_g474re
  drivers.spi.stm32_spi_dma_dt_nocache_mem.loopback:
    # this test case is for when nocache memory region is defined in DT
    # using `zephyr,memory-attr = < DT_MEM_ARM_MPU_RAM_NOCACHE)>`
    extra_args:
      - EXTRA_CONF_FILE="overlay-stm32-spi-dma-dt-nocache-mem.conf"
    filter: CONFIG_CPU_HAS_DCACHE
    platform_allow:
      - nucleo_h743zi
      - nucleo_h753zi
      - nucleo_h745zi_q/stm32h745xx/m4
      - nucleo_h745zi_q/stm32h745xx/m7
    integration_platforms:
      - nucleo_h743zi
  drivers.spi.stm32_spi_16bits_frames_dma.loopback:
    extra_args:
      - EXTRA_CONF_FILE="overlay-stm32-spi-16bits-dma.conf"
      - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay"
    platform_allow:
      - nucleo_h743zi
      - nucleo_h753zi
      - nucleo_h745zi_q/stm32h745xx/m4
      - nucleo_h745zi_q/stm32h745xx/m7
    integration_platforms:
      - nucleo_h743zi
  drivers.spi.stm32_spi_16bits_frames_dma_dt_nocache_mem.loopback:
    extra_args:
      - EXTRA_CONF_FILE="overlay-stm32-spi-16bits-dma-dt-nocache-mem.conf"
      - DTC_OVERLAY_FILE="overlay-stm32-spi-16bits.overlay"
    filter: CONFIG_CPU_HAS_DCACHE
    platform_allow:
      - nucleo_h743zi
      - nucleo_h753zi
      - nucleo_h745zi_q/stm32h745xx/m4
      - nucleo_h745zi_q/stm32h745xx/m7
    integration_platforms:
      - nucleo_h743zi
  drivers.spi.stm32_spi_interrupt.loopback:
    extra_args: EXTRA_CONF_FILE="overlay-stm32-spi-interrupt.conf"
    platform_allow:
      - b_u585i_iot02a
      - nucleo_c071rb
      - nucleo_f207zg
      - nucleo_f429zi
      - nucleo_f746zg
      - nucleo_f767zi
      - nucleo_g474re
      - nucleo_h743zi
      - nucleo_h753zi
      - nucleo_h745zi_q/stm32h745xx/m4
      - nucleo_h745zi_q/stm32h745xx/m7
      - nucleo_l152re
      - nucleo_wb55rg
      - nucleo_wl55jc
      - stm32f3_disco
      - stm32h573i_dk
    integration_platforms:
      - stm32h573i_dk
  drivers.spi.gd32_spi_interrupt.loopback:
    extra_args: EXTRA_CONF_FILE="overlay-gd32-spi-interrupt.conf"
    platform_allow:
      - gd32f403z_eval
      - gd32f407v_start
      - gd32f450i_eval
      - gd32f450v_start
      - gd32f450z_eval
      - gd32f470i_eval
      - gd32vf103c_starter
      - gd32vf103v_eval
      - longan_nano
      - longan_nano/gd32vf103/lite
    integration_platforms:
      - gd32f403z_eval
  drivers.spi.gd32_spi_dma.loopback:
    extra_args: EXTRA_CONF_FILE="overlay-gd32-spi-dma.conf"
    platform_allow:
      - gd32f403z_eval
      - gd32f407v_start
      - gd32f450i_eval
      - gd32f450v_start
      - gd32f450z_eval
      - gd32f470i_eval
      - gd32vf103c_starter
      - gd32vf103v_eval
      - longan_nano
      - longan_nano/gd32vf103/lite
    integration_platforms:
      - gd32f403z_eval
  drivers.spi.pl022_spi_interrupt.loopback:
    extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022.overlay"
    extra_configs:
      - CONFIG_SPI_PL022_INTERRUPT=y
      - CONFIG_SPI_PL022_DMA=n
    platform_allow:
      - rpi_pico
      - pico_plus2/rp2350b/m33
  drivers.spi.pl022_spi_dma.loopback:
    extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022_dma.overlay"
    extra_configs:
      - CONFIG_SPI_PL022_INTERRUPT=n
      - CONFIG_SPI_PL022_DMA=y
      - CONFIG_DMA=y
    platform_allow:
      - rpi_pico
      - pico_plus2/rp2350b/m33
  drivers.spi.pl022_spi_dma_and_interrupt.loopback:
    extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022_dma.overlay"
    extra_configs:
      - CONFIG_SPI_PL022_INTERRUPT=y
      - CONFIG_SPI_PL022_DMA=y
      - CONFIG_DMA=y
    platform_allow:
      - rpi_pico
      - pico_plus2/rp2350b/m33
  drivers.spi.pl022_spi_dma_no_dma_props.loopback:
    extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022.overlay"
    extra_configs:
      - CONFIG_SPI_PL022_INTERRUPT=n
      - CONFIG_SPI_PL022_DMA=y
      - CONFIG_DMA=y
    platform_allow:
      - rpi_pico
      - pico_plus2/rp2350b/m33
  drivers.spi.pl022_spi_dma_and_interrupt_no_dma_props.loopback:
    extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022.overlay"
    extra_configs:
      - CONFIG_SPI_PL022_INTERRUPT=y
      - CONFIG_SPI_PL022_DMA=y
      - CONFIG_DMA=y
    platform_allow:
      - rpi_pico
      - pico_plus2/rp2350b/m33
  drivers.spi.pio_spi.loopback:
    extra_args:
      - DTC_OVERLAY_FILE="boards/rpi_pico_pio.overlay"
      - EXTRA_CONF_FILE="overlay-rpi-pico-pio.conf"
    platform_allow: rpi_pico
  drivers.spi.mcux_flexio_spi.loopback:
    extra_args: DTC_OVERLAY_FILE="overlay-mcux-flexio-spi.overlay"
    filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
            CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
    platform_allow: mimxrt1064_evk
  drivers.spi.mimxrt1040evk_flexio_spi.loopback:
    extra_args: DTC_OVERLAY_FILE="boards/mimxrt1040_evk_flexio_spi.overlay"
    filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
            CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
    platform_allow: mimxrt1040_evk
  drivers.spi.nrf54h_fast_8mhz:
    extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
    platform_allow:
      - nrf54h20dk/nrf54h20/cpuapp
  drivers.spi.nrf54h_fast_16mhz:
    extra_args:
      - DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
      - EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_16mhz.overlay"
    platform_allow:
      - nrf54h20dk/nrf54h20/cpuapp
  drivers.spi.nrf54h_fast_32mhz:
    extra_args:
      - DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
      - EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_32mhz.overlay"
    platform_allow:
      - nrf54h20dk/nrf54h20/cpuapp
  drivers.spi.nrf54l_8mhz:
    extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_8mhz.overlay"
    platform_allow:
      - nrf54l15dk/nrf54l15/cpuapp
      - nrf54l20pdk/nrf54l20/cpuapp
  drivers.spi.nrf54l_16mhz:
    extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_16mhz.overlay"
    platform_allow:
      - nrf54l15dk/nrf54l15/cpuapp
      - nrf54l20pdk/nrf54l20/cpuapp
  drivers.spi.nrf54l_32mhz:
    extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf_at_32mhz.overlay"
    platform_allow:
      - nrf54l15dk/nrf54l15/cpuapp
      - nrf54l20pdk/nrf54l20/cpuapp
  drivers.spi.ke1xz_flexio_spi.loopback:
    extra_args: DTC_OVERLAY_FILE="boards/frdm_ke1xz_flexio_spi.overlay"
    filter: CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and
            CONFIG_DT_HAS_NXP_FLEXIO_SPI_ENABLED
    platform_allow:
      - frdm_ke17z
      - frdm_ke17z512
  drivers.spi.max32_dma.loopback:
    extra_args: EXTRA_CONF_FILE="overlay-max32-spi-dma.conf"
    filter: CONFIG_SOC_FAMILY_MAX32
  drivers.spi.s32z_dspi.loopback:
    extra_args:
      - DTC_OVERLAY_FILE=boards/s32z2xxdc2_s32z270_dspi.overlay
    platform_allow:
      - s32z2xxdc2/s32z270/rtu0
      - s32z2xxdc2/s32z270/rtu1
  drivers.spi.max32_spi_rtio.loopback:
    extra_args:
      - OVERLAY_CONFIG="overlay-max32-spi-rtio.conf"
    filter: CONFIG_SOC_FAMILY_MAX32
    platform_allow:
      - apard32690/max32690/m4
  drivers.spi.nrf_pm_runtime:
    extra_configs:
      - CONFIG_PM_DEVICE=y
      - CONFIG_PM_DEVICE_RUNTIME=y
    filter: CONFIG_SOC_FAMILY_NORDIC_NRF
  drivers.spi.silabs_s2.loopback.no_async:
    filter: CONFIG_SOC_FAMILY_SILABS_S2
    platform_allow:
      - xg24_rb4187c
    extra_configs:
      - CONFIG_SPI_SILABS_EUSART_DMA=n
      - CONFIG_SPI_ASYNC=n
  drivers.spi.silabs_s2.loopback.dma.no_async:
    filter: CONFIG_SOC_FAMILY_SILABS_S2
    platform_allow:
      - xg24_rb4187c
    extra_configs:
      - CONFIG_SPI_SILABS_EUSART_DMA=y
      - CONFIG_SPI_ASYNC=n
