Merge branch 'x86/amd-nb' into x86/apic-cleanups
[pandora-kernel.git] / arch / mn10300 / unit-asb2364 / unit-init.c
1 /* ASB2364 initialisation
2  *
3  * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
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
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/device.h>
16 #include <linux/delay.h>
17
18 #include <asm/io.h>
19 #include <asm/setup.h>
20 #include <asm/processor.h>
21 #include <asm/irq.h>
22 #include <asm/intctl-regs.h>
23 #include <unit/fpga-regs.h>
24
25 /*
26  * initialise some of the unit hardware before gdbstub is set up
27  */
28 asmlinkage void __init unit_init(void)
29 {
30         /* set up the external interrupts */
31
32         /* XIRQ[0]: NAND RXBY */
33         /* SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_LOWLEVEL); */
34
35         /* XIRQ[1]: LAN, UART, I2C, USB, PCI, FPGA */
36         SET_XIRQ_TRIGGER(1, XIRQ_TRIGGER_LOWLEVEL);
37
38         /* XIRQ[2]: Extend Slot 1-9 */
39         /* SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); */
40
41 #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) &&     \
42     defined(CONFIG_ETHERNET_IRQ_LEVEL) &&       \
43     (CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL)
44 # error CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL
45 #endif
46
47 #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL)
48         set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL));
49 #elif defined(CONFIG_ETHERNET_IRQ_LEVEL)
50         set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_ETHERNET_IRQ_LEVEL));
51 #endif
52 }
53
54 /*
55  * initialise the rest of the unit hardware after gdbstub is ready
56  */
57 asmlinkage void __init unit_setup(void)
58 {
59
60 }
61
62 /*
63  * initialise the external interrupts used by a unit of this type
64  */
65 void __init unit_init_IRQ(void)
66 {
67         unsigned int extnum;
68
69         for (extnum = 0 ; extnum < NR_XIRQS ; extnum++) {
70                 switch (GET_XIRQ_TRIGGER(extnum)) {
71                         /* LEVEL triggered interrupts should be made
72                          * post-ACK'able as they hold their lines until
73                          * serviced
74                          */
75                 case XIRQ_TRIGGER_HILEVEL:
76                 case XIRQ_TRIGGER_LOWLEVEL:
77                         mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum));
78                         break;
79                 default:
80                         break;
81                 }
82         }
83
84 #define IRQCTL  __SYSREG(0xd5000090, u32)
85         IRQCTL |= 0x02;
86
87         irq_fpga_init();
88 }