diff options
| author | Koichiro Den <den@valinux.co.jp> | 2026-07-21 15:28:02 +0900 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-07-21 16:00:35 +0530 |
| commit | 3e5933f2003e89d733b8d3a3a026ab9af411fbb5 (patch) | |
| tree | 9176e43f0ddbf4e4b27f5bf0dd33d24e487d3e39 | |
| parent | 35de39e4511f00a87f814b5f0afeb082a8fbc5d7 (diff) | |
dmaengine: dw-edma: Factor out HDMA interrupt setup helper
The HDMA linked-list and non-linked-list start paths both program the
stop/abort interrupt setup register using the same local/remote enable
policy. Only the interrupt-mask handling differs by transfer mode.
Factor the common setup into dw_hdma_v0_core_int_setup() before adding
per-channel interrupt routing support. No functional change intended.
Suggested-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Link: https://patch.msgid.link/20260721062815.4117887-2-den@valinux.co.jp
Signed-off-by: Vinod Koul <vkoul@kernel.org>
| -rw-r--r-- | drivers/dma/dw-edma/dw-hdma-v0-core.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index fe64f9931bba..4df541bf34e4 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -49,6 +49,21 @@ __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) writel(value, &(__dw_ch_regs(dw, EDMA_DIR_READ, ch)->name)); \ } while (0) +static u32 dw_hdma_v0_core_int_setup(struct dw_edma_chan *chan, u32 val) +{ + if (chan->non_ll) + val |= HDMA_V0_STOP_INT_MASK | HDMA_V0_ABORT_INT_MASK; + else + val &= ~(HDMA_V0_STOP_INT_MASK | HDMA_V0_ABORT_INT_MASK); + + val |= HDMA_V0_LOCAL_STOP_INT_EN | HDMA_V0_LOCAL_ABORT_INT_EN; + if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + val |= HDMA_V0_REMOTE_STOP_INT_EN | + HDMA_V0_REMOTE_ABORT_INT_EN; + + return val; +} + /* HDMA management callbacks */ static void dw_hdma_v0_core_off(struct dw_edma *dw) { @@ -214,11 +229,7 @@ static void dw_hdma_v0_core_ch_enable(struct dw_edma_chan *chan) SET_CH_32(dw, chan->dir, chan->id, ch_en, BIT(0)); /* Interrupt unmask - stop, abort */ tmp = GET_CH_32(dw, chan->dir, chan->id, int_setup); - tmp &= ~(HDMA_V0_STOP_INT_MASK | HDMA_V0_ABORT_INT_MASK); - /* Interrupt enable - stop, abort */ - tmp |= HDMA_V0_LOCAL_STOP_INT_EN | HDMA_V0_LOCAL_ABORT_INT_EN; - if (!(dw->chip->flags & DW_EDMA_CHIP_LOCAL)) - tmp |= HDMA_V0_REMOTE_STOP_INT_EN | HDMA_V0_REMOTE_ABORT_INT_EN; + tmp = dw_hdma_v0_core_int_setup(chan, tmp); SET_CH_32(dw, chan->dir, chan->id, int_setup, tmp); /* Channel control */ SET_CH_32(dw, chan->dir, chan->id, control1, HDMA_V0_LINKLIST_EN); @@ -271,17 +282,8 @@ static void dw_hdma_v0_core_non_ll_start(struct dw_edma_chan *chan, SET_CH_32(dw, chan->dir, chan->id, transfer_size, child->sz); /* Interrupt setup */ - val = GET_CH_32(dw, chan->dir, chan->id, int_setup) | - HDMA_V0_STOP_INT_MASK | - HDMA_V0_ABORT_INT_MASK | - HDMA_V0_LOCAL_STOP_INT_EN | - HDMA_V0_LOCAL_ABORT_INT_EN; - - if (!(dw->chip->flags & DW_EDMA_CHIP_LOCAL)) { - val |= HDMA_V0_REMOTE_STOP_INT_EN | - HDMA_V0_REMOTE_ABORT_INT_EN; - } - + val = GET_CH_32(dw, chan->dir, chan->id, int_setup); + val = dw_hdma_v0_core_int_setup(chan, val); SET_CH_32(dw, chan->dir, chan->id, int_setup, val); /* Channel control setup */ |
