malta_setup.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * Carsten Langgaard, carstenl@mips.com
  3. * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
  4. *
  5. * This program is free software; you can distribute it and/or modify it
  6. * under the terms of the GNU General Public License (Version 2) as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  17. */
  18. #include <linux/init.h>
  19. #include <linux/sched.h>
  20. #include <linux/ioport.h>
  21. #include <linux/pci.h>
  22. #include <linux/screen_info.h>
  23. #include <asm/cpu.h>
  24. #include <asm/bootinfo.h>
  25. #include <asm/irq.h>
  26. #include <asm/mips-boards/generic.h>
  27. #include <asm/mips-boards/prom.h>
  28. #include <asm/mips-boards/malta.h>
  29. #include <asm/mips-boards/maltaint.h>
  30. #include <asm/dma.h>
  31. #include <asm/time.h>
  32. #include <asm/traps.h>
  33. #ifdef CONFIG_VT
  34. #include <linux/console.h>
  35. #endif
  36. extern void mips_reboot_setup(void);
  37. extern unsigned long mips_rtc_get_time(void);
  38. #ifdef CONFIG_KGDB
  39. extern void kgdb_config(void);
  40. #endif
  41. struct resource standard_io_resources[] = {
  42. {
  43. .name = "dma1",
  44. .start = 0x00,
  45. .end = 0x1f,
  46. .flags = IORESOURCE_BUSY
  47. },
  48. {
  49. .name = "timer",
  50. .start = 0x40,
  51. .end = 0x5f,
  52. .flags = IORESOURCE_BUSY
  53. },
  54. {
  55. .name = "keyboard",
  56. .start = 0x60,
  57. .end = 0x6f,
  58. .flags = IORESOURCE_BUSY
  59. },
  60. {
  61. .name = "dma page reg",
  62. .start = 0x80,
  63. .end = 0x8f,
  64. .flags = IORESOURCE_BUSY
  65. },
  66. {
  67. .name = "dma2",
  68. .start = 0xc0,
  69. .end = 0xdf,
  70. .flags = IORESOURCE_BUSY
  71. },
  72. };
  73. const char *get_system_type(void)
  74. {
  75. return "MIPS Malta";
  76. }
  77. #if defined(CONFIG_MIPS_MT_SMTC)
  78. const char display_string[] = " SMTC LINUX ON MALTA ";
  79. #else
  80. const char display_string[] = " LINUX ON MALTA ";
  81. #endif /* CONFIG_MIPS_MT_SMTC */
  82. #ifdef CONFIG_BLK_DEV_FD
  83. void __init fd_activate(void)
  84. {
  85. /*
  86. * Activate Floppy Controller in the SMSC FDC37M817 Super I/O
  87. * Controller.
  88. * Done by YAMON 2.00 onwards
  89. */
  90. /* Entering config state. */
  91. SMSC_WRITE(SMSC_CONFIG_ENTER, SMSC_CONFIG_REG);
  92. /* Activate floppy controller. */
  93. SMSC_WRITE(SMSC_CONFIG_DEVNUM, SMSC_CONFIG_REG);
  94. SMSC_WRITE(SMSC_CONFIG_DEVNUM_FLOPPY, SMSC_DATA_REG);
  95. SMSC_WRITE(SMSC_CONFIG_ACTIVATE, SMSC_CONFIG_REG);
  96. SMSC_WRITE(SMSC_CONFIG_ACTIVATE_ENABLE, SMSC_DATA_REG);
  97. /* Exit config state. */
  98. SMSC_WRITE(SMSC_CONFIG_EXIT, SMSC_CONFIG_REG);
  99. }
  100. #endif
  101. void __init plat_mem_setup(void)
  102. {
  103. unsigned int i;
  104. mips_pcibios_init();
  105. /* Request I/O space for devices used on the Malta board. */
  106. for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
  107. request_resource(&ioport_resource, standard_io_resources+i);
  108. /*
  109. * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
  110. */
  111. enable_dma(4);
  112. #ifdef CONFIG_KGDB
  113. kgdb_config();
  114. #endif
  115. if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
  116. char *argptr;
  117. argptr = prom_getcmdline();
  118. if (strstr(argptr, "debug")) {
  119. BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
  120. printk("Enabled Bonito debug mode\n");
  121. }
  122. else
  123. BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE;
  124. #ifdef CONFIG_DMA_COHERENT
  125. if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
  126. BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
  127. printk("Enabled Bonito CPU coherency\n");
  128. argptr = prom_getcmdline();
  129. if (strstr(argptr, "iobcuncached")) {
  130. BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
  131. BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
  132. ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
  133. BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
  134. printk("Disabled Bonito IOBC coherency\n");
  135. }
  136. else {
  137. BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
  138. BONITO_PCIMEMBASECFG |=
  139. (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
  140. BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
  141. printk("Enabled Bonito IOBC coherency\n");
  142. }
  143. }
  144. else
  145. panic("Hardware DMA cache coherency not supported");
  146. #endif
  147. }
  148. #ifdef CONFIG_DMA_COHERENT
  149. else {
  150. panic("Hardware DMA cache coherency not supported");
  151. }
  152. #endif
  153. #ifdef CONFIG_BLK_DEV_IDE
  154. /* Check PCI clock */
  155. {
  156. unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
  157. int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
  158. static const int pciclocks[] __initdata = {
  159. 33, 20, 25, 30, 12, 16, 37, 10
  160. };
  161. int pciclock = pciclocks[jmpr];
  162. char *argptr = prom_getcmdline();
  163. if (pciclock != 33 && !strstr (argptr, "idebus=")) {
  164. printk("WARNING: PCI clock is %dMHz, setting idebus\n", pciclock);
  165. argptr += strlen(argptr);
  166. sprintf(argptr, " idebus=%d", pciclock);
  167. if (pciclock < 20 || pciclock > 66)
  168. printk("WARNING: IDE timing calculations will be incorrect\n");
  169. }
  170. }
  171. #endif
  172. #ifdef CONFIG_BLK_DEV_FD
  173. fd_activate();
  174. #endif
  175. #ifdef CONFIG_VT
  176. #if defined(CONFIG_VGA_CONSOLE)
  177. screen_info = (struct screen_info) {
  178. .orig_x = 0,
  179. .orig_y = 25,
  180. .ext_mem_k = 0,
  181. .orig_video_page = 0,
  182. .orig_video_mode = 0,
  183. .orig_video_cols = 80,
  184. .unused2 = 0,
  185. .orig_video_ega_bx = 0,
  186. .unused3 = 0,
  187. .orig_video_lines = 25,
  188. .orig_video_isVGA = VIDEO_TYPE_VGAC,
  189. .orig_video_points = 16
  190. };
  191. #endif
  192. #endif
  193. mips_reboot_setup();
  194. }