On Fri, Dec 12, 2025 at 05:24:47PM -0500, Frank Li wrote: > Introduce a new callback to fill a link list entry, preparing for the > future replacement of dw_(edma|hdma)_v0_core_start(). >
You are introducing 4 new callbacks for different purposes. > Filling link entries will become more complex, and both the EDMA and HDMA > paths would otherwise need to duplicate the same logic. Add a fill-entry > callback so that common code can be moved into dw-edma-core.c and shared > cleanly. > > Signed-off-by: Frank Li <[email protected]> > --- > drivers/dma/dw-edma/dw-edma-core.h | 31 +++++++++++++++++++++++ > drivers/dma/dw-edma/dw-edma-v0-core.c | 46 > +++++++++++++++++++++++++++++++++++ > drivers/dma/dw-edma/dw-hdma-v0-core.c | 38 +++++++++++++++++++++++++++++ > 3 files changed, 115 insertions(+) > > diff --git a/drivers/dma/dw-edma/dw-edma-core.h > b/drivers/dma/dw-edma/dw-edma-core.h > index > e074a6375f8a6853c212e65d2d54cb3e614b1483..2b5defae133c360f142394f9fab35c4748a893da > 100644 > --- a/drivers/dma/dw-edma/dw-edma-core.h > +++ b/drivers/dma/dw-edma/dw-edma-core.h > @@ -125,6 +125,12 @@ struct dw_edma_core_ops { > 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 (*ll_data)(struct dw_edma_chan *chan, struct dw_edma_burst *burst, > + u32 idx, bool cb, bool irq); > + void (*ll_link)(struct dw_edma_chan *chan, u32 idx, bool cb, u64 addr); > + void (*ch_doorbell)(struct dw_edma_chan *chan); > + void (*ch_enable)(struct dw_edma_chan *chan); > + > void (*ch_config)(struct dw_edma_chan *chan); > void (*debugfs_on)(struct dw_edma *dw); > }; > @@ -201,6 +207,31 @@ void dw_edma_core_ch_config(struct dw_edma_chan *chan) > chan->dw->core->ch_config(chan); > } > > +static inline void No inline please. - Mani > +dw_edma_core_ll_data(struct dw_edma_chan *chan, struct dw_edma_burst *burst, > + u32 idx, bool cb, bool irq) > +{ > + chan->dw->core->ll_data(chan, burst, idx, cb, irq); > +} > + > +static inline void > +dw_edma_core_ll_link(struct dw_edma_chan *chan, u32 idx, bool cb, u64 addr) > +{ > + chan->dw->core->ll_link(chan, idx, cb, addr); > +} > + > +static inline > +void dw_edma_core_ch_doorbell(struct dw_edma_chan *chan) > +{ > + chan->dw->core->ch_doorbell(chan); > +} > + > +static inline > +void dw_edma_core_ch_enable(struct dw_edma_chan *chan) > +{ > + chan->dw->core->ch_enable(chan); > +} > + > static inline > void dw_edma_core_debugfs_on(struct dw_edma *dw) > { > diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c > b/drivers/dma/dw-edma/dw-edma-v0-core.c > index > cd99bb34452d19eb9fd04b237609545ab1092eaa..59ee219f1abddd48806dec953ce96afdc87ffdab > 100644 > --- a/drivers/dma/dw-edma/dw-edma-v0-core.c > +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c > @@ -509,6 +509,48 @@ static void dw_edma_v0_core_ch_config(struct > dw_edma_chan *chan) > } > } > > +static void > +dw_edma_v0_core_ll_data(struct dw_edma_chan *chan, struct dw_edma_burst > *burst, > + u32 idx, bool cb, bool irq) > +{ > + u32 control = 0; > + > + if (cb) > + control |= DW_EDMA_V0_CB; > + > + if (irq) { > + 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, idx, control, burst->sz, burst->sar, > + burst->dar); > +} > + > +static void > +dw_edma_v0_core_ll_link(struct dw_edma_chan *chan, u32 idx, bool cb, u64 > addr) > +{ > + u32 control = DW_EDMA_V0_LLP | DW_EDMA_V0_TCB; > + > + if (!cb) > + control |= DW_EDMA_V0_CB; > + > + dw_edma_v0_write_ll_link(chan, idx, control, chan->ll_region.paddr); > +} > + > +static void dw_edma_v0_core_ch_doorbell(struct dw_edma_chan *chan) > +{ > + struct dw_edma *dw = chan->dw; > + > + dw_edma_v0_sync_ll_data(chan); > + > + /* Doorbell */ > + SET_RW_32(dw, chan->dir, doorbell, > + FIELD_PREP(EDMA_V0_DOORBELL_CH_MASK, chan->id)); > +} > + > /* eDMA debugfs callbacks */ > static void dw_edma_v0_core_debugfs_on(struct dw_edma *dw) > { > @@ -521,6 +563,10 @@ static const struct dw_edma_core_ops dw_edma_v0_core = { > .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, > + .ch_enable = dw_edma_v0_core_ch_enable, > .ch_config = dw_edma_v0_core_ch_config, > .debugfs_on = dw_edma_v0_core_debugfs_on, > }; > diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c > b/drivers/dma/dw-edma/dw-hdma-v0-core.c > index > 953868ef424250c1b696b9e61b72ba9a9c7c38c9..94350bb2bdcd6e29d8a42380160a5bd77caf4680 > 100644 > --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c > +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c > @@ -287,6 +287,40 @@ static void dw_hdma_v0_core_ch_config(struct > dw_edma_chan *chan) > SET_CH_32(dw, chan->dir, chan->id, msi_msgdata, chan->msi.data); > } > > +static void > +dw_hdma_v0_core_ll_data(struct dw_edma_chan *chan, struct dw_edma_burst > *burst, > + u32 idx, bool cb, bool irq) > +{ > + u32 control = 0; > + > + if (cb) > + control |= DW_HDMA_V0_CB; > + > + dw_hdma_v0_write_ll_data(chan, idx, control, burst->sz, burst->sar, > + burst->dar); > +} > + > +static void > +dw_hdma_v0_core_ll_link(struct dw_edma_chan *chan, u32 idx, bool cb, u64 > addr) > +{ > + u32 control = DW_HDMA_V0_LLP | DW_HDMA_V0_TCB; > + > + if (!cb) > + control |= DW_HDMA_V0_CB; > + > + dw_hdma_v0_write_ll_link(chan, idx, control, chan->ll_region.paddr); > +} > + > +static void dw_hdma_v0_core_ch_doorbell(struct dw_edma_chan *chan) > +{ > + struct dw_edma *dw = chan->dw; > + > + dw_hdma_v0_sync_ll_data(chan); > + > + /* Doorbell */ > + SET_CH_32(dw, chan->dir, chan->id, doorbell, HDMA_V0_DOORBELL_START); > +} > + > /* HDMA debugfs callbacks */ > static void dw_hdma_v0_core_debugfs_on(struct dw_edma *dw) > { > @@ -299,6 +333,10 @@ static const struct dw_edma_core_ops dw_hdma_v0_core = { > .ch_status = dw_hdma_v0_core_ch_status, > .handle_int = dw_hdma_v0_core_handle_int, > .start = dw_hdma_v0_core_start, > + .ll_data = dw_hdma_v0_core_ll_data, > + .ll_link = dw_hdma_v0_core_ll_link, > + .ch_doorbell = dw_hdma_v0_core_ch_doorbell, > + .ch_enable = dw_hdma_v0_core_ch_enable, > .ch_config = dw_hdma_v0_core_ch_config, > .debugfs_on = dw_hdma_v0_core_debugfs_on, > }; > > -- > 2.34.1 > -- மணிவண்ணன் சதாசிவம்
