ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / arm / mach-ftvpci / core.c
1 /*
2  *  linux/arch/arm/mach-ftvpci/core.c
3  *
4  *  Architecture specific fixups.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11 #include <linux/kernel.h>
12 #include <linux/mm.h>
13 #include <linux/init.h>
14
15 #include <asm/setup.h>
16 #include <asm/mach-types.h>
17
18 #include <asm/mach/arch.h>
19 #include <asm/mach/map.h>
20 #include <asm/irq.h>
21 #include <asm/io.h>
22 #include <asm/pgtable.h>
23 #include <asm/page.h>
24
25 extern unsigned long soft_irq_mask;
26
27 static const unsigned char irq_cmd[] =
28 {
29         INTCONT_IRQ_DUART,
30         INTCONT_IRQ_PLX,
31         INTCONT_IRQ_D,
32         INTCONT_IRQ_C,
33         INTCONT_IRQ_B,
34         INTCONT_IRQ_A,
35         INTCONT_IRQ_SYSERR
36 };
37
38 static void ftvpci_mask_irq(unsigned int irq)
39 {
40         __raw_writel(irq_cmd[irq], INTCONT_BASE);
41         soft_irq_mask &= ~(1<<irq);
42 }
43
44 static void ftvpci_unmask_irq(unsigned int irq)
45 {
46         soft_irq_mask |= (1<<irq);
47         __raw_writel(irq_cmd[irq] | 1, INTCONT_BASE);
48 }
49  
50 static void __init ftvpci_init_irq(void)
51 {
52         unsigned int i;
53
54         /* Mask all FIQs */
55         __raw_writel(INTCONT_FIQ_PLX, INTCONT_BASE);
56         __raw_writel(INTCONT_FIQ_D, INTCONT_BASE);
57         __raw_writel(INTCONT_FIQ_C, INTCONT_BASE);
58         __raw_writel(INTCONT_FIQ_B, INTCONT_BASE);
59         __raw_writel(INTCONT_FIQ_A, INTCONT_BASE);
60         __raw_writel(INTCONT_FIQ_SYSERR, INTCONT_BASE);
61
62         /* Disable all interrupts initially. */
63         for (i = 0; i < NR_IRQS; i++) {
64                 if (i >= FIRST_IRQ && i <= LAST_IRQ) {
65                         irq_desc[i].valid       = 1;
66                         irq_desc[i].probe_ok    = 1;
67                         irq_desc[i].mask_ack    = ftvpci_mask_irq;
68                         irq_desc[i].mask        = ftvpci_mask_irq;
69                         irq_desc[i].unmask      = ftvpci_unmask_irq;
70                         ftvpci_mask_irq(i);
71                 } else {
72                         irq_desc[i].valid       = 0;
73                         irq_desc[i].probe_ok    = 0;
74                 }       
75         }               
76 }
77
78 static struct map_desc ftvpci_io_desc[] __initdata = {
79         { INTCONT_BASE, INTCONT_START,  0x00001000, MT_DEVICE },
80         { PLX_BASE,     PLX_START,      0x00001000, MT_DEVICE },
81         { PCIO_BASE,    PLX_IO_START,   0x00100000, MT_DEVICE },
82         { DUART_BASE,   DUART_START,    0x00001000, MT_DEVICE },
83         { STATUS_BASE,  STATUS_START,   0x00001000, MT_DEVICE }
84 };
85
86 static void __init ftvpci_map_io(void)
87 {
88         iotable_init(ftvpci_io_desc, ARRAY_SIZE(ftvpci_io_desc));
89 }
90
91 MACHINE_START(NEXUSPCI, "FTV/PCI")
92         MAINTAINER("Philip Blundell")
93         BOOT_MEM(0x40000000, 0x10000000, 0xe0000000)
94         MAPIO(ftvpci_map_io)
95         INITIRQ(ftvpci_init_irq)
96 MACHINE_END