Lines Matching full:dw

13 #include "dw-edma-core.h"
14 #include "dw-edma-v0-core.h"
15 #include "dw-edma-v0-regs.h"
16 #include "dw-edma-v0-debugfs.h"
28 static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) in __dw_regs() argument
30 return dw->chip->reg_base; in __dw_regs()
33 #define SET_32(dw, name, value) \ argument
34 writel(value, &(__dw_regs(dw)->name))
36 #define GET_32(dw, name) \ argument
37 readl(&(__dw_regs(dw)->name))
39 #define SET_RW_32(dw, dir, name, value) \ argument
42 SET_32(dw, wr_##name, value); \
44 SET_32(dw, rd_##name, value); \
47 #define GET_RW_32(dw, dir, name) \ argument
49 ? GET_32(dw, wr_##name) \
50 : GET_32(dw, rd_##name))
52 #define SET_BOTH_32(dw, name, value) \ argument
54 SET_32(dw, wr_##name, value); \
55 SET_32(dw, rd_##name, value); \
58 #define SET_64(dw, name, value) \ argument
59 writeq(value, &(__dw_regs(dw)->name))
61 #define GET_64(dw, name) \ argument
62 readq(&(__dw_regs(dw)->name))
64 #define SET_RW_64(dw, dir, name, value) \ argument
67 SET_64(dw, wr_##name, value); \
69 SET_64(dw, rd_##name, value); \
72 #define GET_RW_64(dw, dir, name) \ argument
74 ? GET_64(dw, wr_##name) \
75 : GET_64(dw, rd_##name))
77 #define SET_BOTH_64(dw, name, value) \ argument
79 SET_64(dw, wr_##name, value); \
80 SET_64(dw, rd_##name, value); \
83 #define SET_COMPAT(dw, name, value) \ argument
84 writel(value, &(__dw_regs(dw)->type.unroll.name))
86 #define SET_RW_COMPAT(dw, dir, name, value) \ argument
89 SET_COMPAT(dw, wr_##name, value); \
91 SET_COMPAT(dw, rd_##name, value); \
95 __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) in __dw_ch_regs() argument
97 if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) in __dw_ch_regs()
98 return &(__dw_regs(dw)->type.legacy.ch); in __dw_ch_regs()
101 return &__dw_regs(dw)->type.unroll.ch[ch].wr; in __dw_ch_regs()
103 return &__dw_regs(dw)->type.unroll.ch[ch].rd; in __dw_ch_regs()
106 static inline void writel_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, in writel_ch() argument
109 if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { in writel_ch()
113 raw_spin_lock_irqsave(&dw->lock, flags); in writel_ch()
120 &(__dw_regs(dw)->type.legacy.viewport_sel)); in writel_ch()
123 raw_spin_unlock_irqrestore(&dw->lock, flags); in writel_ch()
129 static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, in readl_ch() argument
134 if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { in readl_ch()
138 raw_spin_lock_irqsave(&dw->lock, flags); in readl_ch()
145 &(__dw_regs(dw)->type.legacy.viewport_sel)); in readl_ch()
148 raw_spin_unlock_irqrestore(&dw->lock, flags); in readl_ch()
156 #define SET_CH_32(dw, dir, ch, name, value) \ argument
157 writel_ch(dw, dir, ch, value, &(__dw_ch_regs(dw, dir, ch)->name))
159 #define GET_CH_32(dw, dir, ch, name) \ argument
160 readl_ch(dw, dir, ch, &(__dw_ch_regs(dw, dir, ch)->name))
163 static void dw_edma_v0_core_off(struct dw_edma *dw) in dw_edma_v0_core_off() argument
165 SET_BOTH_32(dw, int_mask, in dw_edma_v0_core_off()
167 SET_BOTH_32(dw, int_clear, in dw_edma_v0_core_off()
169 SET_BOTH_32(dw, engine_en, 0); in dw_edma_v0_core_off()
172 static u16 dw_edma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) in dw_edma_v0_core_ch_count() argument
178 GET_32(dw, ctrl)); in dw_edma_v0_core_ch_count()
181 GET_32(dw, ctrl)); in dw_edma_v0_core_ch_count()
191 struct dw_edma *dw = chan->dw; in dw_edma_v0_core_ch_status() local
195 GET_CH_32(dw, chan->dir, chan->id, ch_control1)); in dw_edma_v0_core_ch_status()
207 struct dw_edma *dw = chan->dw; in dw_edma_v0_core_clear_done_int() local
209 SET_RW_32(dw, chan->dir, int_clear, in dw_edma_v0_core_clear_done_int()
215 struct dw_edma *dw = chan->dw; in dw_edma_v0_core_clear_abort_int() local
217 SET_RW_32(dw, chan->dir, int_clear, in dw_edma_v0_core_clear_abort_int()
221 static u32 dw_edma_v0_core_status_done_int(struct dw_edma *dw, enum dw_edma_dir dir) in dw_edma_v0_core_status_done_int() argument
224 GET_RW_32(dw, dir, int_status)); in dw_edma_v0_core_status_done_int()
227 static u32 dw_edma_v0_core_status_abort_int(struct dw_edma *dw, enum dw_edma_dir dir) in dw_edma_v0_core_status_abort_int() argument
230 GET_RW_32(dw, dir, int_status)); in dw_edma_v0_core_status_abort_int()
237 struct dw_edma *dw = dw_irq->dw; in dw_edma_v0_core_handle_int() local
245 total = dw->wr_ch_cnt; in dw_edma_v0_core_handle_int()
249 total = dw->rd_ch_cnt; in dw_edma_v0_core_handle_int()
250 off = dw->wr_ch_cnt; in dw_edma_v0_core_handle_int()
254 val = dw_edma_v0_core_status_done_int(dw, dir); in dw_edma_v0_core_handle_int()
257 chan = &dw->chan[pos + off]; in dw_edma_v0_core_handle_int()
265 val = dw_edma_v0_core_status_abort_int(dw, dir); in dw_edma_v0_core_handle_int()
268 chan = &dw->chan[pos + off]; in dw_edma_v0_core_handle_int()
284 if (chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) { in dw_edma_v0_write_ll_data()
306 if (chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) { in dw_edma_v0_write_ll_link()
334 if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) in dw_edma_v0_core_write_chunk()
352 * In case of remote eDMA engine setup, the DW PCIe RP/EP internal in dw_edma_v0_sync_ll_data()
359 if (!(chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) in dw_edma_v0_sync_ll_data()
366 struct dw_edma *dw = chan->dw; in dw_edma_v0_core_start() local
373 SET_RW_32(dw, chan->dir, engine_en, BIT(0)); in dw_edma_v0_core_start()
374 if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { in dw_edma_v0_core_start()
377 SET_RW_COMPAT(dw, chan->dir, ch0_pwr_en, in dw_edma_v0_core_start()
381 SET_RW_COMPAT(dw, chan->dir, ch1_pwr_en, in dw_edma_v0_core_start()
385 SET_RW_COMPAT(dw, chan->dir, ch2_pwr_en, in dw_edma_v0_core_start()
389 SET_RW_COMPAT(dw, chan->dir, ch3_pwr_en, in dw_edma_v0_core_start()
393 SET_RW_COMPAT(dw, chan->dir, ch4_pwr_en, in dw_edma_v0_core_start()
397 SET_RW_COMPAT(dw, chan->dir, ch5_pwr_en, in dw_edma_v0_core_start()
401 SET_RW_COMPAT(dw, chan->dir, ch6_pwr_en, in dw_edma_v0_core_start()
405 SET_RW_COMPAT(dw, chan->dir, ch7_pwr_en, in dw_edma_v0_core_start()
411 tmp = GET_RW_32(dw, chan->dir, int_mask); in dw_edma_v0_core_start()
414 SET_RW_32(dw, chan->dir, int_mask, tmp); in dw_edma_v0_core_start()
416 tmp = GET_RW_32(dw, chan->dir, linked_list_err_en); in dw_edma_v0_core_start()
418 SET_RW_32(dw, chan->dir, linked_list_err_en, tmp); in dw_edma_v0_core_start()
420 SET_CH_32(dw, chan->dir, chan->id, ch_control1, in dw_edma_v0_core_start()
424 SET_CH_32(dw, chan->dir, chan->id, llp.lsb, in dw_edma_v0_core_start()
426 SET_CH_32(dw, chan->dir, chan->id, llp.msb, in dw_edma_v0_core_start()
433 SET_RW_32(dw, chan->dir, doorbell, in dw_edma_v0_core_start()
439 struct dw_edma *dw = chan->dw; in dw_edma_v0_core_ch_config() local
443 SET_RW_32(dw, chan->dir, done_imwr.lsb, chan->msi.address_lo); in dw_edma_v0_core_ch_config()
444 SET_RW_32(dw, chan->dir, done_imwr.msb, chan->msi.address_hi); in dw_edma_v0_core_ch_config()
446 SET_RW_32(dw, chan->dir, abort_imwr.lsb, chan->msi.address_lo); in dw_edma_v0_core_ch_config()
447 SET_RW_32(dw, chan->dir, abort_imwr.msb, chan->msi.address_hi); in dw_edma_v0_core_ch_config()
452 tmp = GET_RW_32(dw, chan->dir, ch01_imwr_data); in dw_edma_v0_core_ch_config()
457 tmp = GET_RW_32(dw, chan->dir, ch23_imwr_data); in dw_edma_v0_core_ch_config()
462 tmp = GET_RW_32(dw, chan->dir, ch45_imwr_data); in dw_edma_v0_core_ch_config()
467 tmp = GET_RW_32(dw, chan->dir, ch67_imwr_data); in dw_edma_v0_core_ch_config()
486 SET_RW_32(dw, chan->dir, ch01_imwr_data, tmp); in dw_edma_v0_core_ch_config()
491 SET_RW_32(dw, chan->dir, ch23_imwr_data, tmp); in dw_edma_v0_core_ch_config()
496 SET_RW_32(dw, chan->dir, ch45_imwr_data, tmp); in dw_edma_v0_core_ch_config()
501 SET_RW_32(dw, chan->dir, ch67_imwr_data, tmp); in dw_edma_v0_core_ch_config()
507 static void dw_edma_v0_core_debugfs_on(struct dw_edma *dw) in dw_edma_v0_core_debugfs_on() argument
509 dw_edma_v0_debugfs_on(dw); in dw_edma_v0_core_debugfs_on()
522 void dw_edma_v0_core_register(struct dw_edma *dw) in dw_edma_v0_core_register() argument
524 dw->core = &dw_edma_v0_core; in dw_edma_v0_core_register()