diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-rpc |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/arm/mach-rpc')
-rw-r--r-- | arch/arm/mach-rpc/Makefile | 11 | ||||
-rw-r--r-- | arch/arm/mach-rpc/Makefile.boot | 4 | ||||
-rw-r--r-- | arch/arm/mach-rpc/dma.c | 338 | ||||
-rw-r--r-- | arch/arm/mach-rpc/irq.c | 162 | ||||
-rw-r--r-- | arch/arm/mach-rpc/riscpc.c | 179 |
5 files changed, 694 insertions, 0 deletions
diff --git a/arch/arm/mach-rpc/Makefile b/arch/arm/mach-rpc/Makefile new file mode 100644 index 000000000000..aa77bc9efbbb --- /dev/null +++ b/arch/arm/mach-rpc/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | |||
5 | # Object file lists. | ||
6 | |||
7 | obj-y := dma.o irq.o riscpc.o | ||
8 | obj-m := | ||
9 | obj-n := | ||
10 | obj- := | ||
11 | |||
diff --git a/arch/arm/mach-rpc/Makefile.boot b/arch/arm/mach-rpc/Makefile.boot new file mode 100644 index 000000000000..9c9e7685ec7c --- /dev/null +++ b/arch/arm/mach-rpc/Makefile.boot | |||
@@ -0,0 +1,4 @@ | |||
1 | zreladdr-y := 0x10008000 | ||
2 | params_phys-y := 0x10000100 | ||
3 | initrd_phys-y := 0x18000000 | ||
4 | |||
diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c new file mode 100644 index 000000000000..bc0747439fb3 --- /dev/null +++ b/arch/arm/mach-rpc/dma.c | |||
@@ -0,0 +1,338 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-rpc/dma.c | ||
3 | * | ||
4 | * Copyright (C) 1998 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * DMA functions specific to RiscPC architecture | ||
11 | */ | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/mman.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/pci.h> | ||
17 | |||
18 | #include <asm/page.h> | ||
19 | #include <asm/dma.h> | ||
20 | #include <asm/fiq.h> | ||
21 | #include <asm/io.h> | ||
22 | #include <asm/irq.h> | ||
23 | #include <asm/hardware.h> | ||
24 | #include <asm/uaccess.h> | ||
25 | |||
26 | #include <asm/mach/dma.h> | ||
27 | #include <asm/hardware/iomd.h> | ||
28 | |||
29 | #if 0 | ||
30 | typedef enum { | ||
31 | dma_size_8 = 1, | ||
32 | dma_size_16 = 2, | ||
33 | dma_size_32 = 4, | ||
34 | dma_size_128 = 16 | ||
35 | } dma_size_t; | ||
36 | #endif | ||
37 | |||
38 | #define TRANSFER_SIZE 2 | ||
39 | |||
40 | #define CURA (0) | ||
41 | #define ENDA (IOMD_IO0ENDA - IOMD_IO0CURA) | ||
42 | #define CURB (IOMD_IO0CURB - IOMD_IO0CURA) | ||
43 | #define ENDB (IOMD_IO0ENDB - IOMD_IO0CURA) | ||
44 | #define CR (IOMD_IO0CR - IOMD_IO0CURA) | ||
45 | #define ST (IOMD_IO0ST - IOMD_IO0CURA) | ||
46 | |||
47 | static void iomd_get_next_sg(struct scatterlist *sg, dma_t *dma) | ||
48 | { | ||
49 | unsigned long end, offset, flags = 0; | ||
50 | |||
51 | if (dma->sg) { | ||
52 | sg->dma_address = dma->sg->dma_address; | ||
53 | offset = sg->dma_address & ~PAGE_MASK; | ||
54 | |||
55 | end = offset + dma->sg->length; | ||
56 | |||
57 | if (end > PAGE_SIZE) | ||
58 | end = PAGE_SIZE; | ||
59 | |||
60 | if (offset + TRANSFER_SIZE >= end) | ||
61 | flags |= DMA_END_L; | ||
62 | |||
63 | sg->length = end - TRANSFER_SIZE; | ||
64 | |||
65 | dma->sg->length -= end - offset; | ||
66 | dma->sg->dma_address += end - offset; | ||
67 | |||
68 | if (dma->sg->length == 0) { | ||
69 | if (dma->sgcount > 1) { | ||
70 | dma->sg++; | ||
71 | dma->sgcount--; | ||
72 | } else { | ||
73 | dma->sg = NULL; | ||
74 | flags |= DMA_END_S; | ||
75 | } | ||
76 | } | ||
77 | } else { | ||
78 | flags = DMA_END_S | DMA_END_L; | ||
79 | sg->dma_address = 0; | ||
80 | sg->length = 0; | ||
81 | } | ||
82 | |||
83 | sg->length |= flags; | ||
84 | } | ||
85 | |||
86 | static irqreturn_t iomd_dma_handle(int irq, void *dev_id, struct pt_regs *regs) | ||
87 | { | ||
88 | dma_t *dma = (dma_t *)dev_id; | ||
89 | unsigned long base = dma->dma_base; | ||
90 | |||
91 | do { | ||
92 | unsigned int status; | ||
93 | |||
94 | status = iomd_readb(base + ST); | ||
95 | if (!(status & DMA_ST_INT)) | ||
96 | return IRQ_HANDLED; | ||
97 | |||
98 | if ((dma->state ^ status) & DMA_ST_AB) | ||
99 | iomd_get_next_sg(&dma->cur_sg, dma); | ||
100 | |||
101 | switch (status & (DMA_ST_OFL | DMA_ST_AB)) { | ||
102 | case DMA_ST_OFL: /* OIA */ | ||
103 | case DMA_ST_AB: /* .IB */ | ||
104 | iomd_writel(dma->cur_sg.dma_address, base + CURA); | ||
105 | iomd_writel(dma->cur_sg.length, base + ENDA); | ||
106 | dma->state = DMA_ST_AB; | ||
107 | break; | ||
108 | |||
109 | case DMA_ST_OFL | DMA_ST_AB: /* OIB */ | ||
110 | case 0: /* .IA */ | ||
111 | iomd_writel(dma->cur_sg.dma_address, base + CURB); | ||
112 | iomd_writel(dma->cur_sg.length, base + ENDB); | ||
113 | dma->state = 0; | ||
114 | break; | ||
115 | } | ||
116 | |||
117 | if (status & DMA_ST_OFL && | ||
118 | dma->cur_sg.length == (DMA_END_S|DMA_END_L)) | ||
119 | break; | ||
120 | } while (1); | ||
121 | |||
122 | dma->state = ~DMA_ST_AB; | ||
123 | disable_irq(irq); | ||
124 | |||
125 | return IRQ_HANDLED; | ||
126 | } | ||
127 | |||
128 | static int iomd_request_dma(dmach_t channel, dma_t *dma) | ||
129 | { | ||
130 | return request_irq(dma->dma_irq, iomd_dma_handle, | ||
131 | SA_INTERRUPT, dma->device_id, dma); | ||
132 | } | ||
133 | |||
134 | static void iomd_free_dma(dmach_t channel, dma_t *dma) | ||
135 | { | ||
136 | free_irq(dma->dma_irq, dma); | ||
137 | } | ||
138 | |||
139 | static void iomd_enable_dma(dmach_t channel, dma_t *dma) | ||
140 | { | ||
141 | unsigned long dma_base = dma->dma_base; | ||
142 | unsigned int ctrl = TRANSFER_SIZE | DMA_CR_E; | ||
143 | |||
144 | if (dma->invalid) { | ||
145 | dma->invalid = 0; | ||
146 | |||
147 | /* | ||
148 | * Cope with ISA-style drivers which expect cache | ||
149 | * coherence. | ||
150 | */ | ||
151 | if (!dma->using_sg) { | ||
152 | dma->buf.dma_address = pci_map_single(NULL, | ||
153 | dma->buf.__address, dma->buf.length, | ||
154 | dma->dma_mode == DMA_MODE_READ ? | ||
155 | PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | ||
156 | } | ||
157 | |||
158 | iomd_writeb(DMA_CR_C, dma_base + CR); | ||
159 | dma->state = DMA_ST_AB; | ||
160 | } | ||
161 | |||
162 | if (dma->dma_mode == DMA_MODE_READ) | ||
163 | ctrl |= DMA_CR_D; | ||
164 | |||
165 | iomd_writeb(ctrl, dma_base + CR); | ||
166 | enable_irq(dma->dma_irq); | ||
167 | } | ||
168 | |||
169 | static void iomd_disable_dma(dmach_t channel, dma_t *dma) | ||
170 | { | ||
171 | unsigned long dma_base = dma->dma_base; | ||
172 | unsigned long flags; | ||
173 | |||
174 | local_irq_save(flags); | ||
175 | if (dma->state != ~DMA_ST_AB) | ||
176 | disable_irq(dma->dma_irq); | ||
177 | iomd_writeb(0, dma_base + CR); | ||
178 | local_irq_restore(flags); | ||
179 | } | ||
180 | |||
181 | static int iomd_set_dma_speed(dmach_t channel, dma_t *dma, int cycle) | ||
182 | { | ||
183 | int tcr, speed; | ||
184 | |||
185 | if (cycle < 188) | ||
186 | speed = 3; | ||
187 | else if (cycle <= 250) | ||
188 | speed = 2; | ||
189 | else if (cycle < 438) | ||
190 | speed = 1; | ||
191 | else | ||
192 | speed = 0; | ||
193 | |||
194 | tcr = iomd_readb(IOMD_DMATCR); | ||
195 | speed &= 3; | ||
196 | |||
197 | switch (channel) { | ||
198 | case DMA_0: | ||
199 | tcr = (tcr & ~0x03) | speed; | ||
200 | break; | ||
201 | |||
202 | case DMA_1: | ||
203 | tcr = (tcr & ~0x0c) | (speed << 2); | ||
204 | break; | ||
205 | |||
206 | case DMA_2: | ||
207 | tcr = (tcr & ~0x30) | (speed << 4); | ||
208 | break; | ||
209 | |||
210 | case DMA_3: | ||
211 | tcr = (tcr & ~0xc0) | (speed << 6); | ||
212 | break; | ||
213 | |||
214 | default: | ||
215 | break; | ||
216 | } | ||
217 | |||
218 | iomd_writeb(tcr, IOMD_DMATCR); | ||
219 | |||
220 | return speed; | ||
221 | } | ||
222 | |||
223 | static struct dma_ops iomd_dma_ops = { | ||
224 | .type = "IOMD", | ||
225 | .request = iomd_request_dma, | ||
226 | .free = iomd_free_dma, | ||
227 | .enable = iomd_enable_dma, | ||
228 | .disable = iomd_disable_dma, | ||
229 | .setspeed = iomd_set_dma_speed, | ||
230 | }; | ||
231 | |||
232 | static struct fiq_handler fh = { | ||
233 | .name = "floppydma" | ||
234 | }; | ||
235 | |||
236 | static void floppy_enable_dma(dmach_t channel, dma_t *dma) | ||
237 | { | ||
238 | void *fiqhandler_start; | ||
239 | unsigned int fiqhandler_length; | ||
240 | struct pt_regs regs; | ||
241 | |||
242 | if (dma->using_sg) | ||
243 | BUG(); | ||
244 | |||
245 | if (dma->dma_mode == DMA_MODE_READ) { | ||
246 | extern unsigned char floppy_fiqin_start, floppy_fiqin_end; | ||
247 | fiqhandler_start = &floppy_fiqin_start; | ||
248 | fiqhandler_length = &floppy_fiqin_end - &floppy_fiqin_start; | ||
249 | } else { | ||
250 | extern unsigned char floppy_fiqout_start, floppy_fiqout_end; | ||
251 | fiqhandler_start = &floppy_fiqout_start; | ||
252 | fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start; | ||
253 | } | ||
254 | |||
255 | regs.ARM_r9 = dma->buf.length; | ||
256 | regs.ARM_r10 = (unsigned long)dma->buf.__address; | ||
257 | regs.ARM_fp = (unsigned long)FLOPPYDMA_BASE; | ||
258 | |||
259 | if (claim_fiq(&fh)) { | ||
260 | printk("floppydma: couldn't claim FIQ.\n"); | ||
261 | return; | ||
262 | } | ||
263 | |||
264 | set_fiq_handler(fiqhandler_start, fiqhandler_length); | ||
265 | set_fiq_regs(®s); | ||
266 | enable_fiq(dma->dma_irq); | ||
267 | } | ||
268 | |||
269 | static void floppy_disable_dma(dmach_t channel, dma_t *dma) | ||
270 | { | ||
271 | disable_fiq(dma->dma_irq); | ||
272 | release_fiq(&fh); | ||
273 | } | ||
274 | |||
275 | static int floppy_get_residue(dmach_t channel, dma_t *dma) | ||
276 | { | ||
277 | struct pt_regs regs; | ||
278 | get_fiq_regs(®s); | ||
279 | return regs.ARM_r9; | ||
280 | } | ||
281 | |||
282 | static struct dma_ops floppy_dma_ops = { | ||
283 | .type = "FIQDMA", | ||
284 | .enable = floppy_enable_dma, | ||
285 | .disable = floppy_disable_dma, | ||
286 | .residue = floppy_get_residue, | ||
287 | }; | ||
288 | |||
289 | /* | ||
290 | * This is virtual DMA - we don't need anything here. | ||
291 | */ | ||
292 | static void sound_enable_disable_dma(dmach_t channel, dma_t *dma) | ||
293 | { | ||
294 | } | ||
295 | |||
296 | static struct dma_ops sound_dma_ops = { | ||
297 | .type = "VIRTUAL", | ||
298 | .enable = sound_enable_disable_dma, | ||
299 | .disable = sound_enable_disable_dma, | ||
300 | }; | ||
301 | |||
302 | void __init arch_dma_init(dma_t *dma) | ||
303 | { | ||
304 | iomd_writeb(0, IOMD_IO0CR); | ||
305 | iomd_writeb(0, IOMD_IO1CR); | ||
306 | iomd_writeb(0, IOMD_IO2CR); | ||
307 | iomd_writeb(0, IOMD_IO3CR); | ||
308 | |||
309 | iomd_writeb(0xa0, IOMD_DMATCR); | ||
310 | |||
311 | dma[DMA_0].dma_base = IOMD_IO0CURA; | ||
312 | dma[DMA_0].dma_irq = IRQ_DMA0; | ||
313 | dma[DMA_0].d_ops = &iomd_dma_ops; | ||
314 | dma[DMA_1].dma_base = IOMD_IO1CURA; | ||
315 | dma[DMA_1].dma_irq = IRQ_DMA1; | ||
316 | dma[DMA_1].d_ops = &iomd_dma_ops; | ||
317 | dma[DMA_2].dma_base = IOMD_IO2CURA; | ||
318 | dma[DMA_2].dma_irq = IRQ_DMA2; | ||
319 | dma[DMA_2].d_ops = &iomd_dma_ops; | ||
320 | dma[DMA_3].dma_base = IOMD_IO3CURA; | ||
321 | dma[DMA_3].dma_irq = IRQ_DMA3; | ||
322 | dma[DMA_3].d_ops = &iomd_dma_ops; | ||
323 | dma[DMA_S0].dma_base = IOMD_SD0CURA; | ||
324 | dma[DMA_S0].dma_irq = IRQ_DMAS0; | ||
325 | dma[DMA_S0].d_ops = &iomd_dma_ops; | ||
326 | dma[DMA_S1].dma_base = IOMD_SD1CURA; | ||
327 | dma[DMA_S1].dma_irq = IRQ_DMAS1; | ||
328 | dma[DMA_S1].d_ops = &iomd_dma_ops; | ||
329 | dma[DMA_VIRTUAL_FLOPPY].dma_irq = FIQ_FLOPPYDATA; | ||
330 | dma[DMA_VIRTUAL_FLOPPY].d_ops = &floppy_dma_ops; | ||
331 | dma[DMA_VIRTUAL_SOUND].d_ops = &sound_dma_ops; | ||
332 | |||
333 | /* | ||
334 | * Setup DMA channels 2,3 to be for podules | ||
335 | * and channels 0,1 for internal devices | ||
336 | */ | ||
337 | iomd_writeb(DMA_EXT_IO3|DMA_EXT_IO2, IOMD_DMAEXT); | ||
338 | } | ||
diff --git a/arch/arm/mach-rpc/irq.c b/arch/arm/mach-rpc/irq.c new file mode 100644 index 000000000000..56b2716f8cf5 --- /dev/null +++ b/arch/arm/mach-rpc/irq.c | |||
@@ -0,0 +1,162 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/list.h> | ||
3 | |||
4 | #include <asm/mach/irq.h> | ||
5 | #include <asm/hardware/iomd.h> | ||
6 | #include <asm/irq.h> | ||
7 | #include <asm/io.h> | ||
8 | |||
9 | static void iomd_ack_irq_a(unsigned int irq) | ||
10 | { | ||
11 | unsigned int val, mask; | ||
12 | |||
13 | mask = 1 << irq; | ||
14 | val = iomd_readb(IOMD_IRQMASKA); | ||
15 | iomd_writeb(val & ~mask, IOMD_IRQMASKA); | ||
16 | iomd_writeb(mask, IOMD_IRQCLRA); | ||
17 | } | ||
18 | |||
19 | static void iomd_mask_irq_a(unsigned int irq) | ||
20 | { | ||
21 | unsigned int val, mask; | ||
22 | |||
23 | mask = 1 << irq; | ||
24 | val = iomd_readb(IOMD_IRQMASKA); | ||
25 | iomd_writeb(val & ~mask, IOMD_IRQMASKA); | ||
26 | } | ||
27 | |||
28 | static void iomd_unmask_irq_a(unsigned int irq) | ||
29 | { | ||
30 | unsigned int val, mask; | ||
31 | |||
32 | mask = 1 << irq; | ||
33 | val = iomd_readb(IOMD_IRQMASKA); | ||
34 | iomd_writeb(val | mask, IOMD_IRQMASKA); | ||
35 | } | ||
36 | |||
37 | static struct irqchip iomd_a_chip = { | ||
38 | .ack = iomd_ack_irq_a, | ||
39 | .mask = iomd_mask_irq_a, | ||
40 | .unmask = iomd_unmask_irq_a, | ||
41 | }; | ||
42 | |||
43 | static void iomd_mask_irq_b(unsigned int irq) | ||
44 | { | ||
45 | unsigned int val, mask; | ||
46 | |||
47 | mask = 1 << (irq & 7); | ||
48 | val = iomd_readb(IOMD_IRQMASKB); | ||
49 | iomd_writeb(val & ~mask, IOMD_IRQMASKB); | ||
50 | } | ||
51 | |||
52 | static void iomd_unmask_irq_b(unsigned int irq) | ||
53 | { | ||
54 | unsigned int val, mask; | ||
55 | |||
56 | mask = 1 << (irq & 7); | ||
57 | val = iomd_readb(IOMD_IRQMASKB); | ||
58 | iomd_writeb(val | mask, IOMD_IRQMASKB); | ||
59 | } | ||
60 | |||
61 | static struct irqchip iomd_b_chip = { | ||
62 | .ack = iomd_mask_irq_b, | ||
63 | .mask = iomd_mask_irq_b, | ||
64 | .unmask = iomd_unmask_irq_b, | ||
65 | }; | ||
66 | |||
67 | static void iomd_mask_irq_dma(unsigned int irq) | ||
68 | { | ||
69 | unsigned int val, mask; | ||
70 | |||
71 | mask = 1 << (irq & 7); | ||
72 | val = iomd_readb(IOMD_DMAMASK); | ||
73 | iomd_writeb(val & ~mask, IOMD_DMAMASK); | ||
74 | } | ||
75 | |||
76 | static void iomd_unmask_irq_dma(unsigned int irq) | ||
77 | { | ||
78 | unsigned int val, mask; | ||
79 | |||
80 | mask = 1 << (irq & 7); | ||
81 | val = iomd_readb(IOMD_DMAMASK); | ||
82 | iomd_writeb(val | mask, IOMD_DMAMASK); | ||
83 | } | ||
84 | |||
85 | static struct irqchip iomd_dma_chip = { | ||
86 | .ack = iomd_mask_irq_dma, | ||
87 | .mask = iomd_mask_irq_dma, | ||
88 | .unmask = iomd_unmask_irq_dma, | ||
89 | }; | ||
90 | |||
91 | static void iomd_mask_irq_fiq(unsigned int irq) | ||
92 | { | ||
93 | unsigned int val, mask; | ||
94 | |||
95 | mask = 1 << (irq & 7); | ||
96 | val = iomd_readb(IOMD_FIQMASK); | ||
97 | iomd_writeb(val & ~mask, IOMD_FIQMASK); | ||
98 | } | ||
99 | |||
100 | static void iomd_unmask_irq_fiq(unsigned int irq) | ||
101 | { | ||
102 | unsigned int val, mask; | ||
103 | |||
104 | mask = 1 << (irq & 7); | ||
105 | val = iomd_readb(IOMD_FIQMASK); | ||
106 | iomd_writeb(val | mask, IOMD_FIQMASK); | ||
107 | } | ||
108 | |||
109 | static struct irqchip iomd_fiq_chip = { | ||
110 | .ack = iomd_mask_irq_fiq, | ||
111 | .mask = iomd_mask_irq_fiq, | ||
112 | .unmask = iomd_unmask_irq_fiq, | ||
113 | }; | ||
114 | |||
115 | void __init rpc_init_irq(void) | ||
116 | { | ||
117 | unsigned int irq, flags; | ||
118 | |||
119 | iomd_writeb(0, IOMD_IRQMASKA); | ||
120 | iomd_writeb(0, IOMD_IRQMASKB); | ||
121 | iomd_writeb(0, IOMD_FIQMASK); | ||
122 | iomd_writeb(0, IOMD_DMAMASK); | ||
123 | |||
124 | for (irq = 0; irq < NR_IRQS; irq++) { | ||
125 | flags = IRQF_VALID; | ||
126 | |||
127 | if (irq <= 6 || (irq >= 9 && irq <= 15)) | ||
128 | flags |= IRQF_PROBE; | ||
129 | |||
130 | if (irq == 21 || (irq >= 16 && irq <= 19) || | ||
131 | irq == IRQ_KEYBOARDTX) | ||
132 | flags |= IRQF_NOAUTOEN; | ||
133 | |||
134 | switch (irq) { | ||
135 | case 0 ... 7: | ||
136 | set_irq_chip(irq, &iomd_a_chip); | ||
137 | set_irq_handler(irq, do_level_IRQ); | ||
138 | set_irq_flags(irq, flags); | ||
139 | break; | ||
140 | |||
141 | case 8 ... 15: | ||
142 | set_irq_chip(irq, &iomd_b_chip); | ||
143 | set_irq_handler(irq, do_level_IRQ); | ||
144 | set_irq_flags(irq, flags); | ||
145 | break; | ||
146 | |||
147 | case 16 ... 21: | ||
148 | set_irq_chip(irq, &iomd_dma_chip); | ||
149 | set_irq_handler(irq, do_level_IRQ); | ||
150 | set_irq_flags(irq, flags); | ||
151 | break; | ||
152 | |||
153 | case 64 ... 71: | ||
154 | set_irq_chip(irq, &iomd_fiq_chip); | ||
155 | set_irq_flags(irq, IRQF_VALID); | ||
156 | break; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | init_FIQ(); | ||
161 | } | ||
162 | |||
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c new file mode 100644 index 000000000000..815c53225cd8 --- /dev/null +++ b/arch/arm/mach-rpc/riscpc.c | |||
@@ -0,0 +1,179 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-rpc/riscpc.c | ||
3 | * | ||
4 | * Copyright (C) 1998-2001 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Architecture specific fixups. | ||
11 | */ | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/tty.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/pm.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/serial_8250.h> | ||
20 | |||
21 | #include <asm/elf.h> | ||
22 | #include <asm/io.h> | ||
23 | #include <asm/mach-types.h> | ||
24 | #include <asm/hardware.h> | ||
25 | #include <asm/page.h> | ||
26 | #include <asm/domain.h> | ||
27 | #include <asm/setup.h> | ||
28 | |||
29 | #include <asm/mach/map.h> | ||
30 | #include <asm/mach/arch.h> | ||
31 | #include <asm/mach/time.h> | ||
32 | |||
33 | extern void rpc_init_irq(void); | ||
34 | |||
35 | extern unsigned int vram_size; | ||
36 | |||
37 | #if 0 | ||
38 | |||
39 | unsigned int memc_ctrl_reg; | ||
40 | unsigned int number_mfm_drives; | ||
41 | |||
42 | static int __init parse_tag_acorn(const struct tag *tag) | ||
43 | { | ||
44 | memc_ctrl_reg = tag->u.acorn.memc_control_reg; | ||
45 | number_mfm_drives = tag->u.acorn.adfsdrives; | ||
46 | |||
47 | switch (tag->u.acorn.vram_pages) { | ||
48 | case 512: | ||
49 | vram_size += PAGE_SIZE * 256; | ||
50 | case 256: | ||
51 | vram_size += PAGE_SIZE * 256; | ||
52 | default: | ||
53 | break; | ||
54 | } | ||
55 | #if 0 | ||
56 | if (vram_size) { | ||
57 | desc->video_start = 0x02000000; | ||
58 | desc->video_end = 0x02000000 + vram_size; | ||
59 | } | ||
60 | #endif | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | __tagtable(ATAG_ACORN, parse_tag_acorn); | ||
65 | |||
66 | #endif | ||
67 | |||
68 | static struct map_desc rpc_io_desc[] __initdata = { | ||
69 | { SCREEN_BASE, SCREEN_START, 2*1048576, MT_DEVICE }, /* VRAM */ | ||
70 | { (u32)IO_BASE, IO_START, IO_SIZE , MT_DEVICE }, /* IO space */ | ||
71 | { EASI_BASE, EASI_START, EASI_SIZE, MT_DEVICE } /* EASI space */ | ||
72 | }; | ||
73 | |||
74 | static void __init rpc_map_io(void) | ||
75 | { | ||
76 | iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc)); | ||
77 | |||
78 | /* | ||
79 | * Turn off floppy. | ||
80 | */ | ||
81 | outb(0xc, 0x3f2); | ||
82 | |||
83 | /* | ||
84 | * RiscPC can't handle half-word loads and stores | ||
85 | */ | ||
86 | elf_hwcap &= ~HWCAP_HALF; | ||
87 | } | ||
88 | |||
89 | static struct resource acornfb_resources[] = { | ||
90 | { /* VIDC */ | ||
91 | .start = 0x03400000, | ||
92 | .end = 0x035fffff, | ||
93 | .flags = IORESOURCE_MEM, | ||
94 | }, { | ||
95 | .start = IRQ_VSYNCPULSE, | ||
96 | .end = IRQ_VSYNCPULSE, | ||
97 | .flags = IORESOURCE_IRQ, | ||
98 | }, | ||
99 | }; | ||
100 | |||
101 | static struct platform_device acornfb_device = { | ||
102 | .name = "acornfb", | ||
103 | .id = -1, | ||
104 | .dev = { | ||
105 | .coherent_dma_mask = 0xffffffff, | ||
106 | }, | ||
107 | .num_resources = ARRAY_SIZE(acornfb_resources), | ||
108 | .resource = acornfb_resources, | ||
109 | }; | ||
110 | |||
111 | static struct resource iomd_resources[] = { | ||
112 | { | ||
113 | .start = 0x03200000, | ||
114 | .end = 0x0320ffff, | ||
115 | .flags = IORESOURCE_MEM, | ||
116 | }, | ||
117 | }; | ||
118 | |||
119 | static struct platform_device iomd_device = { | ||
120 | .name = "iomd", | ||
121 | .id = -1, | ||
122 | .num_resources = ARRAY_SIZE(iomd_resources), | ||
123 | .resource = iomd_resources, | ||
124 | }; | ||
125 | |||
126 | static struct platform_device kbd_device = { | ||
127 | .name = "kart", | ||
128 | .id = -1, | ||
129 | .dev = { | ||
130 | .parent = &iomd_device.dev, | ||
131 | }, | ||
132 | }; | ||
133 | |||
134 | static struct plat_serial8250_port serial_platform_data[] = { | ||
135 | { | ||
136 | .mapbase = 0x03010fe0, | ||
137 | .irq = 10, | ||
138 | .uartclk = 1843200, | ||
139 | .regshift = 2, | ||
140 | .iotype = UPIO_MEM, | ||
141 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST, | ||
142 | }, | ||
143 | { }, | ||
144 | }; | ||
145 | |||
146 | static struct platform_device serial_device = { | ||
147 | .name = "serial8250", | ||
148 | .id = 0, | ||
149 | .dev = { | ||
150 | .platform_data = serial_platform_data, | ||
151 | }, | ||
152 | }; | ||
153 | |||
154 | static struct platform_device *devs[] __initdata = { | ||
155 | &iomd_device, | ||
156 | &kbd_device, | ||
157 | &serial_device, | ||
158 | &acornfb_device, | ||
159 | }; | ||
160 | |||
161 | static int __init rpc_init(void) | ||
162 | { | ||
163 | return platform_add_devices(devs, ARRAY_SIZE(devs)); | ||
164 | } | ||
165 | |||
166 | arch_initcall(rpc_init); | ||
167 | |||
168 | extern struct sys_timer ioc_timer; | ||
169 | |||
170 | MACHINE_START(RISCPC, "Acorn-RiscPC") | ||
171 | MAINTAINER("Russell King") | ||
172 | BOOT_MEM(0x10000000, 0x03000000, 0xe0000000) | ||
173 | BOOT_PARAMS(0x10000100) | ||
174 | DISABLE_PARPORT(0) | ||
175 | DISABLE_PARPORT(1) | ||
176 | MAPIO(rpc_map_io) | ||
177 | INITIRQ(rpc_init_irq) | ||
178 | .timer = &ioc_timer, | ||
179 | MACHINE_END | ||