From 8819667b0703623b32069bd0c5745fe87f4628d6 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Fri, 13 Oct 2023 15:23:17 +0300 Subject: [PATCH] drivers: imx: Select DONE bit from software With multi-fifo we need to enable done bit from software as we have multiple fifos. For this we make use of sw_done_sel configurations bits and write proper bits into SDMA_DONE0 register. For more information see `SDMA DONE0 Configuration (SDMAARMx_DONE0_CONFIG)` SDMA register from i.MX8 reference manual. Signed-off-by: Daniel Baluta --- src/drivers/imx/sdma.c | 9 +++++++++ src/include/sof/drivers/sdma.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/drivers/imx/sdma.c b/src/drivers/imx/sdma.c index 937d6fdc6..902bb03eb 100644 --- a/src/drivers/imx/sdma.c +++ b/src/drivers/imx/sdma.c @@ -441,6 +441,8 @@ static struct dma_chan_data *sdma_channel_get(struct dma *dma, static void sdma_enable_event(struct dma_chan_data *channel, int eventnum) { + struct sdma_chan *pdata = dma_chan_get_data(channel); + tr_dbg(&sdma_tr, "sdma_enable_event(%d, %d)", channel->index, eventnum); if (eventnum < 0 || eventnum > SDMA_HWEVENTS_COUNT) @@ -448,6 +450,13 @@ static void sdma_enable_event(struct dma_chan_data *channel, int eventnum) dma_reg_update_bits(channel->dma, SDMA_CHNENBL(eventnum), BIT(channel->index), BIT(channel->index)); + + if (pdata->sw_done_sel & BIT(31)) { + unsigned int done0; + + done0 = SDMA_DONE0_CONFIG_DONE_SEL | ~SDMA_DONE0_CONFIG_DONE_DIS; + dma_reg_update_bits(channel->dma, SDMA_DONE0_CONFIG, 0xFF, done0); + } } static void sdma_disable_event(struct dma_chan_data *channel, int eventnum) diff --git a/src/include/sof/drivers/sdma.h b/src/include/sof/drivers/sdma.h index f084551d9..b00cf8931 100644 --- a/src/include/sof/drivers/sdma.h +++ b/src/include/sof/drivers/sdma.h @@ -89,6 +89,9 @@ #define SDMA_DONE0_CONFIG 0x1000 #define SDMA_DONE1_CONFIG 0x1004 +#define SDMA_DONE0_CONFIG_DONE_SEL BIT(7) +#define SDMA_DONE0_CONFIG_DONE_DIS BIT(6) + #define SDMA_WATERMARK_LEVEL_N_FIFOS(x) SET_BITS(15, 12, x) #define SDMA_WATERMARK_LEVEL_OFF_FIFOS(x) SET_BITS(19, 16, x) #define SDMA_WATERMARK_LEVEL_WORDS_PER_FIFO(x) SET_BITS(31, 28, x)