[rtems commit] bsp/imx: Allow gapless SPI transfers.

Christian Mauderer christianm at rtems.org
Tue Feb 11 08:20:28 UTC 2020


Module:    rtems
Branch:    master
Commit:    d00d690557a1e31dd7f0ac371974796df5a43c3f
Changeset: http://git.rtems.org/rtems/commit/?id=d00d690557a1e31dd7f0ac371974796df5a43c3f

Author:    Christian Mauderer <christian.mauderer at embedded-brains.de>
Date:      Mon Feb 10 10:35:15 2020 +0100

bsp/imx: Allow gapless SPI transfers.

This uses the tx-threshold to reduce gaps in SPI transmissions.

Update #3869.

---

 bsps/arm/imx/spi/imx-ecspi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bsps/arm/imx/spi/imx-ecspi.c b/bsps/arm/imx/spi/imx-ecspi.c
index 9a232c5..4c4978c 100644
--- a/bsps/arm/imx/spi/imx-ecspi.c
+++ b/bsps/arm/imx/spi/imx-ecspi.c
@@ -174,12 +174,14 @@ static void imx_ecspi_config(
   uint32_t conreg;
   uint32_t testreg;
   uint32_t configreg;
+  uint32_t dmareg;
   uint32_t cs_bit;
 
   conreg = IMX_ECSPI_CONREG_CHANNEL_MODE(0xf)
     | IMX_ECSPI_CONREG_SMC | IMX_ECSPI_CONREG_EN;
   testreg = regs->testreg;
   configreg = regs->configreg;
+  dmareg = regs->dmareg;
   cs_bit = 1U << cs;
 
   conreg |= imx_ecspi_conreg_divider(bus, speed_hz);
@@ -213,8 +215,11 @@ static void imx_ecspi_config(
     testreg &= ~IMX_ECSPI_TESTREG_LBC;
   }
 
+  dmareg = IMX_ECSPI_DMAREG_TX_THRESHOLD_SET(dmareg, IMX_ECSPI_FIFO_SIZE/2);
+
   regs->conreg = conreg;
   regs->testreg = testreg;
+  regs->dmareg = dmareg;
   regs->configreg = configreg;
 
   bus->conreg = conreg;
@@ -287,7 +292,7 @@ static void imx_ecspi_next_msg(imx_ecspi_bus *bus, volatile imx_ecspi *regs)
     bus->tx_buf = msg->tx_buf;
     imx_ecspi_set_push_pop(bus, msg->len, msg->bits_per_word);
     imx_ecspi_push(bus, regs);
-    regs->intreg = IMX_ECSPI_TE;
+    regs->intreg = IMX_ECSPI_TE | IMX_ECSPI_TDR;
   } else {
     regs->intreg = 0;
     imx_ecspi_done(bus);



More information about the vc mailing list