Lines Matching refs:mc
88 uniphier_mdmac_next_desc(struct uniphier_mdmac_chan *mc) in uniphier_mdmac_next_desc() argument
92 vd = vchan_next_desc(&mc->vc); in uniphier_mdmac_next_desc()
94 mc->md = NULL; in uniphier_mdmac_next_desc()
100 mc->md = to_uniphier_mdmac_desc(vd); in uniphier_mdmac_next_desc()
102 return mc->md; in uniphier_mdmac_next_desc()
106 static void uniphier_mdmac_handle(struct uniphier_mdmac_chan *mc, in uniphier_mdmac_handle() argument
109 struct uniphier_mdmac_device *mdev = mc->mdev; in uniphier_mdmac_handle()
130 writel(src_mode, mc->reg_ch_base + UNIPHIER_MDMAC_CH_SRC_MODE); in uniphier_mdmac_handle()
131 writel(dest_mode, mc->reg_ch_base + UNIPHIER_MDMAC_CH_DEST_MODE); in uniphier_mdmac_handle()
132 writel(src_addr, mc->reg_ch_base + UNIPHIER_MDMAC_CH_SRC_ADDR); in uniphier_mdmac_handle()
133 writel(dest_addr, mc->reg_ch_base + UNIPHIER_MDMAC_CH_DEST_ADDR); in uniphier_mdmac_handle()
134 writel(chunk_size, mc->reg_ch_base + UNIPHIER_MDMAC_CH_SIZE); in uniphier_mdmac_handle()
137 writel(irq_flag, mc->reg_ch_base + UNIPHIER_MDMAC_CH_IRQ_REQ); in uniphier_mdmac_handle()
139 writel(irq_flag, mc->reg_ch_base + UNIPHIER_MDMAC_CH_IRQ_EN); in uniphier_mdmac_handle()
141 writel(BIT(mc->chan_id), mdev->reg_base + UNIPHIER_MDMAC_CMD); in uniphier_mdmac_handle()
145 static void uniphier_mdmac_start(struct uniphier_mdmac_chan *mc) in uniphier_mdmac_start() argument
149 md = uniphier_mdmac_next_desc(mc); in uniphier_mdmac_start()
151 uniphier_mdmac_handle(mc, md); in uniphier_mdmac_start()
155 static int uniphier_mdmac_abort(struct uniphier_mdmac_chan *mc) in uniphier_mdmac_abort() argument
157 struct uniphier_mdmac_device *mdev = mc->mdev; in uniphier_mdmac_abort()
162 writel(irq_flag, mc->reg_ch_base + UNIPHIER_MDMAC_CH_IRQ_REQ); in uniphier_mdmac_abort()
164 writel(UNIPHIER_MDMAC_CMD_ABORT | BIT(mc->chan_id), in uniphier_mdmac_abort()
171 return readl_poll_timeout(mc->reg_ch_base + UNIPHIER_MDMAC_CH_IRQ_REQ, in uniphier_mdmac_abort()
177 struct uniphier_mdmac_chan *mc = dev_id; in uniphier_mdmac_interrupt() local
182 spin_lock(&mc->vc.lock); in uniphier_mdmac_interrupt()
184 irq_stat = readl(mc->reg_ch_base + UNIPHIER_MDMAC_CH_IRQ_DET); in uniphier_mdmac_interrupt()
196 writel(irq_stat, mc->reg_ch_base + UNIPHIER_MDMAC_CH_IRQ_REQ); in uniphier_mdmac_interrupt()
203 md = mc->md; in uniphier_mdmac_interrupt()
211 md = uniphier_mdmac_next_desc(mc); in uniphier_mdmac_interrupt()
216 uniphier_mdmac_handle(mc, md); in uniphier_mdmac_interrupt()
219 spin_unlock(&mc->vc.lock); in uniphier_mdmac_interrupt()
255 struct uniphier_mdmac_chan *mc = to_uniphier_mdmac_chan(vc); in uniphier_mdmac_terminate_all() local
262 if (mc->md) { in uniphier_mdmac_terminate_all()
263 vchan_terminate_vdesc(&mc->md->vd); in uniphier_mdmac_terminate_all()
264 mc->md = NULL; in uniphier_mdmac_terminate_all()
265 ret = uniphier_mdmac_abort(mc); in uniphier_mdmac_terminate_all()
287 struct uniphier_mdmac_chan *mc; in uniphier_mdmac_tx_status() local
302 mc = to_uniphier_mdmac_chan(vc); in uniphier_mdmac_tx_status()
304 if (mc->md && mc->md->vd.tx.cookie == cookie) { in uniphier_mdmac_tx_status()
306 txstate->residue = readl(mc->reg_ch_base + in uniphier_mdmac_tx_status()
308 md = mc->md; in uniphier_mdmac_tx_status()
331 struct uniphier_mdmac_chan *mc = to_uniphier_mdmac_chan(vc); in uniphier_mdmac_issue_pending() local
336 if (vchan_issue_pending(vc) && !mc->md) in uniphier_mdmac_issue_pending()
337 uniphier_mdmac_start(mc); in uniphier_mdmac_issue_pending()
352 struct uniphier_mdmac_chan *mc = &mdev->channels[chan_id]; in uniphier_mdmac_chan_init() local
366 IRQF_SHARED, irq_name, mc); in uniphier_mdmac_chan_init()
370 mc->mdev = mdev; in uniphier_mdmac_chan_init()
371 mc->reg_ch_base = mdev->reg_base + UNIPHIER_MDMAC_CH_OFFSET + in uniphier_mdmac_chan_init()
373 mc->chan_id = chan_id; in uniphier_mdmac_chan_init()
374 mc->vc.desc_free = uniphier_mdmac_desc_free; in uniphier_mdmac_chan_init()
375 vchan_init(&mc->vc, &mdev->ddev); in uniphier_mdmac_chan_init()