setup.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
  9. */
  10. #include <linux/config.h>
  11. #include <linux/eisa.h>
  12. #include <linux/hdreg.h>
  13. #include <linux/ioport.h>
  14. #include <linux/sched.h>
  15. #include <linux/init.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/mc146818rtc.h>
  18. #include <linux/pm.h>
  19. #include <linux/pci.h>
  20. #include <linux/console.h>
  21. #include <linux/fb.h>
  22. #include <linux/tty.h>
  23. #include <asm/arc/types.h>
  24. #include <asm/sgialib.h>
  25. #include <asm/bcache.h>
  26. #include <asm/bootinfo.h>
  27. #include <asm/io.h>
  28. #include <asm/irq.h>
  29. #include <asm/mc146818-time.h>
  30. #include <asm/processor.h>
  31. #include <asm/ptrace.h>
  32. #include <asm/reboot.h>
  33. #include <asm/sni.h>
  34. #include <asm/time.h>
  35. #include <asm/traps.h>
  36. extern void sni_machine_restart(char *command);
  37. extern void sni_machine_halt(void);
  38. extern void sni_machine_power_off(void);
  39. static void __init sni_rm200_pci_timer_setup(struct irqaction *irq)
  40. {
  41. /* set the clock to 100 Hz */
  42. outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
  43. outb_p(LATCH & 0xff , 0x40); /* LSB */
  44. outb(LATCH >> 8 , 0x40); /* MSB */
  45. setup_irq(0, irq);
  46. }
  47. /*
  48. * A bit more gossip about the iron we're running on ...
  49. */
  50. static inline void sni_pcimt_detect(void)
  51. {
  52. char boardtype[80];
  53. unsigned char csmsr;
  54. char *p = boardtype;
  55. unsigned int asic;
  56. csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
  57. p += sprintf(p, "%s PCI", (csmsr & 0x80) ? "RM200" : "RM300");
  58. if ((csmsr & 0x80) == 0)
  59. p += sprintf(p, ", board revision %s",
  60. (csmsr & 0x20) ? "D" : "C");
  61. asic = csmsr & 0x80;
  62. asic = (csmsr & 0x08) ? asic : !asic;
  63. p += sprintf(p, ", ASIC PCI Rev %s", asic ? "1.0" : "1.1");
  64. printk("%s.\n", boardtype);
  65. }
  66. static void __init sni_display_setup(void)
  67. {
  68. #ifdef CONFIG_VT
  69. #if defined(CONFIG_VGA_CONSOLE)
  70. struct screen_info *si = &screen_info;
  71. DISPLAY_STATUS *di;
  72. di = ArcGetDisplayStatus(1);
  73. if (di) {
  74. si->orig_x = di->CursorXPosition;
  75. si->orig_y = di->CursorYPosition;
  76. si->orig_video_cols = di->CursorMaxXPosition;
  77. si->orig_video_lines = di->CursorMaxYPosition;
  78. si->orig_video_isVGA = VIDEO_TYPE_VGAC;
  79. si->orig_video_points = 16;
  80. }
  81. #endif
  82. #endif
  83. }
  84. static struct resource sni_io_resource = {
  85. "PCIMT IO MEM", 0x00001000UL, 0x03bfffffUL, IORESOURCE_IO,
  86. };
  87. static struct resource pcimt_io_resources[] = {
  88. { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
  89. { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
  90. { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
  91. { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
  92. { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
  93. { "PCI config data", 0xcfc, 0xcff, IORESOURCE_BUSY }
  94. };
  95. static struct resource sni_mem_resource = {
  96. "PCIMT PCI MEM", 0x10000000UL, 0xffffffffUL, IORESOURCE_MEM
  97. };
  98. /*
  99. * The RM200/RM300 has a few holes in it's PCI/EISA memory address space used
  100. * for other purposes. Be paranoid and allocate all of the before the PCI
  101. * code gets a chance to to map anything else there ...
  102. *
  103. * This leaves the following areas available:
  104. *
  105. * 0x10000000 - 0x1009ffff (640kB) PCI/EISA/ISA Bus Memory
  106. * 0x10100000 - 0x13ffffff ( 15MB) PCI/EISA/ISA Bus Memory
  107. * 0x18000000 - 0x1fbfffff (124MB) PCI/EISA Bus Memory
  108. * 0x1ff08000 - 0x1ffeffff (816kB) PCI/EISA Bus Memory
  109. * 0xa0000000 - 0xffffffff (1.5GB) PCI/EISA Bus Memory
  110. */
  111. static struct resource pcimt_mem_resources[] = {
  112. { "Video RAM area", 0x100a0000, 0x100bffff, IORESOURCE_BUSY },
  113. { "ISA Reserved", 0x100c0000, 0x100fffff, IORESOURCE_BUSY },
  114. { "PCI IO", 0x14000000, 0x17bfffff, IORESOURCE_BUSY },
  115. { "Cache Replacement Area", 0x17c00000, 0x17ffffff, IORESOURCE_BUSY},
  116. { "PCI INT Acknowledge", 0x1a000000, 0x1a000003, IORESOURCE_BUSY },
  117. { "Boot PROM", 0x1fc00000, 0x1fc7ffff, IORESOURCE_BUSY},
  118. { "Diag PROM", 0x1fc80000, 0x1fcfffff, IORESOURCE_BUSY},
  119. { "X-Bus", 0x1fd00000, 0x1fdfffff, IORESOURCE_BUSY},
  120. { "BIOS map", 0x1fe00000, 0x1fefffff, IORESOURCE_BUSY},
  121. { "NVRAM / EEPROM", 0x1ff00000, 0x1ff7ffff, IORESOURCE_BUSY},
  122. { "ASIC PCI", 0x1fff0000, 0x1fffefff, IORESOURCE_BUSY},
  123. { "MP Agent", 0x1ffff000, 0x1fffffff, IORESOURCE_BUSY},
  124. { "Main Memory", 0x20000000, 0x9fffffff, IORESOURCE_BUSY}
  125. };
  126. static void __init sni_resource_init(void)
  127. {
  128. int i;
  129. /* request I/O space for devices used on all i[345]86 PCs */
  130. for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++)
  131. request_resource(&ioport_resource, pcimt_io_resources + i);
  132. /* request mem space for pcimt-specific devices */
  133. for (i = 0; i < ARRAY_SIZE(pcimt_mem_resources); i++)
  134. request_resource(&sni_mem_resource, pcimt_mem_resources + i);
  135. ioport_resource.end = sni_io_resource.end;
  136. }
  137. extern struct pci_ops sni_pci_ops;
  138. static struct pci_controller sni_controller = {
  139. .pci_ops = &sni_pci_ops,
  140. .mem_resource = &sni_mem_resource,
  141. .mem_offset = 0x10000000UL,
  142. .io_resource = &sni_io_resource,
  143. .io_offset = 0x00000000UL
  144. };
  145. static inline void sni_pcimt_time_init(void)
  146. {
  147. rtc_mips_get_time = mc146818_get_cmos_time;
  148. rtc_mips_set_time = mc146818_set_rtc_mmss;
  149. }
  150. void __init plat_setup(void)
  151. {
  152. sni_pcimt_detect();
  153. sni_pcimt_sc_init();
  154. sni_pcimt_time_init();
  155. set_io_port_base(SNI_PORT_BASE);
  156. ioport_resource.end = sni_io_resource.end;
  157. /*
  158. * Setup (E)ISA I/O memory access stuff
  159. */
  160. isa_slot_offset = 0xb0000000;
  161. #ifdef CONFIG_EISA
  162. EISA_bus = 1;
  163. #endif
  164. sni_resource_init();
  165. board_timer_setup = sni_rm200_pci_timer_setup;
  166. _machine_restart = sni_machine_restart;
  167. _machine_halt = sni_machine_halt;
  168. pm_power_off = sni_machine_power_off;
  169. sni_display_setup();
  170. #ifdef CONFIG_PCI
  171. register_pci_controller(&sni_controller);
  172. #endif
  173. }