setup.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Setup pointers to hardware dependent routines.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1996, 1997, 2004, 05 by Ralf Baechle (ralf@linux-mips.org)
  9. * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
  10. *
  11. */
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/io.h>
  15. #include <linux/ioport.h>
  16. #include <linux/pm.h>
  17. #include <asm/bootinfo.h>
  18. #include <asm/reboot.h>
  19. #include <asm/setup.h>
  20. #include <asm/gt64120.h>
  21. #include <cobalt.h>
  22. extern void cobalt_machine_restart(char *command);
  23. extern void cobalt_machine_halt(void);
  24. const char *get_system_type(void)
  25. {
  26. switch (cobalt_board_id) {
  27. case COBALT_BRD_ID_QUBE1:
  28. return "Cobalt Qube";
  29. case COBALT_BRD_ID_RAQ1:
  30. return "Cobalt RaQ";
  31. case COBALT_BRD_ID_QUBE2:
  32. return "Cobalt Qube2";
  33. case COBALT_BRD_ID_RAQ2:
  34. return "Cobalt RaQ2";
  35. }
  36. return "MIPS Cobalt";
  37. }
  38. /*
  39. * Cobalt doesn't have PS/2 keyboard/mouse interfaces,
  40. * keyboard controller is never used.
  41. * Also PCI-ISA bridge DMA controller is never used.
  42. */
  43. static struct resource cobalt_reserved_resources[] = {
  44. { /* dma1 */
  45. .start = 0x00,
  46. .end = 0x1f,
  47. .name = "reserved",
  48. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  49. },
  50. { /* keyboard */
  51. .start = 0x60,
  52. .end = 0x6f,
  53. .name = "reserved",
  54. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  55. },
  56. { /* dma page reg */
  57. .start = 0x80,
  58. .end = 0x8f,
  59. .name = "reserved",
  60. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  61. },
  62. { /* dma2 */
  63. .start = 0xc0,
  64. .end = 0xdf,
  65. .name = "reserved",
  66. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  67. },
  68. };
  69. void __init plat_mem_setup(void)
  70. {
  71. int i;
  72. _machine_restart = cobalt_machine_restart;
  73. _machine_halt = cobalt_machine_halt;
  74. pm_power_off = cobalt_machine_halt;
  75. set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
  76. /* I/O port resource */
  77. ioport_resource.end = 0x01ffffff;
  78. /* These resources have been reserved by VIA SuperI/O chip. */
  79. for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++)
  80. request_resource(&ioport_resource, cobalt_reserved_resources + i);
  81. }
  82. /*
  83. * Prom init. We read our one and only communication with the firmware.
  84. * Grab the amount of installed memory.
  85. * Better boot loaders (CoLo) pass a command line too :-)
  86. */
  87. void __init prom_init(void)
  88. {
  89. unsigned long memsz;
  90. int argc, i;
  91. char **argv;
  92. memsz = fw_arg0 & 0x7fff0000;
  93. argc = fw_arg0 & 0x0000ffff;
  94. argv = (char **)fw_arg1;
  95. for (i = 1; i < argc; i++) {
  96. strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
  97. if (i < (argc - 1))
  98. strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
  99. }
  100. add_memory_region(0x0, memsz, BOOT_MEM_RAM);
  101. setup_8250_early_printk_port(CKSEG1ADDR(0x1c800000), 0, 0);
  102. }
  103. void __init prom_free_prom_memory(void)
  104. {
  105. /* Nothing to do! */
  106. }