Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ip22-setup.c: SGI specific setup, including init of the feature struct. |
| 3 | * |
Justin P. Mattock | 79add62 | 2011-04-04 14:15:29 -0700 | [diff] [blame] | 4 | * Copyright (C) 1996 David S. Miller (davem@davemloft.net) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org) |
| 6 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <linux/init.h> |
| 8 | #include <linux/kernel.h> |
| 9 | #include <linux/kdev_t.h> |
| 10 | #include <linux/types.h> |
| 11 | #include <linux/module.h> |
| 12 | #include <linux/console.h> |
| 13 | #include <linux/sched.h> |
| 14 | #include <linux/tty.h> |
| 15 | |
| 16 | #include <asm/addrspace.h> |
| 17 | #include <asm/bcache.h> |
| 18 | #include <asm/bootinfo.h> |
| 19 | #include <asm/irq.h> |
| 20 | #include <asm/reboot.h> |
| 21 | #include <asm/time.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <asm/io.h> |
| 23 | #include <asm/traps.h> |
| 24 | #include <asm/sgialib.h> |
| 25 | #include <asm/sgi/mc.h> |
| 26 | #include <asm/sgi/hpc3.h> |
| 27 | #include <asm/sgi/ip22.h> |
| 28 | |
| 29 | unsigned long sgi_gfxaddr; |
Ralf Baechle | 88eb413 | 2007-08-22 16:29:56 +0100 | [diff] [blame] | 30 | EXPORT_SYMBOL_GPL(sgi_gfxaddr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | extern void ip22_be_init(void) __init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
Ralf Baechle | 2925aba | 2006-06-18 01:32:22 +0100 | [diff] [blame] | 34 | void __init plat_mem_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | { |
| 36 | char *ctype; |
Ralf Baechle | e9feeb2 | 2006-01-30 17:48:27 +0000 | [diff] [blame] | 37 | char *cserial; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | board_be_init = ip22_be_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* Init the INDY HPC I/O controller. Need to call this before |
| 42 | * fucking with the memory controller because it needs to know the |
| 43 | * boardID and whether this is a Guiness or a FullHouse machine. |
| 44 | */ |
| 45 | sgihpc_init(); |
| 46 | |
| 47 | /* Init INDY memory controller. */ |
| 48 | sgimc_init(); |
| 49 | |
| 50 | #ifdef CONFIG_BOARD_SCACHE |
| 51 | /* Now enable boardcaches, if any. */ |
| 52 | indy_sc_init(); |
| 53 | #endif |
| 54 | |
| 55 | /* Set EISA IO port base for Indigo2 |
| 56 | * ioremap cannot fail */ |
| 57 | set_io_port_base((unsigned long)ioremap(0x00080000, |
| 58 | 0x1fffffff - 0x00080000)); |
| 59 | /* ARCS console environment variable is set to "g?" for |
| 60 | * graphics console, it is set to "d" for the first serial |
| 61 | * line and "d2" for the second serial line. |
Ralf Baechle | e9feeb2 | 2006-01-30 17:48:27 +0000 | [diff] [blame] | 62 | * |
| 63 | * Need to check if the case is 'g' but no keyboard: |
| 64 | * (ConsoleIn/Out = serial) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | */ |
| 66 | ctype = ArcGetEnvironmentVariable("console"); |
Ralf Baechle | e9feeb2 | 2006-01-30 17:48:27 +0000 | [diff] [blame] | 67 | cserial = ArcGetEnvironmentVariable("ConsoleOut"); |
| 68 | |
| 69 | if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) { |
Dmitri Vorobiev | 599a894 | 2009-11-23 13:53:37 +0200 | [diff] [blame] | 70 | static char options[8] __initdata; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | char *baud = ArcGetEnvironmentVariable("dbaud"); |
| 72 | if (baud) |
| 73 | strcpy(options, baud); |
| 74 | add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0, |
| 75 | baud ? options : NULL); |
| 76 | } else if (!ctype || *ctype != 'g') { |
Ralf Baechle | e9feeb2 | 2006-01-30 17:48:27 +0000 | [diff] [blame] | 77 | /* Use ARC if we don't want serial ('d') or graphics ('g'). */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | prom_flags |= PROM_FLAG_USE_AS_CONSOLE; |
| 79 | add_preferred_console("arc", 0, NULL); |
| 80 | } |
| 81 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | #if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE) |
| 83 | { |
| 84 | ULONG *gfxinfo; |
| 85 | ULONG * (*__vec)(void) = (void *) (long) |
| 86 | *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20)); |
| 87 | |
| 88 | gfxinfo = __vec(); |
| 89 | sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000 |
| 90 | && gfxinfo[1] <= 0xc0000000) |
| 91 | ? gfxinfo[1] - 0xa0000000 : 0); |
| 92 | |
| 93 | /* newport addresses? */ |
| 94 | if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) { |
| 95 | conswitchp = &newport_con; |
| 96 | } |
| 97 | } |
| 98 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | } |