Lines Matching refs:phy
221 struct s3c24xx_dma_phy *phy; member
255 static int s3c24xx_dma_phy_busy(struct s3c24xx_dma_phy *phy) in s3c24xx_dma_phy_busy() argument
257 unsigned int val = readl(phy->base + S3C24XX_DSTAT); in s3c24xx_dma_phy_busy()
262 struct s3c24xx_dma_phy *phy) in s3c24xx_dma_phy_valid() argument
277 phyvalid = (cdata->chansel >> (phy->id * S3C24XX_CHANSEL_WIDTH)); in s3c24xx_dma_phy_valid()
294 struct s3c24xx_dma_phy *phy = NULL; in s3c24xx_dma_get_phy() local
303 phy = &s3cdma->phy_chans[i]; in s3c24xx_dma_get_phy()
305 if (!phy->valid) in s3c24xx_dma_get_phy()
308 if (!s3c24xx_dma_phy_valid(s3cchan, phy)) in s3c24xx_dma_get_phy()
311 spin_lock_irqsave(&phy->lock, flags); in s3c24xx_dma_get_phy()
313 if (!phy->serving) { in s3c24xx_dma_get_phy()
314 phy->serving = s3cchan; in s3c24xx_dma_get_phy()
315 spin_unlock_irqrestore(&phy->lock, flags); in s3c24xx_dma_get_phy()
319 spin_unlock_irqrestore(&phy->lock, flags); in s3c24xx_dma_get_phy()
330 ret = clk_enable(phy->clk); in s3c24xx_dma_get_phy()
333 phy->id, ret); in s3c24xx_dma_get_phy()
334 phy->serving = NULL; in s3c24xx_dma_get_phy()
339 return phy; in s3c24xx_dma_get_phy()
347 static inline void s3c24xx_dma_put_phy(struct s3c24xx_dma_phy *phy) in s3c24xx_dma_put_phy() argument
349 struct s3c24xx_dma_engine *s3cdma = phy->host; in s3c24xx_dma_put_phy()
352 clk_disable(phy->clk); in s3c24xx_dma_put_phy()
354 phy->serving = NULL; in s3c24xx_dma_put_phy()
363 static void s3c24xx_dma_terminate_phy(struct s3c24xx_dma_phy *phy) in s3c24xx_dma_terminate_phy() argument
365 writel(S3C24XX_DMASKTRIG_STOP, phy->base + S3C24XX_DMASKTRIG); in s3c24xx_dma_terminate_phy()
380 struct s3c24xx_dma_phy *phy = s3cchan->phy; in s3c24xx_dma_getbytes_chan() local
382 u32 tc = readl(phy->base + S3C24XX_DSTAT) & S3C24XX_DSTAT_CURRTC_MASK; in s3c24xx_dma_getbytes_chan()
451 struct s3c24xx_dma_phy *phy = s3cchan->phy; in s3c24xx_dma_start_next_sg() local
477 phy->base + S3C24XX_DMAREQSEL); in s3c24xx_dma_start_next_sg()
479 int csel = cdata->chansel >> (phy->id * in s3c24xx_dma_start_next_sg()
488 writel_relaxed(0, phy->base + S3C24XX_DMAREQSEL); in s3c24xx_dma_start_next_sg()
491 writel_relaxed(dsg->src_addr, phy->base + S3C24XX_DISRC); in s3c24xx_dma_start_next_sg()
492 writel_relaxed(txd->disrcc, phy->base + S3C24XX_DISRCC); in s3c24xx_dma_start_next_sg()
493 writel_relaxed(dsg->dst_addr, phy->base + S3C24XX_DIDST); in s3c24xx_dma_start_next_sg()
494 writel_relaxed(txd->didstc, phy->base + S3C24XX_DIDSTC); in s3c24xx_dma_start_next_sg()
495 writel_relaxed(dcon, phy->base + S3C24XX_DCON); in s3c24xx_dma_start_next_sg()
497 val = readl_relaxed(phy->base + S3C24XX_DMASKTRIG); in s3c24xx_dma_start_next_sg()
505 writel(val, phy->base + S3C24XX_DMASKTRIG); in s3c24xx_dma_start_next_sg()
513 struct s3c24xx_dma_phy *phy = s3cchan->phy; in s3c24xx_dma_start_next_txd() local
522 while (s3c24xx_dma_phy_busy(phy)) in s3c24xx_dma_start_next_txd()
547 struct s3c24xx_dma_phy *phy; in s3c24xx_dma_phy_alloc_and_start() local
549 phy = s3c24xx_dma_get_phy(s3cchan); in s3c24xx_dma_phy_alloc_and_start()
550 if (!phy) { in s3c24xx_dma_phy_alloc_and_start()
558 phy->id, s3cchan->name); in s3c24xx_dma_phy_alloc_and_start()
560 s3cchan->phy = phy; in s3c24xx_dma_phy_alloc_and_start()
566 static void s3c24xx_dma_phy_reassign_start(struct s3c24xx_dma_phy *phy, in s3c24xx_dma_phy_reassign_start() argument
572 phy->id, s3cchan->name); in s3c24xx_dma_phy_reassign_start()
579 phy->serving = s3cchan; in s3c24xx_dma_phy_reassign_start()
580 s3cchan->phy = phy; in s3c24xx_dma_phy_reassign_start()
608 s3c24xx_dma_phy_valid(p, s3cchan->phy)) { in s3c24xx_dma_phy_free()
615 s3c24xx_dma_terminate_phy(s3cchan->phy); in s3c24xx_dma_phy_free()
628 s3c24xx_dma_phy_reassign_start(s3cchan->phy, next); in s3c24xx_dma_phy_free()
636 s3c24xx_dma_put_phy(s3cchan->phy); in s3c24xx_dma_phy_free()
639 s3cchan->phy = NULL; in s3c24xx_dma_phy_free()
656 struct s3c24xx_dma_phy *phy = data; in s3c24xx_dma_irq() local
657 struct s3c24xx_dma_chan *s3cchan = phy->serving; in s3c24xx_dma_irq()
660 dev_dbg(&phy->host->pdev->dev, "interrupt on channel %d\n", phy->id); in s3c24xx_dma_irq()
670 dev_err(&phy->host->pdev->dev, "interrupt on unused channel %d\n", in s3c24xx_dma_irq()
671 phy->id); in s3c24xx_dma_irq()
673 s3c24xx_dma_terminate_phy(phy); in s3c24xx_dma_irq()
725 if (!s3cchan->phy && !s3cchan->at) { in s3c24xx_dma_terminate_all()
735 if (s3cchan->phy) in s3c24xx_dma_terminate_all()
1079 if (!s3cchan->phy && s3cchan->state != S3C24XX_DMA_CHAN_WAITING) in s3c24xx_dma_issue_pending()
1238 struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i]; in s3c24xx_dma_probe() local
1241 phy->id = i; in s3c24xx_dma_probe()
1242 phy->base = s3cdma->base + (i * sdata->stride); in s3c24xx_dma_probe()
1243 phy->host = s3cdma; in s3c24xx_dma_probe()
1245 phy->irq = platform_get_irq(pdev, i); in s3c24xx_dma_probe()
1246 if (phy->irq < 0) { in s3c24xx_dma_probe()
1248 i, phy->irq); in s3c24xx_dma_probe()
1252 ret = devm_request_irq(&pdev->dev, phy->irq, s3c24xx_dma_irq, in s3c24xx_dma_probe()
1253 0, pdev->name, phy); in s3c24xx_dma_probe()
1262 phy->clk = devm_clk_get(&pdev->dev, clk_name); in s3c24xx_dma_probe()
1263 if (IS_ERR(phy->clk) && sdata->has_clocks) { in s3c24xx_dma_probe()
1265 i, PTR_ERR(phy->clk)); in s3c24xx_dma_probe()
1269 ret = clk_prepare(phy->clk); in s3c24xx_dma_probe()
1277 spin_lock_init(&phy->lock); in s3c24xx_dma_probe()
1278 phy->valid = true; in s3c24xx_dma_probe()
1281 i, s3c24xx_dma_phy_busy(phy) ? "BUSY" : "FREE"); in s3c24xx_dma_probe()
1361 struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i]; in s3c24xx_dma_probe() local
1362 if (phy->valid) in s3c24xx_dma_probe()
1363 clk_unprepare(phy->clk); in s3c24xx_dma_probe()
1384 struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i]; in s3c24xx_dma_remove() local
1385 if (phy->valid) in s3c24xx_dma_remove()
1386 clk_unprepare(phy->clk); in s3c24xx_dma_remove()