Lines Matching defs:shdev
61 static u16 dmaor_read(struct sh_dmae_device *shdev)
63 return __raw_readw(shdev->chan_reg + DMAOR / sizeof(u32));
66 static void dmaor_write(struct sh_dmae_device *shdev, u16 data)
68 __raw_writew(data, shdev->chan_reg + DMAOR / sizeof(u32));
76 static void sh_dmae_ctl_stop(struct sh_dmae_device *shdev)
78 unsigned short dmaor = dmaor_read(shdev);
80 dmaor_write(shdev, dmaor & ~(DMAOR_NMIF | DMAOR_AE | DMAOR_DME));
83 static int sh_dmae_rst(struct sh_dmae_device *shdev)
87 sh_dmae_ctl_stop(shdev);
88 dmaor = dmaor_read(shdev) | shdev->pdata->dmaor_init;
90 dmaor_write(shdev, dmaor);
91 if (dmaor_read(shdev) & (DMAOR_AE | DMAOR_NMIF)) {
110 struct sh_dmae_device *shdev = container_of(sh_chan->common.device,
112 struct sh_dmae_pdata *pdata = shdev->pdata;
124 struct sh_dmae_device *shdev = container_of(sh_chan->common.device,
126 struct sh_dmae_pdata *pdata = shdev->pdata;
189 struct sh_dmae_device *shdev = container_of(sh_chan->common.device,
191 struct sh_dmae_pdata *pdata = shdev->pdata;
193 u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16);
272 struct sh_dmae_device *shdev = container_of(dma_dev,
274 struct sh_dmae_pdata *pdata = shdev->pdata;
823 struct sh_dmae_device *shdev = (struct sh_dmae_device *)data;
827 sh_dmae_ctl_stop(shdev);
831 struct sh_dmae_chan *sh_chan = shdev->chan[i];
846 sh_dmae_rst(shdev);
879 static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
883 const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
884 struct platform_device *pdev = to_platform_device(shdev->common.dev);
890 dev_err(shdev->common.dev,
896 new_sh_chan->common.device = &shdev->common;
898 new_sh_chan->dev = shdev->common.dev;
901 new_sh_chan->base = shdev->chan_reg + chan_pdata->offset / sizeof(u32);
918 &shdev->common.channels);
919 shdev->common.chancnt++;
932 dev_err(shdev->common.dev, "DMA channel %d request_irq error "
937 shdev->chan[id] = new_sh_chan;
947 static void sh_dmae_chan_remove(struct sh_dmae_device *shdev)
951 for (i = shdev->common.chancnt - 1 ; i >= 0 ; i--) {
952 if (shdev->chan[i]) {
953 struct sh_dmae_chan *sh_chan = shdev->chan[i];
959 shdev->chan[i] = NULL;
962 shdev->common.chancnt = 0;
972 struct sh_dmae_device *shdev;
1014 shdev = kzalloc(sizeof(struct sh_dmae_device), GFP_KERNEL);
1015 if (!shdev) {
1020 shdev->chan_reg = ioremap(chan->start, resource_size(chan));
1021 if (!shdev->chan_reg)
1024 shdev->dmars = ioremap(dmars->start, resource_size(dmars));
1025 if (!shdev->dmars)
1030 shdev->pdata = pdata;
1036 err = sh_dmae_rst(shdev);
1040 INIT_LIST_HEAD(&shdev->common.channels);
1042 dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask);
1044 dma_cap_set(DMA_SLAVE, shdev->common.cap_mask);
1046 shdev->common.device_alloc_chan_resources
1048 shdev->common.device_free_chan_resources = sh_dmae_free_chan_resources;
1049 shdev->common.device_prep_dma_memcpy = sh_dmae_prep_memcpy;
1050 shdev->common.device_tx_status = sh_dmae_tx_status;
1051 shdev->common.device_issue_pending = sh_dmae_memcpy_issue_pending;
1054 shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg;
1055 shdev->common.device_control = sh_dmae_control;
1057 shdev->common.dev = &pdev->dev;
1059 shdev->common.copy_align = LOG2_DEFAULT_XFER_SIZE;
1076 "DMAC Address Error", shdev);
1118 err = sh_dmae_chan_probe(shdev, i, chan_irq[i], chan_flag[i]);
1125 platform_set_drvdata(pdev, shdev);
1126 dma_async_device_register(&shdev->common);
1131 sh_dmae_chan_remove(shdev);
1134 free_irq(errirq, shdev);
1140 iounmap(shdev->dmars);
1142 iounmap(shdev->chan_reg);
1144 kfree(shdev);
1156 struct sh_dmae_device *shdev = platform_get_drvdata(pdev);
1160 dma_async_device_unregister(&shdev->common);
1163 free_irq(errirq, shdev);
1166 sh_dmae_chan_remove(shdev);
1170 if (shdev->dmars)
1171 iounmap(shdev->dmars);
1172 iounmap(shdev->chan_reg);
1174 kfree(shdev);
1188 struct sh_dmae_device *shdev = platform_get_drvdata(pdev);
1189 sh_dmae_ctl_stop(shdev);