Lines Matching refs:shdev
69 struct sh_dmae_device *shdev = to_sh_dev(sh_dc); in channel_clear() local
70 const struct sh_dmae_channel *chan_pdata = shdev->pdata->channel + in channel_clear()
72 u32 val = shdev->pdata->chclr_bitwise ? 1 << chan_pdata->chclr_bit : 0; in channel_clear()
74 __raw_writel(val, shdev->chan_reg + chan_pdata->chclr_offset); in channel_clear()
87 static u16 dmaor_read(struct sh_dmae_device *shdev) in dmaor_read() argument
89 void __iomem *addr = shdev->chan_reg + DMAOR; in dmaor_read()
91 if (shdev->pdata->dmaor_is_32bit) in dmaor_read()
97 static void dmaor_write(struct sh_dmae_device *shdev, u16 data) in dmaor_write() argument
99 void __iomem *addr = shdev->chan_reg + DMAOR; in dmaor_write()
101 if (shdev->pdata->dmaor_is_32bit) in dmaor_write()
109 struct sh_dmae_device *shdev = to_sh_dev(sh_dc); in chcr_write() local
111 __raw_writel(data, sh_dc->base + shdev->chcr_offset); in chcr_write()
116 struct sh_dmae_device *shdev = to_sh_dev(sh_dc); in chcr_read() local
118 return __raw_readl(sh_dc->base + shdev->chcr_offset); in chcr_read()
126 static void sh_dmae_ctl_stop(struct sh_dmae_device *shdev) in sh_dmae_ctl_stop() argument
133 dmaor = dmaor_read(shdev); in sh_dmae_ctl_stop()
134 dmaor_write(shdev, dmaor & ~(DMAOR_NMIF | DMAOR_AE | DMAOR_DME)); in sh_dmae_ctl_stop()
139 static int sh_dmae_rst(struct sh_dmae_device *shdev) in sh_dmae_rst() argument
146 dmaor = dmaor_read(shdev) & ~(DMAOR_NMIF | DMAOR_AE | DMAOR_DME); in sh_dmae_rst()
148 if (shdev->pdata->chclr_present) { in sh_dmae_rst()
150 for (i = 0; i < shdev->pdata->channel_num; i++) { in sh_dmae_rst()
151 struct sh_dmae_chan *sh_chan = shdev->chan[i]; in sh_dmae_rst()
157 dmaor_write(shdev, dmaor | shdev->pdata->dmaor_init); in sh_dmae_rst()
159 dmaor = dmaor_read(shdev); in sh_dmae_rst()
164 dev_warn(shdev->shdma_dev.dma_dev.dev, "Can't initialize DMAOR.\n"); in sh_dmae_rst()
167 if (shdev->pdata->dmaor_init & ~dmaor) in sh_dmae_rst()
168 dev_warn(shdev->shdma_dev.dma_dev.dev, in sh_dmae_rst()
170 dmaor, shdev->pdata->dmaor_init); in sh_dmae_rst()
186 struct sh_dmae_device *shdev = to_sh_dev(sh_chan); in calc_xmit_shift() local
187 const struct sh_dmae_pdata *pdata = shdev->pdata; in calc_xmit_shift()
199 struct sh_dmae_device *shdev = to_sh_dev(sh_chan); in log2size_to_chcr() local
200 const struct sh_dmae_pdata *pdata = shdev->pdata; in log2size_to_chcr()
223 struct sh_dmae_device *shdev = to_sh_dev(sh_chan); in dmae_start() local
226 if (shdev->pdata->needs_tend_set) in dmae_start()
229 chcr |= CHCR_DE | shdev->chcr_ie_bit; in dmae_start()
258 struct sh_dmae_device *shdev = to_sh_dev(sh_chan); in dmae_set_dmars() local
259 const struct sh_dmae_pdata *pdata = shdev->pdata; in dmae_set_dmars()
261 void __iomem *addr = shdev->dmars; in dmae_set_dmars()
272 addr = shdev->chan_reg; in dmae_set_dmars()
327 struct sh_dmae_device *shdev = to_sh_dev(sh_chan); in dmae_find_slave() local
328 const struct sh_dmae_pdata *pdata = shdev->pdata; in dmae_find_slave()
369 struct sh_dmae_device *shdev = to_sh_dev(sh_chan); in dmae_halt() local
372 chcr &= ~(CHCR_DE | CHCR_TE | shdev->chcr_ie_bit); in dmae_halt()
426 static bool sh_dmae_reset(struct sh_dmae_device *shdev) in sh_dmae_reset() argument
431 sh_dmae_ctl_stop(shdev); in sh_dmae_reset()
434 ret = shdma_reset(&shdev->shdma_dev); in sh_dmae_reset()
436 sh_dmae_rst(shdev); in sh_dmae_reset()
443 struct sh_dmae_device *shdev = data; in sh_dmae_err() local
445 if (!(dmaor_read(shdev) & DMAOR_AE)) in sh_dmae_err()
448 sh_dmae_reset(shdev); in sh_dmae_err()
468 static bool sh_dmae_nmi_notify(struct sh_dmae_device *shdev) in sh_dmae_nmi_notify() argument
471 if ((dmaor_read(shdev) & DMAOR_NMIF) == 0) in sh_dmae_nmi_notify()
474 return sh_dmae_reset(shdev); in sh_dmae_nmi_notify()
480 struct sh_dmae_device *shdev; in sh_dmae_nmi_handler() local
494 list_for_each_entry_rcu(shdev, &sh_dmae_devices, node) { in sh_dmae_nmi_handler()
500 triggered = sh_dmae_nmi_notify(shdev); in sh_dmae_nmi_handler()
516 static int sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id, in sh_dmae_chan_probe() argument
519 const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id]; in sh_dmae_chan_probe()
520 struct shdma_dev *sdev = &shdev->shdma_dev; in sh_dmae_chan_probe()
536 sh_chan->base = shdev->chan_reg + chan_pdata->offset; in sh_dmae_chan_probe()
554 shdev->chan[id] = sh_chan; in sh_dmae_chan_probe()
563 static void sh_dmae_chan_remove(struct sh_dmae_device *shdev) in sh_dmae_chan_remove() argument
568 shdma_for_each_chan(schan, &shdev->shdma_dev, i) { in sh_dmae_chan_remove()
578 struct sh_dmae_device *shdev = dev_get_drvdata(dev); in sh_dmae_runtime_suspend() local
580 sh_dmae_ctl_stop(shdev); in sh_dmae_runtime_suspend()
586 struct sh_dmae_device *shdev = dev_get_drvdata(dev); in sh_dmae_runtime_resume() local
588 return sh_dmae_rst(shdev); in sh_dmae_runtime_resume()
595 struct sh_dmae_device *shdev = dev_get_drvdata(dev); in sh_dmae_suspend() local
597 sh_dmae_ctl_stop(shdev); in sh_dmae_suspend()
603 struct sh_dmae_device *shdev = dev_get_drvdata(dev); in sh_dmae_resume() local
606 ret = sh_dmae_rst(shdev); in sh_dmae_resume()
610 for (i = 0; i < shdev->pdata->channel_num; i++) { in sh_dmae_resume()
611 struct sh_dmae_chan *sh_chan = shdev->chan[i]; in sh_dmae_resume()
678 struct sh_dmae_device *shdev; in sh_dmae_probe() local
713 shdev = devm_kzalloc(&pdev->dev, sizeof(struct sh_dmae_device), in sh_dmae_probe()
715 if (!shdev) in sh_dmae_probe()
718 dma_dev = &shdev->shdma_dev.dma_dev; in sh_dmae_probe()
720 shdev->chan_reg = devm_platform_ioremap_resource(pdev, 0); in sh_dmae_probe()
721 if (IS_ERR(shdev->chan_reg)) in sh_dmae_probe()
722 return PTR_ERR(shdev->chan_reg); in sh_dmae_probe()
724 shdev->dmars = devm_ioremap_resource(&pdev->dev, dmars); in sh_dmae_probe()
725 if (IS_ERR(shdev->dmars)) in sh_dmae_probe()
726 return PTR_ERR(shdev->dmars); in sh_dmae_probe()
742 shdev->shdma_dev.ops = &sh_dmae_shdma_ops; in sh_dmae_probe()
743 shdev->shdma_dev.desc_size = sizeof(struct sh_dmae_desc); in sh_dmae_probe()
744 err = shdma_init(&pdev->dev, &shdev->shdma_dev, in sh_dmae_probe()
750 shdev->pdata = pdata; in sh_dmae_probe()
753 shdev->chcr_offset = pdata->chcr_offset; in sh_dmae_probe()
755 shdev->chcr_offset = CHCR; in sh_dmae_probe()
758 shdev->chcr_ie_bit = pdata->chcr_ie_bit; in sh_dmae_probe()
760 shdev->chcr_ie_bit = CHCR_IE; in sh_dmae_probe()
762 platform_set_drvdata(pdev, shdev); in sh_dmae_probe()
770 list_add_tail_rcu(&shdev->node, &sh_dmae_devices); in sh_dmae_probe()
774 err = sh_dmae_rst(shdev); in sh_dmae_probe()
793 irqflags, "DMAC Address Error", shdev); in sh_dmae_probe()
845 err = sh_dmae_chan_probe(shdev, i, chan_irq[i], chan_flag[i]); in sh_dmae_probe()
857 err = dma_async_device_register(&shdev->shdma_dev.dma_dev); in sh_dmae_probe()
867 sh_dmae_chan_remove(shdev); in sh_dmae_probe()
872 list_del_rcu(&shdev->node); in sh_dmae_probe()
878 shdma_cleanup(&shdev->shdma_dev); in sh_dmae_probe()
887 struct sh_dmae_device *shdev = platform_get_drvdata(pdev); in sh_dmae_remove() local
888 struct dma_device *dma_dev = &shdev->shdma_dev.dma_dev; in sh_dmae_remove()
893 list_del_rcu(&shdev->node); in sh_dmae_remove()
898 sh_dmae_chan_remove(shdev); in sh_dmae_remove()
899 shdma_cleanup(&shdev->shdma_dev); in sh_dmae_remove()