1 /* $Id: setup.c,v 1.10 1999/01/04 16:03:59 ralf Exp $
3 * Setup pointers to hardware-dependent routines.
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
9 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
11 #include <asm/ptrace.h>
12 #include <linux/config.h>
13 #include <linux/hdreg.h>
14 #include <linux/ioport.h>
15 #include <linux/sched.h>
16 #include <linux/init.h>
17 #include <linux/interrupt.h>
18 #include <linux/timex.h>
19 #include <linux/pci.h>
20 #include <linux/mc146818rtc.h>
21 #include <linux/console.h>
23 #include <linux/pc_keyb.h>
25 #include <asm/bcache.h>
26 #include <asm/bootinfo.h>
27 #include <asm/keyboard.h>
31 #include <asm/processor.h>
32 #include <asm/reboot.h>
37 * Initial irq handlers.
39 static void no_action(int cpl
, void *dev_id
, struct pt_regs
*regs
) { }
42 * IRQ2 is cascade interrupt to second interrupt controller
44 static struct irqaction irq2
= { no_action
, 0, 0, "cascade", NULL
, NULL
};
46 extern asmlinkage
void sni_rm200_pci_handle_int(void);
48 extern void sni_machine_restart(char *command
);
49 extern void sni_machine_halt(void);
50 extern void sni_machine_power_off(void);
52 extern struct ide_ops std_ide_ops
;
53 extern struct rtc_ops std_rtc_ops
;
54 extern struct kbd_ops std_kbd_ops
;
56 __initfunc(static void sni_irq_setup(void))
58 set_except_vector(0, sni_rm200_pci_handle_int
);
59 request_region(0x20,0x20, "pic1");
60 request_region(0xa0,0x20, "pic2");
61 i8259_setup_irq(2, &irq2
);
63 * IRQ0 seems to be the irq for PC style stuff.
64 * I don't know how to handle the debug button interrupt, so
65 * don't use this button yet or bad things happen ...
67 set_cp0_status(ST0_IM
, IE_IRQ1
| IE_IRQ3
| IE_IRQ4
);
70 void (*board_time_init
)(struct irqaction
*irq
);
72 __initfunc(static void sni_rm200_pci_time_init(struct irqaction
*irq
))
74 /* set the clock to 100 Hz */
75 outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
76 outb_p(LATCH
& 0xff , 0x40); /* LSB */
77 outb(LATCH
>> 8 , 0x40); /* MSB */
78 i8259_setup_irq(0, irq
);
81 unsigned char aux_device_present
;
82 extern struct pci_ops sni_pci_ops
;
83 extern unsigned char sni_map_isa_cache
;
86 * A bit more gossip about the iron we're running on ...
88 static inline void sni_pcimt_detect(void)
95 csmsr
= *(volatile unsigned char *)PCIMT_CSMSR
;
97 p
+= sprintf(p
, "%s PCI", (csmsr
& 0x80) ? "RM200" : "RM300");
98 if ((csmsr
& 0x80) == 0)
99 p
+= sprintf(p
, ", board revision %s",
100 (csmsr
& 0x20) ? "D" : "C");
102 asic
= (csmsr
& 0x08) ? asic
: !asic
;
103 p
+= sprintf(p
, ", ASIC PCI Rev %s", asic
? "1.0" : "1.1");
104 printk("%s.\n", boardtype
);
107 __initfunc(void sni_rm200_pci_setup(void))
112 * We just check if a tag_screen_info can be gathered
113 * in setup_arch(), if yes we don't proceed futher...
115 atag
= bi_TagFind(tag_screen_info
);
118 * If no, we try to find the tag_arc_displayinfo which is
119 * always created by Milo for an ARC box (for now Milo only
120 * works on ARC boxes :) -Stoned.
122 atag
= bi_TagFind(tag_arcdisplayinfo
);
125 ((mips_arc_DisplayInfo
*)TAGVALPTR(atag
))->cursor_x
;
127 ((mips_arc_DisplayInfo
*)TAGVALPTR(atag
))->cursor_y
;
128 screen_info
.orig_video_cols
=
129 ((mips_arc_DisplayInfo
*)TAGVALPTR(atag
))->columns
;
130 screen_info
.orig_video_lines
=
131 ((mips_arc_DisplayInfo
*)TAGVALPTR(atag
))->lines
;
138 irq_setup
= sni_irq_setup
;
139 mips_io_port_base
= SNI_PORT_BASE
;
142 * Setup (E)ISA I/O memory access stuff
144 isa_slot_offset
= 0xb0000000;
145 // sni_map_isa_cache = 0;
148 request_region(0x00,0x20,"dma1");
149 request_region(0x40,0x20,"timer");
150 /* XXX FIXME: CONFIG_RTC */
151 request_region(0x70,0x10,"rtc");
152 request_region(0x80,0x10,"dma page reg");
153 request_region(0xc0,0x20,"dma2");
154 board_time_init
= sni_rm200_pci_time_init
;
156 _machine_restart
= sni_machine_restart
;
157 _machine_halt
= sni_machine_halt
;
158 _machine_power_off
= sni_machine_power_off
;
160 aux_device_present
= 0xaa;
163 * Some cluefull person has placed the PCI config data directly in
164 * the I/O port space ...
166 request_region(0xcfc,0x04,"PCI config data");
167 pci_ops
= &sni_pci_ops
;
169 #ifdef CONFIG_BLK_DEV_IDE
170 ide_ops
= &std_ide_ops
;
172 conswitchp
= &vga_con
;
173 rtc_ops
= &std_rtc_ops
;
174 kbd_ops
= &std_kbd_ops
;
175 #ifdef CONFIG_PSMOUSE
176 aux_device_present
= 0xaa;