Lines Matching refs:hpbdev

138 static void dcmdr_write(struct hpb_dmae_device *hpbdev, u32 data)  in dcmdr_write()  argument
140 iowrite32(data, hpbdev->chan_reg + HPB_DMAE_DCMDR); in dcmdr_write()
143 static void hsrstr_write(struct hpb_dmae_device *hpbdev, u32 ch) in hsrstr_write() argument
145 iowrite32(0x1, hpbdev->comm_reg + HPB_DMAE_HSRSTR(ch)); in hsrstr_write()
148 static u32 dintsr_read(struct hpb_dmae_device *hpbdev, u32 ch) in dintsr_read() argument
153 v = ioread32(hpbdev->comm_reg + HPB_DMAE_DINTSR0) >> ch; in dintsr_read()
155 v = ioread32(hpbdev->comm_reg + HPB_DMAE_DINTSR1) >> (ch - 32); in dintsr_read()
159 static void dintcr_write(struct hpb_dmae_device *hpbdev, u32 ch) in dintcr_write() argument
162 iowrite32((0x1 << ch), hpbdev->comm_reg + HPB_DMAE_DINTCR0); in dintcr_write()
165 hpbdev->comm_reg + HPB_DMAE_DINTCR1); in dintcr_write()
168 static void asyncmdr_write(struct hpb_dmae_device *hpbdev, u32 data) in asyncmdr_write() argument
170 iowrite32(data, hpbdev->mode_reg); in asyncmdr_write()
173 static u32 asyncmdr_read(struct hpb_dmae_device *hpbdev) in asyncmdr_read() argument
175 return ioread32(hpbdev->mode_reg); in asyncmdr_read()
178 static void hpb_dmae_enable_int(struct hpb_dmae_device *hpbdev, u32 ch) in hpb_dmae_enable_int() argument
182 spin_lock_irq(&hpbdev->reg_lock); in hpb_dmae_enable_int()
184 intreg = ioread32(hpbdev->comm_reg + HPB_DMAE_DINTMR0); in hpb_dmae_enable_int()
186 hpbdev->comm_reg + HPB_DMAE_DINTMR0); in hpb_dmae_enable_int()
188 intreg = ioread32(hpbdev->comm_reg + HPB_DMAE_DINTMR1); in hpb_dmae_enable_int()
190 hpbdev->comm_reg + HPB_DMAE_DINTMR1); in hpb_dmae_enable_int()
192 spin_unlock_irq(&hpbdev->reg_lock); in hpb_dmae_enable_int()
195 static void hpb_dmae_async_reset(struct hpb_dmae_device *hpbdev, u32 data) in hpb_dmae_async_reset() argument
200 spin_lock(&hpbdev->reg_lock); in hpb_dmae_async_reset()
201 rstr = ioread32(hpbdev->reset_reg); in hpb_dmae_async_reset()
203 iowrite32(rstr, hpbdev->reset_reg); in hpb_dmae_async_reset()
205 rstr = ioread32(hpbdev->reset_reg); in hpb_dmae_async_reset()
212 dev_err(hpbdev->shdma_dev.dma_dev.dev, in hpb_dmae_async_reset()
216 iowrite32(rstr, hpbdev->reset_reg); in hpb_dmae_async_reset()
217 spin_unlock(&hpbdev->reg_lock); in hpb_dmae_async_reset()
220 static void hpb_dmae_set_async_mode(struct hpb_dmae_device *hpbdev, in hpb_dmae_set_async_mode() argument
225 spin_lock_irq(&hpbdev->reg_lock); in hpb_dmae_set_async_mode()
226 mode = asyncmdr_read(hpbdev); in hpb_dmae_set_async_mode()
229 asyncmdr_write(hpbdev, mode); in hpb_dmae_set_async_mode()
230 spin_unlock_irq(&hpbdev->reg_lock); in hpb_dmae_set_async_mode()
233 static void hpb_dmae_ctl_stop(struct hpb_dmae_device *hpbdev) in hpb_dmae_ctl_stop() argument
235 dcmdr_write(hpbdev, HPB_DMAE_DCMDR_DQSPD); in hpb_dmae_ctl_stop()
238 static void hpb_dmae_reset(struct hpb_dmae_device *hpbdev) in hpb_dmae_reset() argument
242 for (ch = 0; ch < hpbdev->pdata->num_hw_channels; ch++) in hpb_dmae_reset()
243 hsrstr_write(hpbdev, ch); in hpb_dmae_reset()
248 struct hpb_dmae_device *hpbdev = to_dev(hpb_chan); in calc_xmit_shift() local
249 struct hpb_dmae_pdata *pdata = hpbdev->pdata; in calc_xmit_shift()
299 struct hpb_dmae_device *hpbdev = to_dev(hpb_chan); in hpb_dmae_find_slave() local
300 struct hpb_dmae_pdata *pdata = hpbdev->pdata; in hpb_dmae_find_slave()
317 struct hpb_dmae_device *hpbdev = to_dev(chan); in hpb_dmae_start_xfer() local
321 hpb_dmae_async_reset(hpbdev, chan->cfg->rstr); in hpb_dmae_start_xfer()
349 struct hpb_dmae_device *hpbdev = to_dev(chan); in hpb_dmae_chan_irq() local
353 if (dintsr_read(hpbdev, ch)) { in hpb_dmae_chan_irq()
355 dintcr_write(hpbdev, ch); in hpb_dmae_chan_irq()
403 struct hpb_dmae_device *hpbdev = to_dev(hpb_chan); in hpb_dmae_alloc_chan_resources() local
404 struct hpb_dmae_pdata *pdata = hpbdev->pdata; in hpb_dmae_alloc_chan_resources()
413 hpb_chan->base = hpbdev->chan_reg + in hpb_dmae_alloc_chan_resources()
448 hpb_dmae_set_async_mode(hpbdev, cfg->mdm, cfg->mdr); in hpb_dmae_alloc_chan_resources()
452 hpb_dmae_enable_int(hpbdev, cfg->dma_ch); in hpb_dmae_alloc_chan_resources()
503 static int hpb_dmae_chan_probe(struct hpb_dmae_device *hpbdev, int id) in hpb_dmae_chan_probe() argument
505 struct shdma_dev *sdev = &hpbdev->shdma_dev; in hpb_dmae_chan_probe()
507 to_platform_device(hpbdev->shdma_dev.dma_dev.dev); in hpb_dmae_chan_probe()
515 dev_err(hpbdev->shdma_dev.dma_dev.dev, in hpb_dmae_chan_probe()
540 struct hpb_dmae_device *hpbdev; in hpb_dmae_probe() local
558 hpbdev = devm_kzalloc(&pdev->dev, sizeof(struct hpb_dmae_device), in hpb_dmae_probe()
560 if (!hpbdev) { in hpb_dmae_probe()
565 hpbdev->chan_reg = devm_ioremap_resource(&pdev->dev, chan); in hpb_dmae_probe()
566 if (IS_ERR(hpbdev->chan_reg)) in hpb_dmae_probe()
567 return PTR_ERR(hpbdev->chan_reg); in hpb_dmae_probe()
569 hpbdev->comm_reg = devm_ioremap_resource(&pdev->dev, comm); in hpb_dmae_probe()
570 if (IS_ERR(hpbdev->comm_reg)) in hpb_dmae_probe()
571 return PTR_ERR(hpbdev->comm_reg); in hpb_dmae_probe()
573 hpbdev->reset_reg = devm_ioremap_resource(&pdev->dev, rest); in hpb_dmae_probe()
574 if (IS_ERR(hpbdev->reset_reg)) in hpb_dmae_probe()
575 return PTR_ERR(hpbdev->reset_reg); in hpb_dmae_probe()
577 hpbdev->mode_reg = devm_ioremap_resource(&pdev->dev, mode); in hpb_dmae_probe()
578 if (IS_ERR(hpbdev->mode_reg)) in hpb_dmae_probe()
579 return PTR_ERR(hpbdev->mode_reg); in hpb_dmae_probe()
581 dma_dev = &hpbdev->shdma_dev.dma_dev; in hpb_dmae_probe()
583 spin_lock_init(&hpbdev->reg_lock); in hpb_dmae_probe()
586 hpbdev->pdata = pdata; in hpb_dmae_probe()
594 hpb_dmae_reset(hpbdev); in hpb_dmae_probe()
605 hpbdev->shdma_dev.ops = &hpb_dmae_ops; in hpb_dmae_probe()
606 hpbdev->shdma_dev.desc_size = sizeof(struct hpb_desc); in hpb_dmae_probe()
607 err = shdma_init(&pdev->dev, &hpbdev->shdma_dev, pdata->num_channels); in hpb_dmae_probe()
613 hpb_dmae_chan_probe(hpbdev, i); in hpb_dmae_probe()
615 platform_set_drvdata(pdev, hpbdev); in hpb_dmae_probe()
620 shdma_cleanup(&hpbdev->shdma_dev); in hpb_dmae_probe()
626 static void hpb_dmae_chan_remove(struct hpb_dmae_device *hpbdev) in hpb_dmae_chan_remove() argument
631 shdma_for_each_chan(schan, &hpbdev->shdma_dev, i) { in hpb_dmae_chan_remove()
640 struct hpb_dmae_device *hpbdev = platform_get_drvdata(pdev); in hpb_dmae_remove() local
642 dma_async_device_unregister(&hpbdev->shdma_dev.dma_dev); in hpb_dmae_remove()
646 hpb_dmae_chan_remove(hpbdev); in hpb_dmae_remove()
653 struct hpb_dmae_device *hpbdev = platform_get_drvdata(pdev); in hpb_dmae_shutdown() local
654 hpb_dmae_ctl_stop(hpbdev); in hpb_dmae_shutdown()