[ARM] Remove '__address' from scatterlist and convert to DMA API
The old __address element in struct scatterlist remained from older kernels because the ARM DMA emulation code made use of it. Move this field into struct dma_struct, and convert DMA emulation code to setup a SG entry as required. Also, convert DMA emulation code to use the new DMA API rather than the PCI DMA API. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
committed by
Russell King
parent
333c9624b7
commit
7cdad48297
@ -18,7 +18,7 @@
|
||||
*/
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
#include <asm/dma.h>
|
||||
#include <asm/io.h>
|
||||
@ -65,37 +65,41 @@ static void isa_enable_dma(dmach_t channel, dma_t *dma)
|
||||
{
|
||||
if (dma->invalid) {
|
||||
unsigned long address, length;
|
||||
unsigned int mode, direction;
|
||||
unsigned int mode;
|
||||
enum dma_data_direction direction;
|
||||
|
||||
mode = channel & 3;
|
||||
switch (dma->dma_mode & DMA_MODE_MASK) {
|
||||
case DMA_MODE_READ:
|
||||
mode |= ISA_DMA_MODE_READ;
|
||||
direction = PCI_DMA_FROMDEVICE;
|
||||
direction = DMA_FROM_DEVICE;
|
||||
break;
|
||||
|
||||
case DMA_MODE_WRITE:
|
||||
mode |= ISA_DMA_MODE_WRITE;
|
||||
direction = PCI_DMA_TODEVICE;
|
||||
direction = DMA_TO_DEVICE;
|
||||
break;
|
||||
|
||||
case DMA_MODE_CASCADE:
|
||||
mode |= ISA_DMA_MODE_CASCADE;
|
||||
direction = PCI_DMA_BIDIRECTIONAL;
|
||||
direction = DMA_BIDIRECTIONAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
direction = PCI_DMA_NONE;
|
||||
direction = DMA_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dma->using_sg) {
|
||||
if (!dma->sg) {
|
||||
/*
|
||||
* Cope with ISA-style drivers which expect cache
|
||||
* coherence.
|
||||
*/
|
||||
dma->buf.dma_address = pci_map_single(NULL,
|
||||
dma->buf.__address, dma->buf.length,
|
||||
dma->sg = &dma->buf;
|
||||
dma->sgcount = 1;
|
||||
dma->buf.length = dma->count;
|
||||
dma->buf.dma_address = dma_map_single(NULL,
|
||||
dma->addr, dma->count,
|
||||
direction);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,6 @@ void set_dma_sg (dmach_t channel, struct scatterlist *sg, int nr_sg)
|
||||
|
||||
dma->sg = sg;
|
||||
dma->sgcount = nr_sg;
|
||||
dma->using_sg = 1;
|
||||
dma->invalid = 1;
|
||||
}
|
||||
|
||||
@ -139,10 +138,8 @@ void __set_dma_addr (dmach_t channel, void *addr)
|
||||
printk(KERN_ERR "dma%d: altering DMA address while "
|
||||
"DMA active\n", channel);
|
||||
|
||||
dma->sg = &dma->buf;
|
||||
dma->sgcount = 1;
|
||||
dma->buf.__address = addr;
|
||||
dma->using_sg = 0;
|
||||
dma->sg = NULL;
|
||||
dma->addr = addr;
|
||||
dma->invalid = 1;
|
||||
}
|
||||
|
||||
@ -158,10 +155,8 @@ void set_dma_count (dmach_t channel, unsigned long count)
|
||||
printk(KERN_ERR "dma%d: altering DMA count while "
|
||||
"DMA active\n", channel);
|
||||
|
||||
dma->sg = &dma->buf;
|
||||
dma->sgcount = 1;
|
||||
dma->buf.length = count;
|
||||
dma->using_sg = 0;
|
||||
dma->sg = NULL;
|
||||
dma->count = count;
|
||||
dma->invalid = 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user