malta_setup.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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 void mips_time_init(void);
  38. extern unsigned long mips_rtc_get_time(void);
  39. #ifdef CONFIG_KGDB
  40. extern void kgdb_config(void);
  41. #endif
  42. struct resource standard_io_resources[] = {
  43. { .name = "dma1", .start = 0x00, .end = 0x1f, .flags = IORESOURCE_BUSY },
  44. { .name = "timer", .start = 0x40, .end = 0x5f, .flags = IORESOURCE_BUSY },
  45. { .name = "keyboard", .start = 0x60, .end = 0x6f, .flags = IORESOURCE_BUSY },
  46. { .name = "dma page reg", .start = 0x80, .end = 0x8f, .flags = IORESOURCE_BUSY },
  47. { .name = "dma2", .start = 0xc0, .end = 0xdf, .flags = IORESOURCE_BUSY },
  48. };
  49. const char *get_system_type(void)
  50. {
  51. return "MIPS Malta";
  52. }
  53. #if defined(CONFIG_MIPS_MT_SMTC)
  54. const char display_string[] = " SMTC LINUX ON MALTA ";
  55. #else
  56. const char display_string[] = " LINUX ON MALTA ";
  57. #endif /* CONFIG_MIPS_MT_SMTC */
  58. #ifdef CONFIG_BLK_DEV_FD
  59. void __init fd_activate(void)
  60. {
  61. /*
  62. * Activate Floppy Controller in the SMSC FDC37M817 Super I/O
  63. * Controller.
  64. * Done by YAMON 2.00 onwards
  65. */
  66. /* Entering config state. */
  67. SMSC_WRITE(SMSC_CONFIG_ENTER, SMSC_CONFIG_REG);
  68. /* Activate floppy controller. */
  69. SMSC_WRITE(SMSC_CONFIG_DEVNUM, SMSC_CONFIG_REG);
  70. SMSC_WRITE(SMSC_CONFIG_DEVNUM_FLOPPY, SMSC_DATA_REG);
  71. SMSC_WRITE(SMSC_CONFIG_ACTIVATE, SMSC_CONFIG_REG);
  72. SMSC_WRITE(SMSC_CONFIG_ACTIVATE_ENABLE, SMSC_DATA_REG);
  73. /* Exit config state. */
  74. SMSC_WRITE(SMSC_CONFIG_EXIT, SMSC_CONFIG_REG);
  75. }
  76. #endif
  77. void __init plat_mem_setup(void)
  78. {
  79. unsigned int i;
  80. mips_pcibios_init();
  81. /* Request I/O space for devices used on the Malta board. */
  82. for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
  83. request_resource(&ioport_resource, standard_io_resources+i);
  84. /*
  85. * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
  86. */
  87. enable_dma(4);
  88. #ifdef CONFIG_KGDB
  89. kgdb_config ();
  90. #endif
  91. if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
  92. char *argptr;
  93. argptr = prom_getcmdline();
  94. if (strstr(argptr, "debug")) {
  95. BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
  96. printk ("Enabled Bonito debug mode\n");
  97. }
  98. else
  99. BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE;
  100. #ifdef CONFIG_DMA_COHERENT
  101. if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
  102. BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
  103. printk("Enabled Bonito CPU coherency\n");
  104. argptr = prom_getcmdline();
  105. if (strstr(argptr, "iobcuncached")) {
  106. BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
  107. BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
  108. ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
  109. BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
  110. printk("Disabled Bonito IOBC coherency\n");
  111. }
  112. else {
  113. BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
  114. BONITO_PCIMEMBASECFG |=
  115. (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
  116. BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
  117. printk("Enabled Bonito IOBC coherency\n");
  118. }
  119. }
  120. else
  121. panic("Hardware DMA cache coherency not supported");
  122. #endif
  123. }
  124. #ifdef CONFIG_DMA_COHERENT
  125. else {
  126. panic("Hardware DMA cache coherency not supported");
  127. }
  128. #endif
  129. #ifdef CONFIG_BLK_DEV_IDE
  130. /* Check PCI clock */
  131. {
  132. unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
  133. int jmpr = (readw(jmpr_p) >> 2) & 0x07;
  134. static const int pciclocks[] __initdata = {
  135. 33, 20, 25, 30, 12, 16, 37, 10
  136. };
  137. int pciclock = pciclocks[jmpr];
  138. char *argptr = prom_getcmdline();
  139. if (pciclock != 33 && !strstr (argptr, "idebus=")) {
  140. printk("WARNING: PCI clock is %dMHz, setting idebus\n", pciclock);
  141. argptr += strlen(argptr);
  142. sprintf (argptr, " idebus=%d", pciclock);
  143. if (pciclock < 20 || pciclock > 66)
  144. printk ("WARNING: IDE timing calculations will be incorrect\n");
  145. }
  146. }
  147. #endif
  148. #ifdef CONFIG_BLK_DEV_FD
  149. fd_activate ();
  150. #endif
  151. #ifdef CONFIG_VT
  152. #if defined(CONFIG_VGA_CONSOLE)
  153. screen_info = (struct screen_info) {
  154. 0, 25, /* orig-x, orig-y */
  155. 0, /* unused */
  156. 0, /* orig-video-page */
  157. 0, /* orig-video-mode */
  158. 80, /* orig-video-cols */
  159. 0,0,0, /* ega_ax, ega_bx, ega_cx */
  160. 25, /* orig-video-lines */
  161. VIDEO_TYPE_VGAC, /* orig-video-isVGA */
  162. 16 /* orig-video-points */
  163. };
  164. #endif
  165. #endif
  166. mips_reboot_setup();
  167. board_time_init = mips_time_init;
  168. rtc_mips_get_time = mips_rtc_get_time;
  169. }