diff options
Diffstat (limited to 'arch/arm26/machine/dma.c')
-rw-r--r-- | arch/arm26/machine/dma.c | 214 |
1 files changed, 0 insertions, 214 deletions
diff --git a/arch/arm26/machine/dma.c b/arch/arm26/machine/dma.c deleted file mode 100644 index 4402a5a1b78f..000000000000 --- a/arch/arm26/machine/dma.c +++ /dev/null | |||
@@ -1,214 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm26/kernel/dma.c | ||
3 | * | ||
4 | * Copyright (C) 1998-1999 Dave Gilbert / Russell King | ||
5 | * Copyright (C) 2003 Ian Molton | ||
6 | * | ||
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. | ||
10 | * | ||
11 | * DMA functions specific to Archimedes and A5000 architecture | ||
12 | */ | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/init.h> | ||
15 | |||
16 | #include <asm/dma.h> | ||
17 | #include <asm/fiq.h> | ||
18 | #include <asm/irq.h> | ||
19 | #include <asm/io.h> | ||
20 | #include <asm/hardware.h> | ||
21 | #include <asm/mach-types.h> | ||
22 | |||
23 | #define DPRINTK(x...) printk(KERN_DEBUG x) | ||
24 | |||
25 | #if defined(CONFIG_BLK_DEV_FD1772) || defined(CONFIG_BLK_DEV_FD1772_MODULE) | ||
26 | |||
27 | extern unsigned char fdc1772_dma_read, fdc1772_dma_read_end; | ||
28 | extern unsigned char fdc1772_dma_write, fdc1772_dma_write_end; | ||
29 | extern void fdc1772_setupdma(unsigned int count,unsigned int addr); | ||
30 | |||
31 | static void arc_floppy_data_enable_dma(dmach_t channel, dma_t *dma) | ||
32 | { | ||
33 | DPRINTK("arc_floppy_data_enable_dma\n"); | ||
34 | |||
35 | if (dma->using_sg) | ||
36 | BUG(); | ||
37 | |||
38 | switch (dma->dma_mode) { | ||
39 | case DMA_MODE_READ: { /* read */ | ||
40 | unsigned long flags; | ||
41 | DPRINTK("enable_dma fdc1772 data read\n"); | ||
42 | local_save_flags_cli(flags); | ||
43 | clf(); | ||
44 | |||
45 | memcpy ((void *)0x1c, (void *)&fdc1772_dma_read, | ||
46 | &fdc1772_dma_read_end - &fdc1772_dma_read); | ||
47 | fdc1772_setupdma(dma->buf.length, dma->buf.__address); /* Sets data pointer up */ | ||
48 | enable_fiq(FIQ_FLOPPYDATA); | ||
49 | local_irq_restore(flags); | ||
50 | } | ||
51 | break; | ||
52 | |||
53 | case DMA_MODE_WRITE: { /* write */ | ||
54 | unsigned long flags; | ||
55 | DPRINTK("enable_dma fdc1772 data write\n"); | ||
56 | local_save_flags_cli(flags); | ||
57 | clf(); | ||
58 | memcpy ((void *)0x1c, (void *)&fdc1772_dma_write, | ||
59 | &fdc1772_dma_write_end - &fdc1772_dma_write); | ||
60 | fdc1772_setupdma(dma->buf.length, dma->buf.__address); /* Sets data pointer up */ | ||
61 | enable_fiq(FIQ_FLOPPYDATA); | ||
62 | |||
63 | local_irq_restore(flags); | ||
64 | } | ||
65 | break; | ||
66 | default: | ||
67 | printk ("enable_dma: dma%d not initialised\n", channel); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | static int arc_floppy_data_get_dma_residue(dmach_t channel, dma_t *dma) | ||
72 | { | ||
73 | extern unsigned int fdc1772_bytestogo; | ||
74 | |||
75 | /* 10/1/1999 DAG - I presume its the number of bytes left? */ | ||
76 | return fdc1772_bytestogo; | ||
77 | } | ||
78 | |||
79 | static void arc_floppy_cmdend_enable_dma(dmach_t channel, dma_t *dma) | ||
80 | { | ||
81 | /* Need to build a branch at the FIQ address */ | ||
82 | extern void fdc1772_comendhandler(void); | ||
83 | unsigned long flags; | ||
84 | |||
85 | DPRINTK("arc_floppy_cmdend_enable_dma\n"); | ||
86 | /*printk("enable_dma fdc1772 command end FIQ\n");*/ | ||
87 | save_flags(flags); | ||
88 | clf(); | ||
89 | |||
90 | /* B fdc1772_comendhandler */ | ||
91 | *((unsigned int *)0x1c)=0xea000000 | | ||
92 | (((unsigned int)fdc1772_comendhandler-(0x1c+8))/4); | ||
93 | |||
94 | local_irq_restore(flags); | ||
95 | } | ||
96 | |||
97 | static int arc_floppy_cmdend_get_dma_residue(dmach_t channel, dma_t *dma) | ||
98 | { | ||
99 | /* 10/1/1999 DAG - Presume whether there is an outstanding command? */ | ||
100 | extern unsigned int fdc1772_fdc_int_done; | ||
101 | |||
102 | /* Explicit! If the int done is 0 then 1 int to go */ | ||
103 | return (fdc1772_fdc_int_done==0)?1:0; | ||
104 | } | ||
105 | |||
106 | static void arc_disable_dma(dmach_t channel, dma_t *dma) | ||
107 | { | ||
108 | disable_fiq(dma->dma_irq); | ||
109 | } | ||
110 | |||
111 | static struct dma_ops arc_floppy_data_dma_ops = { | ||
112 | .type = "FIQDMA", | ||
113 | .enable = arc_floppy_data_enable_dma, | ||
114 | .disable = arc_disable_dma, | ||
115 | .residue = arc_floppy_data_get_dma_residue, | ||
116 | }; | ||
117 | |||
118 | static struct dma_ops arc_floppy_cmdend_dma_ops = { | ||
119 | .type = "FIQCMD", | ||
120 | .enable = arc_floppy_cmdend_enable_dma, | ||
121 | .disable = arc_disable_dma, | ||
122 | .residue = arc_floppy_cmdend_get_dma_residue, | ||
123 | }; | ||
124 | #endif | ||
125 | |||
126 | #ifdef CONFIG_ARCH_A5K | ||
127 | static struct fiq_handler fh = { | ||
128 | .name = "floppydata" | ||
129 | }; | ||
130 | |||
131 | static int a5k_floppy_get_dma_residue(dmach_t channel, dma_t *dma) | ||
132 | { | ||
133 | struct pt_regs regs; | ||
134 | get_fiq_regs(®s); | ||
135 | return regs.ARM_r9; | ||
136 | } | ||
137 | |||
138 | static void a5k_floppy_enable_dma(dmach_t channel, dma_t *dma) | ||
139 | { | ||
140 | struct pt_regs regs; | ||
141 | void *fiqhandler_start; | ||
142 | unsigned int fiqhandler_length; | ||
143 | extern void floppy_fiqsetup(unsigned long len, unsigned long addr, | ||
144 | unsigned long port); | ||
145 | |||
146 | if (dma->using_sg) | ||
147 | BUG(); | ||
148 | |||
149 | if (dma->dma_mode == DMA_MODE_READ) { | ||
150 | extern unsigned char floppy_fiqin_start, floppy_fiqin_end; | ||
151 | fiqhandler_start = &floppy_fiqin_start; | ||
152 | fiqhandler_length = &floppy_fiqin_end - &floppy_fiqin_start; | ||
153 | } else { | ||
154 | extern unsigned char floppy_fiqout_start, floppy_fiqout_end; | ||
155 | fiqhandler_start = &floppy_fiqout_start; | ||
156 | fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start; | ||
157 | } | ||
158 | if (claim_fiq(&fh)) { | ||
159 | printk("floppydma: couldn't claim FIQ.\n"); | ||
160 | return; | ||
161 | } | ||
162 | memcpy((void *)0x1c, fiqhandler_start, fiqhandler_length); | ||
163 | regs.ARM_r9 = dma->buf.length; | ||
164 | regs.ARM_r10 = (unsigned long)dma->buf.__address; | ||
165 | regs.ARM_fp = FLOPPYDMA_BASE; | ||
166 | set_fiq_regs(®s); | ||
167 | enable_fiq(dma->dma_irq); | ||
168 | } | ||
169 | |||
170 | static void a5k_floppy_disable_dma(dmach_t channel, dma_t *dma) | ||
171 | { | ||
172 | disable_fiq(dma->dma_irq); | ||
173 | release_fiq(&fh); | ||
174 | } | ||
175 | |||
176 | static struct dma_ops a5k_floppy_dma_ops = { | ||
177 | .type = "FIQDMA", | ||
178 | .enable = a5k_floppy_enable_dma, | ||
179 | .disable = a5k_floppy_disable_dma, | ||
180 | .residue = a5k_floppy_get_dma_residue, | ||
181 | }; | ||
182 | #endif | ||
183 | |||
184 | /* | ||
185 | * This is virtual DMA - we don't need anything here | ||
186 | */ | ||
187 | static void sound_enable_disable_dma(dmach_t channel, dma_t *dma) | ||
188 | { | ||
189 | } | ||
190 | |||
191 | static struct dma_ops sound_dma_ops = { | ||
192 | .type = "VIRTUAL", | ||
193 | .enable = sound_enable_disable_dma, | ||
194 | .disable = sound_enable_disable_dma, | ||
195 | }; | ||
196 | |||
197 | void __init arch_dma_init(dma_t *dma) | ||
198 | { | ||
199 | #if defined(CONFIG_BLK_DEV_FD1772) || defined(CONFIG_BLK_DEV_FD1772_MODULE) | ||
200 | if (machine_is_archimedes()) { | ||
201 | dma[DMA_VIRTUAL_FLOPPY0].dma_irq = FIQ_FLOPPYDATA; | ||
202 | dma[DMA_VIRTUAL_FLOPPY0].d_ops = &arc_floppy_data_dma_ops; | ||
203 | dma[DMA_VIRTUAL_FLOPPY1].dma_irq = 1; | ||
204 | dma[DMA_VIRTUAL_FLOPPY1].d_ops = &arc_floppy_cmdend_dma_ops; | ||
205 | } | ||
206 | #endif | ||
207 | #ifdef CONFIG_ARCH_A5K | ||
208 | if (machine_is_a5k()) { | ||
209 | dma[DMA_VIRTUAL_FLOPPY0].dma_irq = FIQ_FLOPPYDATA; | ||
210 | dma[DMA_VIRTUAL_FLOPPY0].d_ops = &a5k_floppy_dma_ops; | ||
211 | } | ||
212 | #endif | ||
213 | dma[DMA_VIRTUAL_SOUND].d_ops = &sound_dma_ops; | ||
214 | } | ||