@@ -156,7 +156,7 @@ static void i2s_tx_stream_disable(const struct device *dev, bool drop)
156156 }
157157
158158 /* Disable the channel FIFO */
159- dev_cfg -> base -> TCR3 &= ~ I2S_TCR3_TCE_MASK ;
159+ SAI_TxSetChannelFIFOMask ( dev_cfg -> base , 0 ) ;
160160
161161 /* Disable Tx */
162162 SAI_TxEnable (dev_cfg -> base , false);
@@ -182,7 +182,7 @@ static void i2s_rx_stream_disable(const struct device *dev, bool in_drop, bool o
182182 dma_stop (dev_dma , strm -> dma_channel );
183183
184184 /* Disable the channel FIFO */
185- dev_cfg -> base -> RCR3 &= ~ I2S_RCR3_RCE_MASK ;
185+ SAI_RxSetChannelFIFOMask ( dev_cfg -> base , 0 ) ;
186186
187187 /* Disable DMA enable bit */
188188 SAI_RxEnableDMA (dev_cfg -> base , kSAI_FIFORequestDMAEnable , false);
@@ -613,11 +613,18 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
613613 LOG_DBG ("tx slab buffer = 0x%x" , (uint32_t )i2s_cfg -> mem_slab -> buffer );
614614
615615 config .fifo .fifoWatermark = (uint32_t )FSL_FEATURE_SAI_FIFO_COUNTn (base ) - 1 ;
616+ #if defined(FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE ) && FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE
617+ /*
618+ * TX FIFO combine on write. The value below has correct value and wrong name
619+ * because RX and TX definitions are different but MCUX uses the same for both.
620+ */
621+ config .fifo .fifoCombine = kSAI_FifoCombineModeEnabledOnRead ;
622+ #endif
616623 /* set bit clock divider */
617624 SAI_TxSetConfig (base , & config );
618625 dev_data -> tx .start_channel = config .startChannel ;
619626 /* Disable the channel FIFO */
620- base -> TCR3 &= ~ I2S_TCR3_TCE_MASK ;
627+ SAI_TxSetChannelFIFOMask ( base , 0 ) ;
621628 SAI_TxSetBitClockRate (base , mclk , i2s_cfg -> frame_clk_freq , word_size_bits ,
622629 i2s_cfg -> channels );
623630 LOG_DBG ("tx start_channel = %d" , dev_data -> tx .start_channel );
@@ -631,6 +638,9 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
631638 } else {
632639 /* For RX, DMA reads from FIFO whenever data present */
633640 config .fifo .fifoWatermark = 0 ;
641+ #if defined(FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE ) && FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE
642+ config .fifo .fifoCombine = kSAI_FifoCombineModeEnabledOnRead ;
643+ #endif
634644
635645 memcpy (& dev_data -> rx .cfg , i2s_cfg , sizeof (struct i2s_config ));
636646 LOG_DBG ("rx slab free_list = 0x%x" , (uint32_t )i2s_cfg -> mem_slab -> free_list );
@@ -742,7 +752,7 @@ static int i2s_tx_stream_start(const struct device *dev)
742752 SAI_TxEnableDMA (base , kSAI_FIFORequestDMAEnable , true);
743753
744754 /* Enable the channel FIFO */
745- base -> TCR3 |= I2S_TCR3_TCE ( 1UL << strm -> start_channel );
755+ SAI_TxSetChannelFIFOMask ( base , dev_cfg -> tx_channel );
746756
747757 /* Enable SAI Tx clock */
748758 SAI_TxEnable (base , true);
@@ -840,7 +850,7 @@ static int i2s_rx_stream_start(const struct device *dev)
840850 SAI_RxEnableDMA (base , kSAI_FIFORequestDMAEnable , true);
841851
842852 /* Enable the channel FIFO */
843- base -> RCR3 |= I2S_RCR3_RCE ( 1UL << strm -> start_channel );
853+ SAI_RxSetChannelFIFOMask ( base , dev_cfg -> tx_channel );
844854
845855 /* Enable SAI Rx clock */
846856 SAI_RxEnable (base , true);
0 commit comments