mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
dmaengine: dw-edma: Use common dw_edma_core_start() for both eDMA and HDMA
Use common dw_edma_core_start() for both eDMA and HDMA. Remove .start() callback functions at eDMA and HDMA. Tested-by: Koichiro Den <den@valinux.co.jp> Tested-By: Devendra Verma <devendra.verma@amd.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260713-edma_ll-v7-8-6fb7498c901e@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
de60121a08
commit
0d7a2719d8
|
|
@ -163,9 +163,37 @@ static void vchan_free_desc(struct virt_dma_desc *vdesc)
|
|||
dw_edma_free_desc(vd2dw_edma_desc(vdesc));
|
||||
}
|
||||
|
||||
static void dw_edma_core_start(struct dw_edma_chunk *chunk, bool first)
|
||||
{
|
||||
struct dw_edma_chan *chan = chunk->chan;
|
||||
struct dw_edma_burst *child;
|
||||
u32 i = 0;
|
||||
int j;
|
||||
|
||||
if (chan->non_ll) {
|
||||
child = list_first_entry_or_null(&chunk->burst->list,
|
||||
struct dw_edma_burst, list);
|
||||
if (child)
|
||||
chan->dw->core->non_ll_start(chunk->chan, child);
|
||||
return;
|
||||
}
|
||||
|
||||
j = chunk->bursts_alloc;
|
||||
list_for_each_entry(child, &chunk->burst->list, list) {
|
||||
j--;
|
||||
dw_edma_core_ll_data(chan, child, i++, chunk->cb, !j);
|
||||
}
|
||||
|
||||
dw_edma_core_ll_link(chan, i, chunk->cb, chan->ll_region.paddr);
|
||||
|
||||
if (first)
|
||||
dw_edma_core_ch_enable(chan);
|
||||
|
||||
dw_edma_core_ch_doorbell(chan);
|
||||
}
|
||||
|
||||
static int dw_edma_start_transfer(struct dw_edma_chan *chan)
|
||||
{
|
||||
struct dw_edma *dw = chan->dw;
|
||||
struct dw_edma_chunk *child;
|
||||
struct dw_edma_desc *desc;
|
||||
struct virt_dma_desc *vd;
|
||||
|
|
@ -183,7 +211,7 @@ static int dw_edma_start_transfer(struct dw_edma_chan *chan)
|
|||
if (!child)
|
||||
return 0;
|
||||
|
||||
dw_edma_core_start(dw, child, !desc->xfer_sz);
|
||||
dw_edma_core_start(child, !desc->xfer_sz);
|
||||
desc->xfer_sz += child->xfer_sz;
|
||||
dw_edma_free_burst(child);
|
||||
list_del(&child->list);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ struct dw_edma_core_ops {
|
|||
enum dma_status (*ch_status)(struct dw_edma_chan *chan);
|
||||
irqreturn_t (*handle_int)(struct dw_edma_irq *dw_irq, enum dw_edma_dir dir,
|
||||
dw_edma_handler_t done, dw_edma_handler_t abort);
|
||||
void (*start)(struct dw_edma_chunk *chunk, bool first);
|
||||
void (*non_ll_start)(struct dw_edma_chan *chan, struct dw_edma_burst *child);
|
||||
void (*ll_data)(struct dw_edma_chan *chan, struct dw_edma_burst *burst,
|
||||
u32 idx, bool cb, bool irq);
|
||||
|
|
@ -199,21 +198,6 @@ dw_edma_core_handle_int(struct dw_edma_irq *dw_irq, enum dw_edma_dir dir,
|
|||
return dw_irq->dw->core->handle_int(dw_irq, dir, done, abort);
|
||||
}
|
||||
|
||||
static inline
|
||||
void dw_edma_core_start(struct dw_edma *dw, struct dw_edma_chunk *chunk, bool first)
|
||||
{
|
||||
if (chunk->chan->non_ll) {
|
||||
struct dw_edma_burst *child;
|
||||
|
||||
child = list_first_entry_or_null(&chunk->burst->list,
|
||||
struct dw_edma_burst, list);
|
||||
if (child)
|
||||
dw->core->non_ll_start(chunk->chan, child);
|
||||
} else {
|
||||
dw->core->start(chunk, first);
|
||||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
void dw_edma_core_ch_config(struct dw_edma_chan *chan)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -379,36 +379,6 @@ static void dw_edma_v0_core_ch_enable(struct dw_edma_chan *chan)
|
|||
upper_32_bits(chan->ll_region.paddr));
|
||||
}
|
||||
|
||||
static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk)
|
||||
{
|
||||
struct dw_edma_burst *child;
|
||||
struct dw_edma_chan *chan = chunk->chan;
|
||||
u32 control = 0, i = 0;
|
||||
int j;
|
||||
|
||||
if (chunk->cb)
|
||||
control = DW_EDMA_V0_CB;
|
||||
|
||||
j = chunk->bursts_alloc;
|
||||
list_for_each_entry(child, &chunk->burst->list, list) {
|
||||
j--;
|
||||
if (!j) {
|
||||
control |= DW_EDMA_V0_LIE;
|
||||
if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL))
|
||||
control |= DW_EDMA_V0_RIE;
|
||||
}
|
||||
|
||||
dw_edma_v0_write_ll_data(chan, i++, control, child->sz,
|
||||
child->sar, child->dar);
|
||||
}
|
||||
|
||||
control = DW_EDMA_V0_LLP | DW_EDMA_V0_TCB;
|
||||
if (!chunk->cb)
|
||||
control |= DW_EDMA_V0_CB;
|
||||
|
||||
dw_edma_v0_write_ll_link(chan, i, control, chan->ll_region.paddr);
|
||||
}
|
||||
|
||||
static void dw_edma_v0_sync_ll_data(struct dw_edma_chan *chan)
|
||||
{
|
||||
/*
|
||||
|
|
@ -423,23 +393,6 @@ static void dw_edma_v0_sync_ll_data(struct dw_edma_chan *chan)
|
|||
readl(chan->ll_region.vaddr.io);
|
||||
}
|
||||
|
||||
static void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
|
||||
{
|
||||
struct dw_edma_chan *chan = chunk->chan;
|
||||
struct dw_edma *dw = chan->dw;
|
||||
|
||||
dw_edma_v0_core_write_chunk(chunk);
|
||||
|
||||
if (first)
|
||||
dw_edma_v0_core_ch_enable(chan);
|
||||
|
||||
dw_edma_v0_sync_ll_data(chan);
|
||||
|
||||
/* Doorbell */
|
||||
SET_RW_32(dw, chan->dir, doorbell,
|
||||
FIELD_PREP(EDMA_V0_DOORBELL_CH_MASK, chan->id));
|
||||
}
|
||||
|
||||
static void dw_edma_v0_core_ch_config(struct dw_edma_chan *chan)
|
||||
{
|
||||
struct dw_edma *dw = chan->dw;
|
||||
|
|
@ -581,7 +534,6 @@ static const struct dw_edma_core_ops dw_edma_v0_core = {
|
|||
.ch_count = dw_edma_v0_core_ch_count,
|
||||
.ch_status = dw_edma_v0_core_ch_status,
|
||||
.handle_int = dw_edma_v0_core_handle_int,
|
||||
.start = dw_edma_v0_core_start,
|
||||
.ll_data = dw_edma_v0_core_ll_data,
|
||||
.ll_link = dw_edma_v0_core_ll_link,
|
||||
.ch_doorbell = dw_edma_v0_core_ch_doorbell,
|
||||
|
|
|
|||
|
|
@ -222,26 +222,6 @@ static void dw_hdma_v0_core_ch_enable(struct dw_edma_chan *chan)
|
|||
HDMA_V0_CONSUMER_CYCLE_STAT | HDMA_V0_CONSUMER_CYCLE_BIT);
|
||||
}
|
||||
|
||||
static void dw_hdma_v0_core_write_chunk(struct dw_edma_chunk *chunk)
|
||||
{
|
||||
struct dw_edma_chan *chan = chunk->chan;
|
||||
struct dw_edma_burst *child;
|
||||
u32 control = 0, i = 0;
|
||||
|
||||
if (chunk->cb)
|
||||
control = DW_HDMA_V0_CB;
|
||||
|
||||
list_for_each_entry(child, &chunk->burst->list, list)
|
||||
dw_hdma_v0_write_ll_data(chan, i++, control, child->sz,
|
||||
child->sar, child->dar);
|
||||
|
||||
control = DW_HDMA_V0_LLP | DW_HDMA_V0_TCB;
|
||||
if (!chunk->cb)
|
||||
control |= DW_HDMA_V0_CB;
|
||||
|
||||
dw_hdma_v0_write_ll_link(chan, i, control, chunk->chan->ll_region.paddr);
|
||||
}
|
||||
|
||||
static void dw_hdma_v0_sync_ll_data(struct dw_edma_chan *chan)
|
||||
{
|
||||
/*
|
||||
|
|
@ -256,22 +236,6 @@ static void dw_hdma_v0_sync_ll_data(struct dw_edma_chan *chan)
|
|||
readl(chan->ll_region.vaddr.io);
|
||||
}
|
||||
|
||||
static void dw_hdma_v0_core_ll_start(struct dw_edma_chunk *chunk, bool first)
|
||||
{
|
||||
struct dw_edma_chan *chan = chunk->chan;
|
||||
struct dw_edma *dw = chan->dw;
|
||||
|
||||
dw_hdma_v0_core_write_chunk(chunk);
|
||||
|
||||
if (first)
|
||||
dw_hdma_v0_core_ch_enable(chan);
|
||||
|
||||
dw_hdma_v0_sync_ll_data(chan);
|
||||
|
||||
/* Doorbell */
|
||||
SET_CH_32(dw, chan->dir, chan->id, doorbell, HDMA_V0_DOORBELL_START);
|
||||
}
|
||||
|
||||
static void dw_hdma_v0_core_non_ll_start(struct dw_edma_chan *chan,
|
||||
struct dw_edma_burst *child)
|
||||
{
|
||||
|
|
@ -383,7 +347,6 @@ static const struct dw_edma_core_ops dw_hdma_v0_core = {
|
|||
.ch_count = dw_hdma_v0_core_ch_count,
|
||||
.ch_status = dw_hdma_v0_core_ch_status,
|
||||
.handle_int = dw_hdma_v0_core_handle_int,
|
||||
.start = dw_hdma_v0_core_ll_start,
|
||||
.non_ll_start = dw_hdma_v0_core_non_ll_start,
|
||||
.ll_data = dw_hdma_v0_core_ll_data,
|
||||
.ll_link = dw_hdma_v0_core_ll_link,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user