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 <daniel.baluta@nxp.com>
This commit is contained in:
Daniel Baluta 2023-10-13 15:23:17 +03:00 committed by Daniel Baluta
parent 4c7b69b1c4
commit 8819667b07
2 changed files with 12 additions and 0 deletions

View File

@ -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)

View File

@ -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)