ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / arm / mach-ebsa110 / core.c
1 /*
2  *  linux/arch/arm/mach-ebsa110/core.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  *  Extra MM routines for the EBSA-110 architecture
11  */
12 #include <linux/kernel.h>
13 #include <linux/mm.h>
14 #include <linux/init.h>
15
16 #include <asm/hardware.h>
17 #include <asm/irq.h>
18 #include <asm/io.h>
19 #include <asm/setup.h>
20 #include <asm/mach-types.h>
21 #include <asm/pgtable.h>
22 #include <asm/page.h>
23 #include <asm/system.h>
24
25 #include <asm/mach/arch.h>
26 #include <asm/mach/irq.h>
27 #include <asm/mach/map.h>
28
29 #define IRQ_MASK                0xfe000000      /* read */
30 #define IRQ_MSET                0xfe000000      /* write */
31 #define IRQ_STAT                0xff000000      /* read */
32 #define IRQ_MCLR                0xff000000      /* write */
33
34 static void ebsa110_mask_irq(unsigned int irq)
35 {
36         __raw_writeb(1 << irq, IRQ_MCLR);
37 }
38
39 static void ebsa110_unmask_irq(unsigned int irq)
40 {
41         __raw_writeb(1 << irq, IRQ_MSET);
42 }
43
44 static struct irqchip ebsa110_irq_chip = {
45         .ack    = ebsa110_mask_irq,
46         .mask   = ebsa110_mask_irq,
47         .unmask = ebsa110_unmask_irq,
48 };
49  
50 static void __init ebsa110_init_irq(void)
51 {
52         unsigned long flags;
53         unsigned int irq;
54
55         local_irq_save(flags);
56         __raw_writeb(0xff, IRQ_MCLR);
57         __raw_writeb(0x55, IRQ_MSET);
58         __raw_writeb(0x00, IRQ_MSET);
59         if (__raw_readb(IRQ_MASK) != 0x55)
60                 while (1);
61         __raw_writeb(0xff, IRQ_MCLR);   /* clear all interrupt enables */
62         local_irq_restore(flags);
63
64         for (irq = 0; irq < NR_IRQS; irq++) {
65                 set_irq_chip(irq, &ebsa110_irq_chip);
66                 set_irq_handler(irq, do_level_IRQ);
67                 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
68         }
69 }
70
71 static struct map_desc ebsa110_io_desc[] __initdata = {
72         /*
73          * sparse external-decode ISAIO space
74          */
75         { IRQ_STAT,    TRICK4_PHYS, PGDIR_SIZE,  MT_DEVICE }, /* IRQ_STAT/IRQ_MCLR */
76         { IRQ_MASK,    TRICK3_PHYS, PGDIR_SIZE,  MT_DEVICE }, /* IRQ_MASK/IRQ_MSET */
77         { SOFT_BASE,   TRICK1_PHYS, PGDIR_SIZE,  MT_DEVICE }, /* SOFT_BASE */
78         { PIT_BASE,    TRICK0_PHYS, PGDIR_SIZE,  MT_DEVICE }, /* PIT_BASE */
79
80         /*
81          * self-decode ISAIO space
82          */
83         { ISAIO_BASE,  ISAIO_PHYS,  ISAIO_SIZE,  MT_DEVICE },
84         { ISAMEM_BASE, ISAMEM_PHYS, ISAMEM_SIZE, MT_DEVICE }
85 };
86
87 static void __init ebsa110_map_io(void)
88 {
89         iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc));
90 }
91
92 MACHINE_START(EBSA110, "EBSA110")
93         MAINTAINER("Russell King")
94         BOOT_MEM(0x00000000, 0xe0000000, 0xe0000000)
95         BOOT_PARAMS(0x00000400)
96         DISABLE_PARPORT(0)
97         DISABLE_PARPORT(2)
98         SOFT_REBOOT
99         MAPIO(ebsa110_map_io)
100         INITIRQ(ebsa110_init_irq)
101 MACHINE_END