2 * Setup pointers to hardware-dependent routines.
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
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
10 #include <linux/config.h>
11 #include <linux/eisa.h>
12 #include <linux/hdreg.h>
13 #include <linux/ioport.h>
14 #include <linux/sched.h>
15 #include <linux/init.h>
16 #include <linux/interrupt.h>
17 #include <linux/mc146818rtc.h>
19 #include <linux/pci.h>
20 #include <linux/console.h>
22 #include <linux/tty.h>
25 #include <asm/arc/types.h>
26 #include <asm/sgialib.h>
29 #include <asm/bcache.h>
30 #include <asm/bootinfo.h>
33 #include <asm/mc146818-time.h>
34 #include <asm/processor.h>
35 #include <asm/ptrace.h>
36 #include <asm/reboot.h>
39 #include <asm/traps.h>
41 extern void sni_machine_restart(char *command);
42 extern void sni_machine_halt(void);
43 extern void sni_machine_power_off(void);
45 static void __init sni_rm200_pci_timer_setup(struct irqaction *irq)
47 /* set the clock to 100 Hz */
48 outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
49 outb_p(LATCH & 0xff , 0x40); /* LSB */
50 outb(LATCH >> 8 , 0x40); /* MSB */
55 * A bit more gossip about the iron we're running on ...
57 static inline void sni_pcimt_detect(void)
64 csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
66 p += sprintf(p, "%s PCI", (csmsr & 0x80) ? "RM200" : "RM300");
67 if ((csmsr & 0x80) == 0)
68 p += sprintf(p, ", board revision %s",
69 (csmsr & 0x20) ? "D" : "C");
71 asic = (csmsr & 0x08) ? asic : !asic;
72 p += sprintf(p, ", ASIC PCI Rev %s", asic ? "1.0" : "1.1");
73 printk("%s.\n", boardtype);
76 static void __init sni_display_setup(void)
78 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_ARC)
79 struct screen_info *si = &screen_info;
82 di = ArcGetDisplayStatus(1);
85 si->orig_x = di->CursorXPosition;
86 si->orig_y = di->CursorYPosition;
87 si->orig_video_cols = di->CursorMaxXPosition;
88 si->orig_video_lines = di->CursorMaxYPosition;
89 si->orig_video_isVGA = VIDEO_TYPE_VGAC;
90 si->orig_video_points = 16;
95 static struct resource sni_io_resource = {
96 .start = 0x00001000UL,
98 .name = "PCIMT IO MEM",
99 .flags = IORESOURCE_IO,
102 static struct resource pcimt_io_resources[] = {
107 .flags = IORESOURCE_BUSY
112 .flags = IORESOURCE_BUSY
117 .flags = IORESOURCE_BUSY
121 .name = "dma page reg",
122 .flags = IORESOURCE_BUSY
127 .flags = IORESOURCE_BUSY
131 .name = "PCI config data",
132 .flags = IORESOURCE_BUSY
136 static struct resource sni_mem_resource = {
137 .start = 0x10000000UL,
139 .name = "PCIMT PCI MEM",
140 .flags = IORESOURCE_MEM
144 * The RM200/RM300 has a few holes in it's PCI/EISA memory address space used
145 * for other purposes. Be paranoid and allocate all of the before the PCI
146 * code gets a chance to to map anything else there ...
148 * This leaves the following areas available:
150 * 0x10000000 - 0x1009ffff (640kB) PCI/EISA/ISA Bus Memory
151 * 0x10100000 - 0x13ffffff ( 15MB) PCI/EISA/ISA Bus Memory
152 * 0x18000000 - 0x1fbfffff (124MB) PCI/EISA Bus Memory
153 * 0x1ff08000 - 0x1ffeffff (816kB) PCI/EISA Bus Memory
154 * 0xa0000000 - 0xffffffff (1.5GB) PCI/EISA Bus Memory
156 static struct resource pcimt_mem_resources[] = {
160 .name = "Video RAM area",
161 .flags = IORESOURCE_BUSY
165 .name = "ISA Reserved",
166 .flags = IORESOURCE_BUSY
171 .flags = IORESOURCE_BUSY
175 .name = "Cache Replacement Area",
176 .flags = IORESOURCE_BUSY
180 .name = "PCI INT Acknowledge",
181 .flags = IORESOURCE_BUSY
186 .flags = IORESOURCE_BUSY
191 .flags = IORESOURCE_BUSY
196 .flags = IORESOURCE_BUSY
201 .flags = IORESOURCE_BUSY
205 .name = "NVRAM / EEPROM",
206 .flags = IORESOURCE_BUSY
211 .flags = IORESOURCE_BUSY
216 .flags = IORESOURCE_BUSY
220 .name = "Main Memory",
221 .flags = IORESOURCE_BUSY
225 static void __init sni_resource_init(void)
229 /* request I/O space for devices used on all i[345]86 PCs */
230 for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++)
231 request_resource(&ioport_resource, pcimt_io_resources + i);
233 /* request mem space for pcimt-specific devices */
234 for (i = 0; i < ARRAY_SIZE(pcimt_mem_resources); i++)
235 request_resource(&sni_mem_resource, pcimt_mem_resources + i);
237 ioport_resource.end = sni_io_resource.end;
240 extern struct pci_ops sni_pci_ops;
242 static struct pci_controller sni_controller = {
243 .pci_ops = &sni_pci_ops,
244 .mem_resource = &sni_mem_resource,
245 .mem_offset = 0x10000000UL,
246 .io_resource = &sni_io_resource,
247 .io_offset = 0x00000000UL
250 static inline void sni_pcimt_time_init(void)
252 rtc_mips_get_time = mc146818_get_cmos_time;
253 rtc_mips_set_time = mc146818_set_rtc_mmss;
256 void __init plat_mem_setup(void)
260 sni_pcimt_time_init();
262 set_io_port_base(SNI_PORT_BASE);
263 ioport_resource.end = sni_io_resource.end;
266 * Setup (E)ISA I/O memory access stuff
268 isa_slot_offset = 0xb0000000;
274 board_timer_setup = sni_rm200_pci_timer_setup;
276 _machine_restart = sni_machine_restart;
277 _machine_halt = sni_machine_halt;
278 pm_power_off = sni_machine_power_off;
283 register_pci_controller(&sni_controller);