ip22-setup.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * ip22-setup.c: SGI specific setup, including init of the feature struct.
  4. *
  5. * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
  6. * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
  7. */
  8. #include <linux/init.h>
  9. #include <linux/kernel.h>
  10. #include <linux/kdev_t.h>
  11. #include <linux/types.h>
  12. #include <linux/console.h>
  13. #include <linux/sched.h>
  14. #include <linux/tty.h>
  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>
  21. #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. extern void ip22_be_init(void) __init;
  28. void __init plat_mem_setup(void)
  29. {
  30. char *ctype;
  31. char *cserial;
  32. board_be_init = ip22_be_init;
  33. /* Init the INDY HPC I/O controller. Need to call this before
  34. * fucking with the memory controller because it needs to know the
  35. * boardID and whether this is a Guiness or a FullHouse machine.
  36. */
  37. sgihpc_init();
  38. /* Init INDY memory controller. */
  39. sgimc_init();
  40. #ifdef CONFIG_BOARD_SCACHE
  41. /* Now enable boardcaches, if any. */
  42. indy_sc_init();
  43. #endif
  44. /* Set EISA IO port base for Indigo2
  45. * ioremap cannot fail */
  46. set_io_port_base((unsigned long)ioremap(0x00080000,
  47. 0x1fffffff - 0x00080000));
  48. /* ARCS console environment variable is set to "g?" for
  49. * graphics console, it is set to "d" for the first serial
  50. * line and "d2" for the second serial line.
  51. *
  52. * Need to check if the case is 'g' but no keyboard:
  53. * (ConsoleIn/Out = serial)
  54. */
  55. ctype = ArcGetEnvironmentVariable("console");
  56. cserial = ArcGetEnvironmentVariable("ConsoleOut");
  57. if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
  58. static char options[8] __initdata;
  59. char *baud = ArcGetEnvironmentVariable("dbaud");
  60. if (baud)
  61. strcpy(options, baud);
  62. add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
  63. baud ? options : NULL);
  64. } else if (!ctype || *ctype != 'g') {
  65. /* Use ARC if we don't want serial ('d') or graphics ('g'). */
  66. prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
  67. add_preferred_console("arc", 0, NULL);
  68. }
  69. }