Skip to content

Commit

Permalink
drivers: imx: Select DONE bit from software
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dbaluta committed Oct 16, 2023
1 parent 4c7b69b commit 8819667
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/drivers/imx/sdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,22 @@ 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)
return; /* No change if request is invalid */

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)
Expand Down
3 changes: 3 additions & 0 deletions src/include/sof/drivers/sdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8819667

Please sign in to comment.