Lines Matching refs:xc
117 uniphier_xdmac_next_desc(struct uniphier_xdmac_chan *xc) in uniphier_xdmac_next_desc() argument
121 vd = vchan_next_desc(&xc->vc); in uniphier_xdmac_next_desc()
131 static void uniphier_xdmac_chan_start(struct uniphier_xdmac_chan *xc, in uniphier_xdmac_chan_start() argument
151 buswidth = xc->sconfig.src_addr_width; in uniphier_xdmac_chan_start()
160 buswidth = xc->sconfig.dst_addr_width; in uniphier_xdmac_chan_start()
169 val |= FIELD_PREP(XDMAC_TFA_MASK, xc->req_factor); in uniphier_xdmac_chan_start()
170 writel(val, xc->reg_ch_base + XDMAC_TFA); in uniphier_xdmac_chan_start()
173 writel(lower_32_bits(src_addr), xc->reg_ch_base + XDMAC_SAD); in uniphier_xdmac_chan_start()
174 writel(upper_32_bits(src_addr), xc->reg_ch_base + XDMAC_EXSAD); in uniphier_xdmac_chan_start()
176 writel(lower_32_bits(dst_addr), xc->reg_ch_base + XDMAC_DAD); in uniphier_xdmac_chan_start()
177 writel(upper_32_bits(dst_addr), xc->reg_ch_base + XDMAC_EXDAD); in uniphier_xdmac_chan_start()
181 writel(src_mode, xc->reg_ch_base + XDMAC_SADM); in uniphier_xdmac_chan_start()
182 writel(dst_mode, xc->reg_ch_base + XDMAC_DADM); in uniphier_xdmac_chan_start()
184 writel(its, xc->reg_ch_base + XDMAC_ITS); in uniphier_xdmac_chan_start()
185 writel(tnum, xc->reg_ch_base + XDMAC_TNUM); in uniphier_xdmac_chan_start()
189 xc->reg_ch_base + XDMAC_IEN); in uniphier_xdmac_chan_start()
192 val = readl(xc->reg_ch_base + XDMAC_TSS); in uniphier_xdmac_chan_start()
194 writel(val, xc->reg_ch_base + XDMAC_TSS); in uniphier_xdmac_chan_start()
198 static int uniphier_xdmac_chan_stop(struct uniphier_xdmac_chan *xc) in uniphier_xdmac_chan_stop() argument
203 val = readl(xc->reg_ch_base + XDMAC_IEN); in uniphier_xdmac_chan_stop()
205 writel(val, xc->reg_ch_base + XDMAC_IEN); in uniphier_xdmac_chan_stop()
208 val = readl(xc->reg_ch_base + XDMAC_TSS); in uniphier_xdmac_chan_stop()
210 writel(0, xc->reg_ch_base + XDMAC_TSS); in uniphier_xdmac_chan_stop()
213 return readl_poll_timeout_atomic(xc->reg_ch_base + XDMAC_STAT, val, in uniphier_xdmac_chan_stop()
218 static void uniphier_xdmac_start(struct uniphier_xdmac_chan *xc) in uniphier_xdmac_start() argument
222 xd = uniphier_xdmac_next_desc(xc); in uniphier_xdmac_start()
224 uniphier_xdmac_chan_start(xc, xd); in uniphier_xdmac_start()
227 xc->xd = xd; in uniphier_xdmac_start()
230 static void uniphier_xdmac_chan_irq(struct uniphier_xdmac_chan *xc) in uniphier_xdmac_chan_irq() argument
235 spin_lock(&xc->vc.lock); in uniphier_xdmac_chan_irq()
237 stat = readl(xc->reg_ch_base + XDMAC_ID); in uniphier_xdmac_chan_irq()
240 ret = uniphier_xdmac_chan_stop(xc); in uniphier_xdmac_chan_irq()
242 dev_err(xc->xdev->ddev.dev, in uniphier_xdmac_chan_irq()
245 dev_err(xc->xdev->ddev.dev, in uniphier_xdmac_chan_irq()
248 } else if ((stat & XDMAC_ID_ENDIDF) && xc->xd) { in uniphier_xdmac_chan_irq()
249 xc->xd->cur_node++; in uniphier_xdmac_chan_irq()
250 if (xc->xd->cur_node >= xc->xd->nr_node) { in uniphier_xdmac_chan_irq()
251 vchan_cookie_complete(&xc->xd->vd); in uniphier_xdmac_chan_irq()
252 uniphier_xdmac_start(xc); in uniphier_xdmac_chan_irq()
254 uniphier_xdmac_chan_start(xc, xc->xd); in uniphier_xdmac_chan_irq()
259 writel(stat, xc->reg_ch_base + XDMAC_IR); in uniphier_xdmac_chan_irq()
261 spin_unlock(&xc->vc.lock); in uniphier_xdmac_chan_irq()
325 struct uniphier_xdmac_chan *xc = to_uniphier_xdmac_chan(vc); in uniphier_xdmac_prep_slave_sg() local
336 buswidth = xc->sconfig.src_addr_width; in uniphier_xdmac_prep_slave_sg()
337 maxburst = xc->sconfig.src_maxburst; in uniphier_xdmac_prep_slave_sg()
339 buswidth = xc->sconfig.dst_addr_width; in uniphier_xdmac_prep_slave_sg()
340 maxburst = xc->sconfig.dst_maxburst; in uniphier_xdmac_prep_slave_sg()
345 if (maxburst > xc->xdev->ddev.max_burst) { in uniphier_xdmac_prep_slave_sg()
346 dev_err(xc->xdev->ddev.dev, in uniphier_xdmac_prep_slave_sg()
358 ? xc->sconfig.src_addr : sg_dma_address(sg); in uniphier_xdmac_prep_slave_sg()
360 ? xc->sconfig.dst_addr : sg_dma_address(sg); in uniphier_xdmac_prep_slave_sg()
374 dev_err(xc->xdev->ddev.dev, in uniphier_xdmac_prep_slave_sg()
381 dev_err(xc->xdev->ddev.dev, in uniphier_xdmac_prep_slave_sg()
398 struct uniphier_xdmac_chan *xc = to_uniphier_xdmac_chan(vc); in uniphier_xdmac_slave_config() local
400 memcpy(&xc->sconfig, config, sizeof(*config)); in uniphier_xdmac_slave_config()
408 struct uniphier_xdmac_chan *xc = to_uniphier_xdmac_chan(vc); in uniphier_xdmac_terminate_all() local
415 if (xc->xd) { in uniphier_xdmac_terminate_all()
416 vchan_terminate_vdesc(&xc->xd->vd); in uniphier_xdmac_terminate_all()
417 xc->xd = NULL; in uniphier_xdmac_terminate_all()
418 ret = uniphier_xdmac_chan_stop(xc); in uniphier_xdmac_terminate_all()
438 struct uniphier_xdmac_chan *xc = to_uniphier_xdmac_chan(vc); in uniphier_xdmac_issue_pending() local
443 if (vchan_issue_pending(vc) && !xc->xd) in uniphier_xdmac_issue_pending()
444 uniphier_xdmac_start(xc); in uniphier_xdmac_issue_pending()
457 struct uniphier_xdmac_chan *xc = &xdev->channels[ch]; in uniphier_xdmac_chan_init() local
459 xc->xdev = xdev; in uniphier_xdmac_chan_init()
460 xc->reg_ch_base = xdev->reg_base + XDMAC_CH_WIDTH * ch; in uniphier_xdmac_chan_init()
461 xc->vc.desc_free = uniphier_xdmac_desc_free; in uniphier_xdmac_chan_init()
463 vchan_init(&xc->vc, &xdev->ddev); in uniphier_xdmac_chan_init()