12 #include <linux/mman.h>
22 #include <mach/hardware.h>
23 #include <asm/uaccess.h>
47 #define TRANSFER_SIZE 2
50 #define ENDA (IOMD_IO0ENDA - IOMD_IO0CURA)
51 #define CURB (IOMD_IO0CURB - IOMD_IO0CURA)
52 #define ENDB (IOMD_IO0ENDB - IOMD_IO0CURA)
53 #define CR (IOMD_IO0CR - IOMD_IO0CURA)
54 #define ST (IOMD_IO0ST - IOMD_IO0CURA)
78 if (idma->
dma.sgcount > 1) {
110 iomd_get_next_sg(&idma->
cur_sg, idma);
133 idma->
state = ~DMA_ST_AB;
139 static int iomd_request_dma(
unsigned int chan,
dma_t *
dma)
147 static void iomd_free_dma(
unsigned int chan,
dma_t *
dma)
154 static void iomd_enable_dma(
unsigned int chan,
dma_t *
dma)
157 unsigned long dma_base = idma->
base;
160 if (idma->
dma.invalid) {
161 idma->
dma.invalid = 0;
168 idma->
dma.sg = &idma->
dma.buf;
169 idma->
dma.sgcount = 1;
170 idma->
dma.buf.length = idma->
dma.count;
172 idma->
dma.addr, idma->
dma.count,
188 static void iomd_disable_dma(
unsigned int chan,
dma_t *dma)
191 unsigned long dma_base = idma->
base;
195 if (idma->
state != ~DMA_ST_AB)
201 static int iomd_set_dma_speed(
unsigned int chan,
dma_t *dma,
int cycle)
207 else if (cycle <= 250)
209 else if (cycle < 438)
219 tcr = (tcr & ~0x03) | speed;
223 tcr = (tcr & ~0x0c) | (speed << 2);
227 tcr = (tcr & ~0x30) | (speed << 4);
231 tcr = (tcr & ~0xc0) | (speed << 6);
243 static struct dma_ops iomd_dma_ops = {
245 .request = iomd_request_dma,
246 .free = iomd_free_dma,
247 .enable = iomd_enable_dma,
248 .disable = iomd_disable_dma,
249 .setspeed = iomd_set_dma_speed,
261 static void floppy_enable_dma(
unsigned int chan,
dma_t *dma)
264 void *fiqhandler_start;
265 unsigned int fiqhandler_length;
272 extern unsigned char floppy_fiqin_start, floppy_fiqin_end;
273 fiqhandler_start = &floppy_fiqin_start;
274 fiqhandler_length = &floppy_fiqin_end - &floppy_fiqin_start;
276 extern unsigned char floppy_fiqout_start, floppy_fiqout_end;
277 fiqhandler_start = &floppy_fiqout_start;
278 fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start;
281 regs.ARM_r9 = fdma->
dma.count;
282 regs.ARM_r10 = (
unsigned long)fdma->
dma.addr;
286 printk(
"floppydma: couldn't claim FIQ.\n");
295 static void floppy_disable_dma(
unsigned int chan,
dma_t *dma)
302 static int floppy_get_residue(
unsigned int chan,
dma_t *dma)
309 static struct dma_ops floppy_dma_ops = {
311 .enable = floppy_enable_dma,
312 .disable = floppy_disable_dma,
313 .residue = floppy_get_residue,
319 static void sound_enable_disable_dma(
unsigned int chan,
dma_t *dma)
323 static struct dma_ops sound_dma_ops = {
325 .enable = sound_enable_disable_dma,
326 .disable = sound_enable_disable_dma,
333 .d_ops = &floppy_dma_ops,
338 static dma_t sound_dma = {
339 .
d_ops = &sound_dma_ops,
342 static int __init rpc_dma_init(
void)
378 printk(
"IOMDDMA%u: unable to register: %d\n", i, ret);
383 printk(
"IOMDFLOPPY: unable to register: %d\n", ret);
386 printk(
"IOMDSOUND: unable to register: %d\n", ret);