aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-01-04 10:08:30 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-04 10:08:30 -0500
commit7cdad482974792419cfe4b0affca689170116f49 (patch)
treef9ee204f8848274ffb3323f425ad039cf4807de6 /arch/arm/kernel
parent333c9624b728a9e83b741ea75836aa114ec35272 (diff)
[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>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/dma-isa.c22
-rw-r--r--arch/arm/kernel/dma.c13
2 files changed, 17 insertions, 18 deletions
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index e9a36304ec3e..03532769a97f 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -18,7 +18,7 @@
18 */ 18 */
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/pci.h> 21#include <linux/dma-mapping.h>
22 22
23#include <asm/dma.h> 23#include <asm/dma.h>
24#include <asm/io.h> 24#include <asm/io.h>
@@ -65,37 +65,41 @@ static void isa_enable_dma(dmach_t channel, dma_t *dma)
65{ 65{
66 if (dma->invalid) { 66 if (dma->invalid) {
67 unsigned long address, length; 67 unsigned long address, length;
68 unsigned int mode, direction; 68 unsigned int mode;
69 enum dma_data_direction direction;
69 70
70 mode = channel & 3; 71 mode = channel & 3;
71 switch (dma->dma_mode & DMA_MODE_MASK) { 72 switch (dma->dma_mode & DMA_MODE_MASK) {
72 case DMA_MODE_READ: 73 case DMA_MODE_READ:
73 mode |= ISA_DMA_MODE_READ; 74 mode |= ISA_DMA_MODE_READ;
74 direction = PCI_DMA_FROMDEVICE; 75 direction = DMA_FROM_DEVICE;
75 break; 76 break;
76 77
77 case DMA_MODE_WRITE: 78 case DMA_MODE_WRITE:
78 mode |= ISA_DMA_MODE_WRITE; 79 mode |= ISA_DMA_MODE_WRITE;
79 direction = PCI_DMA_TODEVICE; 80 direction = DMA_TO_DEVICE;
80 break; 81 break;
81 82
82 case DMA_MODE_CASCADE: 83 case DMA_MODE_CASCADE:
83 mode |= ISA_DMA_MODE_CASCADE; 84 mode |= ISA_DMA_MODE_CASCADE;
84 direction = PCI_DMA_BIDIRECTIONAL; 85 direction = DMA_BIDIRECTIONAL;
85 break; 86 break;
86 87
87 default: 88 default:
88 direction = PCI_DMA_NONE; 89 direction = DMA_NONE;
89 break; 90 break;
90 } 91 }
91 92
92 if (!dma->using_sg) { 93 if (!dma->sg) {
93 /* 94 /*
94 * Cope with ISA-style drivers which expect cache 95 * Cope with ISA-style drivers which expect cache
95 * coherence. 96 * coherence.
96 */ 97 */
97 dma->buf.dma_address = pci_map_single(NULL, 98 dma->sg = &dma->buf;
98 dma->buf.__address, dma->buf.length, 99 dma->sgcount = 1;
100 dma->buf.length = dma->count;
101 dma->buf.dma_address = dma_map_single(NULL,
102 dma->addr, dma->count,
99 direction); 103 direction);
100 } 104 }
101 105
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 3aedada71046..913fd947528c 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -123,7 +123,6 @@ void set_dma_sg (dmach_t channel, struct scatterlist *sg, int nr_sg)
123 123
124 dma->sg = sg; 124 dma->sg = sg;
125 dma->sgcount = nr_sg; 125 dma->sgcount = nr_sg;
126 dma->using_sg = 1;
127 dma->invalid = 1; 126 dma->invalid = 1;
128} 127}
129 128
@@ -139,10 +138,8 @@ void __set_dma_addr (dmach_t channel, void *addr)
139 printk(KERN_ERR "dma%d: altering DMA address while " 138 printk(KERN_ERR "dma%d: altering DMA address while "
140 "DMA active\n", channel); 139 "DMA active\n", channel);
141 140
142 dma->sg = &dma->buf; 141 dma->sg = NULL;
143 dma->sgcount = 1; 142 dma->addr = addr;
144 dma->buf.__address = addr;
145 dma->using_sg = 0;
146 dma->invalid = 1; 143 dma->invalid = 1;
147} 144}
148 145
@@ -158,10 +155,8 @@ void set_dma_count (dmach_t channel, unsigned long count)
158 printk(KERN_ERR "dma%d: altering DMA count while " 155 printk(KERN_ERR "dma%d: altering DMA count while "
159 "DMA active\n", channel); 156 "DMA active\n", channel);
160 157
161 dma->sg = &dma->buf; 158 dma->sg = NULL;
162 dma->sgcount = 1; 159 dma->count = count;
163 dma->buf.length = count;
164 dma->using_sg = 0;
165 dma->invalid = 1; 160 dma->invalid = 1;
166} 161}
167 162