2 * linux/arch/arm/kernel/dma-riscstation.c
4 * Copyright (C) 1998 Russell King
5 * Copyright (C) 2002 Ben Dooks / Simtec Electronics
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * DMA functions specific to RiscStatiun architecture
13 * sliced down version of the RiscPC DMA code by RMK
15 #include <linux/sched.h>
16 #include <linux/slab.h>
17 #include <linux/mman.h>
18 #include <linux/init.h>
19 #include <linux/pci.h>
26 #include <asm/hardware.h>
27 #include <asm/uaccess.h>
29 #include <asm/mach/dma.h>
30 #include <asm/hardware/iomd.h>
32 static struct fiq_handler fh = {
36 static void floppy_enable_dma(dmach_t channel, dma_t *dma)
38 void *fiqhandler_start;
39 unsigned int fiqhandler_length;
42 if (dma->dma_mode == DMA_MODE_READ) {
43 extern unsigned char floppy_fiqin_start, floppy_fiqin_end;
44 fiqhandler_start = &floppy_fiqin_start;
45 fiqhandler_length = &floppy_fiqin_end - &floppy_fiqin_start;
47 extern unsigned char floppy_fiqout_start, floppy_fiqout_end;
48 fiqhandler_start = &floppy_fiqout_start;
49 fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start;
52 regs.ARM_r9 = dma->buf.length;
53 regs.ARM_r10 = (unsigned long)dma->buf.address;
54 regs.ARM_fp = FLOPPYDMA_BASE;
57 printk("floppydma: couldn't claim FIQ.\n");
61 set_fiq_handler(fiqhandler_start, fiqhandler_length);
63 enable_fiq(dma->dma_irq);
66 static void floppy_disable_dma(dmach_t channel, dma_t *dma)
68 disable_fiq(dma->dma_irq);
72 static int floppy_get_residue(dmach_t channel, dma_t *dma)
79 static struct dma_ops floppy_dma_ops = {
81 enable: floppy_enable_dma,
82 disable: floppy_disable_dma,
83 residue: floppy_get_residue,
87 * This is virtual DMA - we don't need anything here.
89 static void sound_enable_disable_dma(dmach_t channel, dma_t *dma)
93 static struct dma_ops sound_dma_ops = {
95 enable: sound_enable_disable_dma,
96 disable: sound_enable_disable_dma,
99 void __init arch_dma_init(dma_t *dma)
102 iomd_writeb(0, IOMD_IO0CR);
103 iomd_writeb(0, IOMD_IO1CR);
104 iomd_writeb(0, IOMD_IO2CR);
105 iomd_writeb(0, IOMD_IO3CR);
107 iomd_writeb(0xa0, IOMD_DMATCR);
110 dma[DMA_VIRTUAL_FLOPPY].dma_irq = FIQ_FLOPPYDATA;
111 dma[DMA_VIRTUAL_FLOPPY].d_ops = &floppy_dma_ops;
112 dma[DMA_VIRTUAL_SOUND].d_ops = &sound_dma_ops;