Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * ip22-setup.c: SGI specific setup, including init of the feature struct.
0004  *
0005  * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
0006  * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
0007  */
0008 #include <linux/init.h>
0009 #include <linux/kernel.h>
0010 #include <linux/kdev_t.h>
0011 #include <linux/types.h>
0012 #include <linux/console.h>
0013 #include <linux/sched.h>
0014 #include <linux/tty.h>
0015 
0016 #include <asm/addrspace.h>
0017 #include <asm/bcache.h>
0018 #include <asm/bootinfo.h>
0019 #include <asm/irq.h>
0020 #include <asm/reboot.h>
0021 #include <asm/time.h>
0022 #include <asm/io.h>
0023 #include <asm/traps.h>
0024 #include <asm/sgialib.h>
0025 #include <asm/sgi/mc.h>
0026 #include <asm/sgi/hpc3.h>
0027 #include <asm/sgi/ip22.h>
0028 
0029 extern void ip22_be_init(void) __init;
0030 
0031 void __init plat_mem_setup(void)
0032 {
0033     char *ctype;
0034     char *cserial;
0035 
0036     board_be_init = ip22_be_init;
0037 
0038     /* Init the INDY HPC I/O controller.  Need to call this before
0039      * fucking with the memory controller because it needs to know the
0040      * boardID and whether this is a Guiness or a FullHouse machine.
0041      */
0042     sgihpc_init();
0043 
0044     /* Init INDY memory controller. */
0045     sgimc_init();
0046 
0047 #ifdef CONFIG_BOARD_SCACHE
0048     /* Now enable boardcaches, if any. */
0049     indy_sc_init();
0050 #endif
0051 
0052     /* Set EISA IO port base for Indigo2
0053      * ioremap cannot fail */
0054     set_io_port_base((unsigned long)ioremap(0x00080000,
0055                         0x1fffffff - 0x00080000));
0056     /* ARCS console environment variable is set to "g?" for
0057      * graphics console, it is set to "d" for the first serial
0058      * line and "d2" for the second serial line.
0059      *
0060      * Need to check if the case is 'g' but no keyboard:
0061      * (ConsoleIn/Out = serial)
0062      */
0063     ctype = ArcGetEnvironmentVariable("console");
0064     cserial = ArcGetEnvironmentVariable("ConsoleOut");
0065 
0066     if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
0067         static char options[8] __initdata;
0068         char *baud = ArcGetEnvironmentVariable("dbaud");
0069         if (baud)
0070             strcpy(options, baud);
0071         add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
0072                       baud ? options : NULL);
0073     } else if (!ctype || *ctype != 'g') {
0074         /* Use ARC if we don't want serial ('d') or graphics ('g'). */
0075         prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
0076         add_preferred_console("arc", 0, NULL);
0077     }
0078 }