• Home
  • Raw
  • Download

Lines Matching refs:d

149 static void k3_dma_terminate_chan(struct k3_dma_phy *phy, struct k3_dma_dev *d)  in k3_dma_terminate_chan()  argument
156 writel_relaxed(val, d->base + INT_TC1_RAW); in k3_dma_terminate_chan()
157 writel_relaxed(val, d->base + INT_TC2_RAW); in k3_dma_terminate_chan()
158 writel_relaxed(val, d->base + INT_ERR1_RAW); in k3_dma_terminate_chan()
159 writel_relaxed(val, d->base + INT_ERR2_RAW); in k3_dma_terminate_chan()
171 static u32 k3_dma_get_curr_cnt(struct k3_dma_dev *d, struct k3_dma_phy *phy) in k3_dma_get_curr_cnt() argument
175 cnt = readl_relaxed(d->base + CX_CUR_CNT + phy->idx * 0x10); in k3_dma_get_curr_cnt()
185 static u32 k3_dma_get_chan_stat(struct k3_dma_dev *d) in k3_dma_get_chan_stat() argument
187 return readl_relaxed(d->base + CH_STAT); in k3_dma_get_chan_stat()
190 static void k3_dma_enable_dma(struct k3_dma_dev *d, bool on) in k3_dma_enable_dma() argument
194 writel_relaxed(0x0, d->base + CH_PRI); in k3_dma_enable_dma()
197 writel_relaxed(0xffff, d->base + INT_TC1_MASK); in k3_dma_enable_dma()
198 writel_relaxed(0xffff, d->base + INT_TC2_MASK); in k3_dma_enable_dma()
199 writel_relaxed(0xffff, d->base + INT_ERR1_MASK); in k3_dma_enable_dma()
200 writel_relaxed(0xffff, d->base + INT_ERR2_MASK); in k3_dma_enable_dma()
203 writel_relaxed(0x0, d->base + INT_TC1_MASK); in k3_dma_enable_dma()
204 writel_relaxed(0x0, d->base + INT_TC2_MASK); in k3_dma_enable_dma()
205 writel_relaxed(0x0, d->base + INT_ERR1_MASK); in k3_dma_enable_dma()
206 writel_relaxed(0x0, d->base + INT_ERR2_MASK); in k3_dma_enable_dma()
212 struct k3_dma_dev *d = (struct k3_dma_dev *)dev_id; in k3_dma_int_handler() local
215 u32 stat = readl_relaxed(d->base + INT_STAT); in k3_dma_int_handler()
216 u32 tc1 = readl_relaxed(d->base + INT_TC1); in k3_dma_int_handler()
217 u32 tc2 = readl_relaxed(d->base + INT_TC2); in k3_dma_int_handler()
218 u32 err1 = readl_relaxed(d->base + INT_ERR1); in k3_dma_int_handler()
219 u32 err2 = readl_relaxed(d->base + INT_ERR2); in k3_dma_int_handler()
228 p = &d->phy[i]; in k3_dma_int_handler()
248 dev_warn(d->slave.dev, "DMA ERR\n"); in k3_dma_int_handler()
251 writel_relaxed(irq_chan, d->base + INT_TC1_RAW); in k3_dma_int_handler()
252 writel_relaxed(irq_chan, d->base + INT_TC2_RAW); in k3_dma_int_handler()
253 writel_relaxed(err1, d->base + INT_ERR1_RAW); in k3_dma_int_handler()
254 writel_relaxed(err2, d->base + INT_ERR2_RAW); in k3_dma_int_handler()
257 tasklet_schedule(&d->task); in k3_dma_int_handler()
267 struct k3_dma_dev *d = to_k3_dma(c->vc.chan.device); in k3_dma_start_txd() local
273 if (BIT(c->phy->idx) & k3_dma_get_chan_stat(d)) in k3_dma_start_txd()
302 struct k3_dma_dev *d = from_tasklet(d, t, task); in k3_dma_tasklet() local
308 list_for_each_entry_safe(c, cn, &d->slave.channels, vc.chan.device_node) { in k3_dma_tasklet()
314 dev_dbg(d->slave.dev, "pchan %u: free\n", p->idx); in k3_dma_tasklet()
324 spin_lock_irq(&d->lock); in k3_dma_tasklet()
325 for (pch = 0; pch < d->dma_channels; pch++) { in k3_dma_tasklet()
326 if (!(d->dma_channel_mask & (1 << pch))) in k3_dma_tasklet()
329 p = &d->phy[pch]; in k3_dma_tasklet()
331 if (p->vchan == NULL && !list_empty(&d->chan_pending)) { in k3_dma_tasklet()
332 c = list_first_entry(&d->chan_pending, in k3_dma_tasklet()
340 dev_dbg(d->slave.dev, "pchan %u: alloc vchan %p\n", pch, &c->vc); in k3_dma_tasklet()
343 spin_unlock_irq(&d->lock); in k3_dma_tasklet()
345 for (pch = 0; pch < d->dma_channels; pch++) { in k3_dma_tasklet()
346 if (!(d->dma_channel_mask & (1 << pch))) in k3_dma_tasklet()
350 p = &d->phy[pch]; in k3_dma_tasklet()
364 struct k3_dma_dev *d = to_k3_dma(chan->device); in k3_dma_free_chan_resources() local
367 spin_lock_irqsave(&d->lock, flags); in k3_dma_free_chan_resources()
369 spin_unlock_irqrestore(&d->lock, flags); in k3_dma_free_chan_resources()
379 struct k3_dma_dev *d = to_k3_dma(chan->device); in k3_dma_tx_status() local
407 bytes = k3_dma_get_curr_cnt(d, p); in k3_dma_tx_status()
426 struct k3_dma_dev *d = to_k3_dma(chan->device); in k3_dma_issue_pending() local
432 spin_lock(&d->lock); in k3_dma_issue_pending()
436 list_add_tail(&c->node, &d->chan_pending); in k3_dma_issue_pending()
438 tasklet_schedule(&d->task); in k3_dma_issue_pending()
439 dev_dbg(d->slave.dev, "vchan %p: issued\n", &c->vc); in k3_dma_issue_pending()
442 spin_unlock(&d->lock); in k3_dma_issue_pending()
444 dev_dbg(d->slave.dev, "vchan %p: nothing to issue\n", &c->vc); in k3_dma_issue_pending()
467 struct k3_dma_dev *d = to_k3_dma(chan->device); in k3_dma_alloc_desc_resource() local
480 ds->desc_hw = dma_pool_zalloc(d->pool, GFP_NOWAIT, &ds->desc_hw_lli); in k3_dma_alloc_desc_resource()
715 struct k3_dma_dev *d = to_k3_dma(vd->tx.chan->device); in k3_dma_free_desc() local
717 dma_pool_free(d->pool, ds->desc_hw, ds->desc_hw_lli); in k3_dma_free_desc()
724 struct k3_dma_dev *d = to_k3_dma(chan->device); in k3_dma_terminate_all() local
729 dev_dbg(d->slave.dev, "vchan %p: terminate all\n", &c->vc); in k3_dma_terminate_all()
732 spin_lock(&d->lock); in k3_dma_terminate_all()
734 spin_unlock(&d->lock); in k3_dma_terminate_all()
741 k3_dma_terminate_chan(p, d); in k3_dma_terminate_all()
766 struct k3_dma_dev *d = to_k3_dma(chan->device); in k3_dma_transfer_pause() local
769 dev_dbg(d->slave.dev, "vchan %p: pause\n", &c->vc); in k3_dma_transfer_pause()
775 spin_lock(&d->lock); in k3_dma_transfer_pause()
777 spin_unlock(&d->lock); in k3_dma_transfer_pause()
787 struct k3_dma_dev *d = to_k3_dma(chan->device); in k3_dma_transfer_resume() local
791 dev_dbg(d->slave.dev, "vchan %p: resume\n", &c->vc); in k3_dma_transfer_resume()
798 spin_lock(&d->lock); in k3_dma_transfer_resume()
799 list_add_tail(&c->node, &d->chan_pending); in k3_dma_transfer_resume()
800 spin_unlock(&d->lock); in k3_dma_transfer_resume()
830 struct k3_dma_dev *d = ofdma->of_dma_data; in k3_of_dma_simple_xlate() local
833 if (request >= d->dma_requests) in k3_of_dma_simple_xlate()
836 return dma_get_slave_channel(&(d->chans[request].vc.chan)); in k3_of_dma_simple_xlate()
842 struct k3_dma_dev *d; in k3_dma_probe() local
846 d = devm_kzalloc(&op->dev, sizeof(*d), GFP_KERNEL); in k3_dma_probe()
847 if (!d) in k3_dma_probe()
854 d->base = devm_platform_ioremap_resource(op, 0); in k3_dma_probe()
855 if (IS_ERR(d->base)) in k3_dma_probe()
856 return PTR_ERR(d->base); in k3_dma_probe()
861 "dma-channels", &d->dma_channels); in k3_dma_probe()
863 "dma-requests", &d->dma_requests); in k3_dma_probe()
865 "dma-channel-mask", &d->dma_channel_mask); in k3_dma_probe()
869 d->dma_channel_mask = (u32)~0UL; in k3_dma_probe()
874 d->clk = devm_clk_get(&op->dev, NULL); in k3_dma_probe()
875 if (IS_ERR(d->clk)) { in k3_dma_probe()
877 return PTR_ERR(d->clk); in k3_dma_probe()
883 k3_dma_int_handler, 0, DRIVER_NAME, d); in k3_dma_probe()
887 d->irq = irq; in k3_dma_probe()
890 d->pool = dmam_pool_create(DRIVER_NAME, &op->dev, in k3_dma_probe()
892 if (!d->pool) in k3_dma_probe()
896 d->phy = devm_kcalloc(&op->dev, in k3_dma_probe()
897 d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL); in k3_dma_probe()
898 if (d->phy == NULL) in k3_dma_probe()
901 for (i = 0; i < d->dma_channels; i++) { in k3_dma_probe()
904 if (!(d->dma_channel_mask & BIT(i))) in k3_dma_probe()
907 p = &d->phy[i]; in k3_dma_probe()
909 p->base = d->base + i * 0x40; in k3_dma_probe()
912 INIT_LIST_HEAD(&d->slave.channels); in k3_dma_probe()
913 dma_cap_set(DMA_SLAVE, d->slave.cap_mask); in k3_dma_probe()
914 dma_cap_set(DMA_MEMCPY, d->slave.cap_mask); in k3_dma_probe()
915 dma_cap_set(DMA_CYCLIC, d->slave.cap_mask); in k3_dma_probe()
916 d->slave.dev = &op->dev; in k3_dma_probe()
917 d->slave.device_free_chan_resources = k3_dma_free_chan_resources; in k3_dma_probe()
918 d->slave.device_tx_status = k3_dma_tx_status; in k3_dma_probe()
919 d->slave.device_prep_dma_memcpy = k3_dma_prep_memcpy; in k3_dma_probe()
920 d->slave.device_prep_slave_sg = k3_dma_prep_slave_sg; in k3_dma_probe()
921 d->slave.device_prep_dma_cyclic = k3_dma_prep_dma_cyclic; in k3_dma_probe()
922 d->slave.device_issue_pending = k3_dma_issue_pending; in k3_dma_probe()
923 d->slave.device_config = k3_dma_config; in k3_dma_probe()
924 d->slave.device_pause = k3_dma_transfer_pause; in k3_dma_probe()
925 d->slave.device_resume = k3_dma_transfer_resume; in k3_dma_probe()
926 d->slave.device_terminate_all = k3_dma_terminate_all; in k3_dma_probe()
927 d->slave.device_synchronize = k3_dma_synchronize; in k3_dma_probe()
928 d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; in k3_dma_probe()
931 d->chans = devm_kcalloc(&op->dev, in k3_dma_probe()
932 d->dma_requests, sizeof(struct k3_dma_chan), GFP_KERNEL); in k3_dma_probe()
933 if (d->chans == NULL) in k3_dma_probe()
936 for (i = 0; i < d->dma_requests; i++) { in k3_dma_probe()
937 struct k3_dma_chan *c = &d->chans[i]; in k3_dma_probe()
942 vchan_init(&c->vc, &d->slave); in k3_dma_probe()
946 ret = clk_prepare_enable(d->clk); in k3_dma_probe()
952 k3_dma_enable_dma(d, true); in k3_dma_probe()
954 ret = dma_async_device_register(&d->slave); in k3_dma_probe()
959 k3_of_dma_simple_xlate, d); in k3_dma_probe()
963 spin_lock_init(&d->lock); in k3_dma_probe()
964 INIT_LIST_HEAD(&d->chan_pending); in k3_dma_probe()
965 tasklet_setup(&d->task, k3_dma_tasklet); in k3_dma_probe()
966 platform_set_drvdata(op, d); in k3_dma_probe()
972 dma_async_device_unregister(&d->slave); in k3_dma_probe()
974 clk_disable_unprepare(d->clk); in k3_dma_probe()
981 struct k3_dma_dev *d = platform_get_drvdata(op); in k3_dma_remove() local
983 dma_async_device_unregister(&d->slave); in k3_dma_remove()
986 devm_free_irq(&op->dev, d->irq, d); in k3_dma_remove()
988 list_for_each_entry_safe(c, cn, &d->slave.channels, vc.chan.device_node) { in k3_dma_remove()
992 tasklet_kill(&d->task); in k3_dma_remove()
993 clk_disable_unprepare(d->clk); in k3_dma_remove()
1000 struct k3_dma_dev *d = dev_get_drvdata(dev); in k3_dma_suspend_dev() local
1003 stat = k3_dma_get_chan_stat(d); in k3_dma_suspend_dev()
1005 dev_warn(d->slave.dev, in k3_dma_suspend_dev()
1009 k3_dma_enable_dma(d, false); in k3_dma_suspend_dev()
1010 clk_disable_unprepare(d->clk); in k3_dma_suspend_dev()
1016 struct k3_dma_dev *d = dev_get_drvdata(dev); in k3_dma_resume_dev() local
1019 ret = clk_prepare_enable(d->clk); in k3_dma_resume_dev()
1021 dev_err(d->slave.dev, "clk_prepare_enable failed: %d\n", ret); in k3_dma_resume_dev()
1024 k3_dma_enable_dma(d, true); in k3_dma_resume_dev()