};
struct pcl818_dma_desc {
- unsigned long dmabuf; /* pointers to begin of DMA buffers */
- unsigned int hwdmaptr; /* hardware address of DMA buffers */
+ void *virt_addr; /* virtual address of DMA buffer */
+ dma_addr_t hw_addr; /* hardware (bus) address of DMA buffer */
};
struct pcl818_private {
unsigned int dma; /* used DMA, 0=don't use DMA */
- unsigned int dmapages;
unsigned int hwdmasize;
struct pcl818_dma_desc dma_desc[2];
int cur_dma;
set_dma_mode(devpriv->dma, DMA_MODE_READ);
flags = claim_dma_lock();
clear_dma_ff(devpriv->dma);
- set_dma_addr(devpriv->dma, dma->hwdmaptr);
+ set_dma_addr(devpriv->dma, dma->hw_addr);
set_dma_count(devpriv->dma, bytes);
release_dma_lock(flags);
enable_dma(devpriv->dma);
dma = &devpriv->dma_desc[devpriv->cur_dma];
set_dma_mode(devpriv->dma, DMA_MODE_READ);
flags = claim_dma_lock();
- set_dma_addr(devpriv->dma, dma->hwdmaptr);
+ set_dma_addr(devpriv->dma, dma->hw_addr);
if (devpriv->dma_runs_to_end || cmd->stop_src == TRIG_NONE)
set_dma_count(devpriv->dma, devpriv->hwdmasize);
else
{
struct pcl818_private *devpriv = dev->private;
struct pcl818_dma_desc *dma = &devpriv->dma_desc[devpriv->cur_dma];
- unsigned short *ptr = (unsigned short *)dma->dmabuf;
+ unsigned short *ptr = dma->virt_addr;
unsigned int chan;
unsigned int val;
int i, len, bufptr;
return 0;
devpriv->dma = dma_chan;
- devpriv->dmapages = 2; /* we need 16KB */
- devpriv->hwdmasize = (1 << devpriv->dmapages) * PAGE_SIZE;
+ devpriv->hwdmasize = PAGE_SIZE * 4; /* we need 16KB */
for (i = 0; i < 2; i++) {
dma = &devpriv->dma_desc[i];
- dma->dmabuf = __get_dma_pages(GFP_KERNEL, devpriv->dmapages);
- if (!dma->dmabuf)
+ dma->virt_addr = dma_alloc_coherent(NULL, devpriv->hwdmasize,
+ &dma->hw_addr, GFP_KERNEL);
+ if (!dma->virt_addr)
return -ENOMEM;
- dma->hwdmaptr = virt_to_bus((void *)dma->dmabuf);
}
return 0;
}
free_dma(devpriv->dma);
for (i = 0; i < 2; i++) {
dma = &devpriv->dma_desc[i];
- if (dma->dmabuf)
- free_pages(dma->dmabuf, devpriv->dmapages);
+ if (dma->virt_addr)
+ dma_free_coherent(NULL, devpriv->hwdmasize,
+ dma->virt_addr, dma->hw_addr);
}
}