blob: 896a1ef8482962e5376a37487693f5b87183f053 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * ip22-setup.c: SGI specific setup, including init of the feature struct.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
6 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <linux/ds1286.h>
8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/kdev_t.h>
11#include <linux/types.h>
12#include <linux/module.h>
13#include <linux/console.h>
14#include <linux/sched.h>
15#include <linux/tty.h>
16
17#include <asm/addrspace.h>
18#include <asm/bcache.h>
19#include <asm/bootinfo.h>
20#include <asm/irq.h>
21#include <asm/reboot.h>
22#include <asm/time.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/io.h>
24#include <asm/traps.h>
25#include <asm/sgialib.h>
26#include <asm/sgi/mc.h>
27#include <asm/sgi/hpc3.h>
28#include <asm/sgi/ip22.h>
29
30unsigned long sgi_gfxaddr;
Ralf Baechle88eb4132007-08-22 16:29:56 +010031EXPORT_SYMBOL_GPL(sgi_gfxaddr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033extern void ip22_be_init(void) __init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
Ralf Baechle2925aba2006-06-18 01:32:22 +010035void __init plat_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070036{
37 char *ctype;
Ralf Baechlee9feeb22006-01-30 17:48:27 +000038 char *cserial;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40 board_be_init = ip22_be_init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42 /* Init the INDY HPC I/O controller. Need to call this before
43 * fucking with the memory controller because it needs to know the
44 * boardID and whether this is a Guiness or a FullHouse machine.
45 */
46 sgihpc_init();
47
48 /* Init INDY memory controller. */
49 sgimc_init();
50
51#ifdef CONFIG_BOARD_SCACHE
52 /* Now enable boardcaches, if any. */
53 indy_sc_init();
54#endif
55
56 /* Set EISA IO port base for Indigo2
57 * ioremap cannot fail */
58 set_io_port_base((unsigned long)ioremap(0x00080000,
59 0x1fffffff - 0x00080000));
60 /* ARCS console environment variable is set to "g?" for
61 * graphics console, it is set to "d" for the first serial
62 * line and "d2" for the second serial line.
Ralf Baechlee9feeb22006-01-30 17:48:27 +000063 *
64 * Need to check if the case is 'g' but no keyboard:
65 * (ConsoleIn/Out = serial)
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 */
67 ctype = ArcGetEnvironmentVariable("console");
Ralf Baechlee9feeb22006-01-30 17:48:27 +000068 cserial = ArcGetEnvironmentVariable("ConsoleOut");
69
70 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 static char options[8];
72 char *baud = ArcGetEnvironmentVariable("dbaud");
73 if (baud)
74 strcpy(options, baud);
75 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
76 baud ? options : NULL);
77 } else if (!ctype || *ctype != 'g') {
Ralf Baechlee9feeb22006-01-30 17:48:27 +000078 /* Use ARC if we don't want serial ('d') or graphics ('g'). */
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
80 add_preferred_console("arc", 0, NULL);
81 }
82
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
84 {
85 ULONG *gfxinfo;
86 ULONG * (*__vec)(void) = (void *) (long)
87 *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
88
89 gfxinfo = __vec();
90 sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
91 && gfxinfo[1] <= 0xc0000000)
92 ? gfxinfo[1] - 0xa0000000 : 0);
93
94 /* newport addresses? */
95 if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
96 conswitchp = &newport_con;
97 }
98 }
99#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100}