malta_setup.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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/config.h>
  19. #include <linux/init.h>
  20. #include <linux/sched.h>
  21. #include <linux/ioport.h>
  22. #include <linux/pci.h>
  23. #include <linux/tty.h>
  24. #ifdef CONFIG_MTD
  25. #include <linux/mtd/partitions.h>
  26. #include <linux/mtd/physmap.h>
  27. #include <linux/mtd/mtd.h>
  28. #include <linux/mtd/map.h>
  29. #endif
  30. #include <asm/cpu.h>
  31. #include <asm/bootinfo.h>
  32. #include <asm/irq.h>
  33. #include <asm/mips-boards/generic.h>
  34. #include <asm/mips-boards/prom.h>
  35. #include <asm/mips-boards/malta.h>
  36. #include <asm/mips-boards/maltaint.h>
  37. #include <asm/dma.h>
  38. #include <asm/time.h>
  39. #include <asm/traps.h>
  40. #ifdef CONFIG_VT
  41. #include <linux/console.h>
  42. #endif
  43. extern void mips_reboot_setup(void);
  44. extern void mips_time_init(void);
  45. extern void mips_timer_setup(struct irqaction *irq);
  46. extern unsigned long mips_rtc_get_time(void);
  47. #ifdef CONFIG_KGDB
  48. extern void kgdb_config(void);
  49. #endif
  50. struct resource standard_io_resources[] = {
  51. { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
  52. { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
  53. { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
  54. { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
  55. { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
  56. };
  57. #ifdef CONFIG_MTD
  58. static struct mtd_partition malta_mtd_partitions[] = {
  59. {
  60. .name = "YAMON",
  61. .offset = 0x0,
  62. .size = 0x100000,
  63. .mask_flags = MTD_WRITEABLE
  64. },
  65. {
  66. .name = "User FS",
  67. .offset = 0x100000,
  68. .size = 0x2e0000
  69. },
  70. {
  71. .name = "Board Config",
  72. .offset = 0x3e0000,
  73. .size = 0x020000,
  74. .mask_flags = MTD_WRITEABLE
  75. }
  76. };
  77. #define number_partitions (sizeof(malta_mtd_partitions)/sizeof(struct mtd_partition))
  78. #endif
  79. const char *get_system_type(void)
  80. {
  81. return "MIPS Malta";
  82. }
  83. #ifdef CONFIG_BLK_DEV_FD
  84. void __init fd_activate(void)
  85. {
  86. /*
  87. * Activate Floppy Controller in the SMSC FDC37M817 Super I/O
  88. * Controller.
  89. * Done by YAMON 2.00 onwards
  90. */
  91. /* Entering config state. */
  92. SMSC_WRITE(SMSC_CONFIG_ENTER, SMSC_CONFIG_REG);
  93. /* Activate floppy controller. */
  94. SMSC_WRITE(SMSC_CONFIG_DEVNUM, SMSC_CONFIG_REG);
  95. SMSC_WRITE(SMSC_CONFIG_DEVNUM_FLOPPY, SMSC_DATA_REG);
  96. SMSC_WRITE(SMSC_CONFIG_ACTIVATE, SMSC_CONFIG_REG);
  97. SMSC_WRITE(SMSC_CONFIG_ACTIVATE_ENABLE, SMSC_DATA_REG);
  98. /* Exit config state. */
  99. SMSC_WRITE(SMSC_CONFIG_EXIT, SMSC_CONFIG_REG);
  100. }
  101. #endif
  102. void __init plat_setup(void)
  103. {
  104. unsigned int i;
  105. mips_pcibios_init();
  106. /* Request I/O space for devices used on the Malta board. */
  107. for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
  108. request_resource(&ioport_resource, standard_io_resources+i);
  109. /*
  110. * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
  111. */
  112. enable_dma(4);
  113. #ifdef CONFIG_KGDB
  114. kgdb_config ();
  115. #endif
  116. if ((mips_revision_corid == MIPS_REVISION_CORID_BONITO64) ||
  117. (mips_revision_corid == MIPS_REVISION_CORID_CORE_20K) ||
  118. (mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL_BON)) {
  119. char *argptr;
  120. argptr = prom_getcmdline();
  121. if (strstr(argptr, "debug")) {
  122. BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
  123. printk ("Enabled Bonito debug mode\n");
  124. }
  125. else
  126. BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE;
  127. #ifdef CONFIG_DMA_COHERENT
  128. if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
  129. BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
  130. printk("Enabled Bonito CPU coherency\n");
  131. argptr = prom_getcmdline();
  132. if (strstr(argptr, "iobcuncached")) {
  133. BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
  134. BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
  135. ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
  136. BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
  137. printk("Disabled Bonito IOBC coherency\n");
  138. }
  139. else {
  140. BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
  141. BONITO_PCIMEMBASECFG |=
  142. (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
  143. BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
  144. printk("Disabled Bonito IOBC coherency\n");
  145. }
  146. }
  147. else
  148. panic("Hardware DMA cache coherency not supported");
  149. #endif
  150. }
  151. #ifdef CONFIG_DMA_COHERENT
  152. else {
  153. panic("Hardware DMA cache coherency not supported");
  154. }
  155. #endif
  156. #ifdef CONFIG_BLK_DEV_IDE
  157. /* Check PCI clock */
  158. {
  159. int jmpr = (*((volatile unsigned int *)ioremap(MALTA_JMPRS_REG, sizeof(unsigned int))) >> 2) & 0x07;
  160. static const int pciclocks[] __initdata = {
  161. 33, 20, 25, 30, 12, 16, 37, 10
  162. };
  163. int pciclock = pciclocks[jmpr];
  164. char *argptr = prom_getcmdline();
  165. if (pciclock != 33 && !strstr (argptr, "idebus=")) {
  166. printk("WARNING: PCI clock is %dMHz, setting idebus\n", pciclock);
  167. argptr += strlen(argptr);
  168. sprintf (argptr, " idebus=%d", pciclock);
  169. if (pciclock < 20 || pciclock > 66)
  170. printk ("WARNING: IDE timing calculations will be incorrect\n");
  171. }
  172. }
  173. #endif
  174. #ifdef CONFIG_BLK_DEV_FD
  175. fd_activate ();
  176. #endif
  177. #ifdef CONFIG_VT
  178. #if defined(CONFIG_VGA_CONSOLE)
  179. screen_info = (struct screen_info) {
  180. 0, 25, /* orig-x, orig-y */
  181. 0, /* unused */
  182. 0, /* orig-video-page */
  183. 0, /* orig-video-mode */
  184. 80, /* orig-video-cols */
  185. 0,0,0, /* ega_ax, ega_bx, ega_cx */
  186. 25, /* orig-video-lines */
  187. VIDEO_TYPE_VGAC, /* orig-video-isVGA */
  188. 16 /* orig-video-points */
  189. };
  190. #endif
  191. #endif
  192. #ifdef CONFIG_MTD
  193. /*
  194. * Support for MTD on Malta. Use the generic physmap driver
  195. */
  196. physmap_configure(0x1e000000, 0x400000, 4, NULL);
  197. physmap_set_partitions(malta_mtd_partitions, number_partitions);
  198. #endif
  199. mips_reboot_setup();
  200. board_time_init = mips_time_init;
  201. board_timer_setup = mips_timer_setup;
  202. rtc_mips_get_time = mips_rtc_get_time;
  203. }