setup.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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/gt64120.h>
  20. #include <cobalt.h>
  21. extern void cobalt_machine_restart(char *command);
  22. extern void cobalt_machine_halt(void);
  23. const char *get_system_type(void)
  24. {
  25. switch (cobalt_board_id) {
  26. case COBALT_BRD_ID_QUBE1:
  27. return "Cobalt Qube";
  28. case COBALT_BRD_ID_RAQ1:
  29. return "Cobalt RaQ";
  30. case COBALT_BRD_ID_QUBE2:
  31. return "Cobalt Qube2";
  32. case COBALT_BRD_ID_RAQ2:
  33. return "Cobalt RaQ2";
  34. }
  35. return "MIPS Cobalt";
  36. }
  37. /*
  38. * Cobalt doesn't have PS/2 keyboard/mouse interfaces,
  39. * keyboard conntroller is never used.
  40. * Also PCI-ISA bridge DMA contoroller is never used.
  41. */
  42. static struct resource cobalt_reserved_resources[] = {
  43. { /* dma1 */
  44. .start = 0x00,
  45. .end = 0x1f,
  46. .name = "reserved",
  47. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  48. },
  49. { /* keyboard */
  50. .start = 0x60,
  51. .end = 0x6f,
  52. .name = "reserved",
  53. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  54. },
  55. { /* dma page reg */
  56. .start = 0x80,
  57. .end = 0x8f,
  58. .name = "reserved",
  59. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  60. },
  61. { /* dma2 */
  62. .start = 0xc0,
  63. .end = 0xdf,
  64. .name = "reserved",
  65. .flags = IORESOURCE_BUSY | IORESOURCE_IO,
  66. },
  67. };
  68. void __init plat_mem_setup(void)
  69. {
  70. int i;
  71. _machine_restart = cobalt_machine_restart;
  72. _machine_halt = cobalt_machine_halt;
  73. pm_power_off = cobalt_machine_halt;
  74. set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
  75. /* I/O port resource */
  76. ioport_resource.end = 0x01ffffff;
  77. /* These resources have been reserved by VIA SuperI/O chip. */
  78. for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++)
  79. request_resource(&ioport_resource, cobalt_reserved_resources + i);
  80. }
  81. /*
  82. * Prom init. We read our one and only communication with the firmware.
  83. * Grab the amount of installed memory.
  84. * Better boot loaders (CoLo) pass a command line too :-)
  85. */
  86. void __init prom_init(void)
  87. {
  88. unsigned long memsz;
  89. int argc, i;
  90. char **argv;
  91. memsz = fw_arg0 & 0x7fff0000;
  92. argc = fw_arg0 & 0x0000ffff;
  93. argv = (char **)fw_arg1;
  94. for (i = 1; i < argc; i++) {
  95. strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
  96. if (i < (argc - 1))
  97. strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
  98. }
  99. add_memory_region(0x0, memsz, BOOT_MEM_RAM);
  100. }
  101. void __init prom_free_prom_memory(void)
  102. {
  103. /* Nothing to do! */
  104. }