Skip to content

Commit 92d0287

Browse files
decsnymmahadevan108
authored andcommitted
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: Declan Snyder <[email protected]>
1 parent b6b8eee commit 92d0287

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/spi/spi_mcux_lpspi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi
483483
return ret;
484484
}
485485

486+
#ifdef CONFIG_SOC_SERIES_MCXN
486487
base->TCR |= LPSPI_TCR_CONT_MASK;
488+
#endif
487489

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

505+
#ifdef CONFIG_SOC_SERIES_MCXN
503506
while (!(LPSPI_GetStatusFlags(base) & kLPSPI_TxDataRequestFlag)) {
504507
/* wait until previous tx finished */
505508
}
509+
#endif
506510

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

520+
#ifndef CONFIG_SOC_SERIES_MCXN
521+
while ((LPSPI_GetStatusFlags(base) & kLPSPI_ModuleBusyFlag)) {
522+
/* wait until module is idle */
523+
}
524+
#endif
525+
516526
/* Disable DMA */
517527
LPSPI_DisableDMA(base, kLPSPI_TxDmaEnable | kLPSPI_RxDmaEnable);
518528

0 commit comments

Comments
 (0)