blob: 872159970935279315e208535b780bd9b2cd0824 [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 *
Justin P. Mattock79add622011-04-04 14:15:29 -07004 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
6 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/kdev_t.h>
10#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/console.h>
12#include <linux/sched.h>
13#include <linux/tty.h>
14
15#include <asm/addrspace.h>
16#include <asm/bcache.h>
17#include <asm/bootinfo.h>
18#include <asm/irq.h>
19#include <asm/reboot.h>
20#include <asm/time.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <asm/io.h>
22#include <asm/traps.h>
23#include <asm/sgialib.h>
24#include <asm/sgi/mc.h>
25#include <asm/sgi/hpc3.h>
26#include <asm/sgi/ip22.h>
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028extern void ip22_be_init(void) __init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Ralf Baechle2925aba2006-06-18 01:32:22 +010030void __init plat_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070031{
32 char *ctype;
Ralf Baechlee9feeb22006-01-30 17:48:27 +000033 char *cserial;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
35 board_be_init = ip22_be_init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
37 /* Init the INDY HPC I/O controller. Need to call this before
38 * fucking with the memory controller because it needs to know the
39 * boardID and whether this is a Guiness or a FullHouse machine.
40 */
41 sgihpc_init();
42
43 /* Init INDY memory controller. */
44 sgimc_init();
45
46#ifdef CONFIG_BOARD_SCACHE
47 /* Now enable boardcaches, if any. */
48 indy_sc_init();
49#endif
50
51 /* Set EISA IO port base for Indigo2
52 * ioremap cannot fail */
53 set_io_port_base((unsigned long)ioremap(0x00080000,
54 0x1fffffff - 0x00080000));
55 /* ARCS console environment variable is set to "g?" for
56 * graphics console, it is set to "d" for the first serial
57 * line and "d2" for the second serial line.
Ralf Baechlee9feeb22006-01-30 17:48:27 +000058 *
59 * Need to check if the case is 'g' but no keyboard:
60 * (ConsoleIn/Out = serial)
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 */
62 ctype = ArcGetEnvironmentVariable("console");
Ralf Baechlee9feeb22006-01-30 17:48:27 +000063 cserial = ArcGetEnvironmentVariable("ConsoleOut");
64
65 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
Dmitri Vorobiev599a8942009-11-23 13:53:37 +020066 static char options[8] __initdata;
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 char *baud = ArcGetEnvironmentVariable("dbaud");
68 if (baud)
69 strcpy(options, baud);
70 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
71 baud ? options : NULL);
72 } else if (!ctype || *ctype != 'g') {
Ralf Baechlee9feeb22006-01-30 17:48:27 +000073 /* Use ARC if we don't want serial ('d') or graphics ('g'). */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
75 add_preferred_console("arc", 0, NULL);
76 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070077}