Commit 92d02878 authored by Declan Snyder's avatar Declan Snyder Committed by Mahesh Mahadevan
Browse files

drivers: spi_mcux_lpspi: Fix DMA path on RT



Apparently, the previous change to fix the chip select only works on
some newer revisions of the LPSPI, and the behavior is different on
older parts like RT. For now put some #ifdef to keep the fixed CS on
MCXN but have the old behavior on RT and other platforms.

Signed-off-by: default avatarDeclan Snyder <declan.snyder@nxp.com>
parent b6b8eeed
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -483,7 +483,9 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi
		return ret;
	}

#ifdef CONFIG_SOC_SERIES_MCXN
	base->TCR |= LPSPI_TCR_CONT_MASK;
#endif

	/* DMA is fast enough watermarks are not required */
	LPSPI_SetFifoWatermarks(base, 0U, 0U);
@@ -500,9 +502,11 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi
				goto out;
			}

#ifdef CONFIG_SOC_SERIES_MCXN
			while (!(LPSPI_GetStatusFlags(base) & kLPSPI_TxDataRequestFlag)) {
				/* wait until previous tx finished */
			}
#endif

			/* Enable DMA Requests */
			LPSPI_EnableDMA(base, kLPSPI_TxDmaEnable | kLPSPI_RxDmaEnable);
@@ -513,6 +517,12 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi
				goto out;
			}

#ifndef CONFIG_SOC_SERIES_MCXN
			while ((LPSPI_GetStatusFlags(base) & kLPSPI_ModuleBusyFlag)) {
				/* wait until module is idle */
			}
#endif

			/* Disable DMA */
			LPSPI_DisableDMA(base, kLPSPI_TxDmaEnable | kLPSPI_RxDmaEnable);