import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / mips / jazz / setup.c
1 /*
2  * Setup pointers to hardware-dependent routines.
3  *
4  * This file is subject to the terms and conditions of the GNU General Public
5  * License.  See the file "COPYING" in the main directory of this archive
6  * for more details.
7  *
8  * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle
9  * Copyright (C) 2001 MIPS Technologies, Inc.
10  */
11 #include <linux/config.h>
12 #include <linux/hdreg.h>
13 #include <linux/init.h>
14 #include <linux/ioport.h>
15 #include <linux/sched.h>
16 #include <linux/interrupt.h>
17 #include <linux/mm.h>
18 #include <linux/console.h>
19 #include <linux/fb.h>
20 #include <linux/mc146818rtc.h>
21 #include <linux/ide.h>
22 #include <asm/bootinfo.h>
23 #include <asm/keyboard.h>
24 #include <asm/irq.h>
25 #include <asm/jazz.h>
26 #include <asm/jazzdma.h>
27 #include <asm/ptrace.h>
28 #include <asm/reboot.h>
29 #include <asm/io.h>
30 #include <asm/pgtable.h>
31 #include <asm/traps.h>
32
33 /*
34  * Initial irq handlers.
35  */
36 static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
37
38 /*
39  * IRQ2 is cascade interrupt to second interrupt controller
40  */
41 static struct irqaction irq2  = { no_action, 0, 0, "cascade", NULL, NULL};
42
43 extern asmlinkage void jazz_handle_int(void);
44
45 extern void jazz_machine_restart(char *command);
46 extern void jazz_machine_halt(void);
47 extern void jazz_machine_power_off(void);
48
49 extern struct ide_ops std_ide_ops;
50 extern struct rtc_ops jazz_rtc_ops;
51 extern struct kbd_ops jazz_kbd_ops;
52 extern struct fd_ops *fd_ops;
53 extern struct fd_ops jazz_fd_ops;
54
55 void (*board_time_init)(struct irqaction *irq);
56
57 static void __init jazz_time_init(struct irqaction *irq)
58 {
59         /* set the clock to 100 Hz */
60         r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
61         i8259_setup_irq(JAZZ_TIMER_IRQ, irq);
62 }
63
64 static void __init jazz_irq_setup(void)
65 {
66         set_except_vector(0, jazz_handle_int);
67         r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
68                           JAZZ_IE_ETHERNET |
69                           JAZZ_IE_SCSI     |
70                           JAZZ_IE_SERIAL1  |
71                           JAZZ_IE_SERIAL2  |
72                           JAZZ_IE_PARALLEL |
73                           JAZZ_IE_FLOPPY);
74         r4030_read_reg16(JAZZ_IO_IRQ_SOURCE); /* clear pending IRQs */
75         r4030_read_reg32(JAZZ_R4030_INVAL_ADDR); /* clear error bits */
76         change_c0_status(ST0_IM, IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1);
77         /* set the clock to 100 Hz */
78         r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
79         request_region(0x20, 0x20, "pic1");
80         request_region(0xa0, 0x20, "pic2");
81         i8259_setup_irq(2, &irq2);
82 }
83
84
85 void __init jazz_setup(void)
86 {
87         /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
88         add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K);
89
90         /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
91         add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M);
92
93         /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
94         add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M);
95
96         irq_setup = jazz_irq_setup;
97         set_io_port_base(JAZZ_PORT_BASE);
98         if (mips_machtype == MACH_MIPS_MAGNUM_4000)
99                 EISA_bus = 1;
100         isa_slot_offset = 0xe3000000;
101         request_region(0x00,0x20,"dma1");
102         request_region(0x40,0x20,"timer");
103         request_region(0x80,0x10,"dma page reg");
104         request_region(0xc0,0x20,"dma2");
105         board_time_init = jazz_time_init;
106         /* The RTC is outside the port address space */
107
108         _machine_restart = jazz_machine_restart;
109         _machine_halt = jazz_machine_halt;
110         _machine_power_off = jazz_machine_power_off;
111
112 #ifdef CONFIG_BLK_DEV_IDE
113         ide_ops = &std_ide_ops;
114 #endif
115 #ifdef CONFIG_BLK_DEV_FD
116         fd_ops = &jazz_fd_ops;
117 #endif
118 #ifdef CONFIG_VT
119         conswitchp = &dummy_con;
120 #endif
121
122 #warning "Somebody should check if screen_info is ok for Jazz."
123
124         screen_info = (struct screen_info) {
125                 0, 0,           /* orig-x, orig-y */
126                 0,              /* unused */
127                 0,              /* orig_video_page */
128                 0,              /* orig_video_mode */
129                 160,            /* orig_video_cols */
130                 0, 0, 0,        /* unused, ega_bx, unused */
131                 64,             /* orig_video_lines */
132                 0,              /* orig_video_isVGA */
133                 16              /* orig_video_points */
134         };
135
136         rtc_ops = &jazz_rtc_ops;
137         kbd_ops = &jazz_kbd_ops;
138
139         vdma_init();
140 }