setup.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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, 1998, 2001 by Ralf Baechle
  9. * Copyright (C) 2001 MIPS Technologies, Inc.
  10. * Copyright (C) 2007 by Thomas Bogendoerfer
  11. */
  12. #include <linux/eisa.h>
  13. #include <linux/hdreg.h>
  14. #include <linux/init.h>
  15. #include <linux/ioport.h>
  16. #include <linux/sched.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/mm.h>
  19. #include <linux/console.h>
  20. #include <linux/fb.h>
  21. #include <linux/ide.h>
  22. #include <linux/pm.h>
  23. #include <linux/screen_info.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/serial_8250.h>
  26. #include <asm/bootinfo.h>
  27. #include <asm/irq.h>
  28. #include <asm/jazz.h>
  29. #include <asm/jazzdma.h>
  30. #include <asm/reboot.h>
  31. #include <asm/io.h>
  32. #include <asm/pgtable.h>
  33. #include <asm/time.h>
  34. #include <asm/traps.h>
  35. #include <asm/mc146818-time.h>
  36. extern asmlinkage void jazz_handle_int(void);
  37. extern void jazz_machine_restart(char *command);
  38. void __init plat_timer_setup(struct irqaction *irq)
  39. {
  40. /* set the clock to 100 Hz */
  41. r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
  42. setup_irq(JAZZ_TIMER_IRQ, irq);
  43. }
  44. static struct resource jazz_io_resources[] = {
  45. {
  46. .start = 0x00,
  47. .end = 0x1f,
  48. .name = "dma1",
  49. .flags = IORESOURCE_BUSY
  50. }, {
  51. .start = 0x40,
  52. .end = 0x5f,
  53. .name = "timer",
  54. .flags = IORESOURCE_BUSY
  55. }, {
  56. .start = 0x80,
  57. .end = 0x8f,
  58. .name = "dma page reg",
  59. .flags = IORESOURCE_BUSY
  60. }, {
  61. .start = 0xc0,
  62. .end = 0xdf,
  63. .name = "dma2",
  64. .flags = IORESOURCE_BUSY
  65. }
  66. };
  67. void __init plat_mem_setup(void)
  68. {
  69. int i;
  70. /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
  71. add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K);
  72. /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
  73. add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M);
  74. /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
  75. add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M);
  76. set_io_port_base(JAZZ_PORT_BASE);
  77. #ifdef CONFIG_EISA
  78. if (mips_machtype == MACH_MIPS_MAGNUM_4000)
  79. EISA_bus = 1;
  80. #endif
  81. isa_slot_offset = 0xe3000000;
  82. /* request I/O space for devices used on all i[345]86 PCs */
  83. for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
  84. request_resource(&ioport_resource, jazz_io_resources + i);
  85. /* The RTC is outside the port address space */
  86. _machine_restart = jazz_machine_restart;
  87. #ifdef CONFIG_VT
  88. screen_info = (struct screen_info) {
  89. 0, 0, /* orig-x, orig-y */
  90. 0, /* unused */
  91. 0, /* orig_video_page */
  92. 0, /* orig_video_mode */
  93. 160, /* orig_video_cols */
  94. 0, 0, 0, /* unused, ega_bx, unused */
  95. 64, /* orig_video_lines */
  96. 0, /* orig_video_isVGA */
  97. 16 /* orig_video_points */
  98. };
  99. #endif
  100. add_preferred_console("ttyS", 0, "9600");
  101. }
  102. #ifdef CONFIG_OLIVETTI_M700
  103. #define UART_CLK 1843200
  104. #else
  105. /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
  106. exactly which ones ... XXX */
  107. #define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
  108. #endif
  109. #define MEMPORT(_base, _irq) \
  110. { \
  111. .mapbase = (_base), \
  112. .membase = (void *)(_base), \
  113. .irq = (_irq), \
  114. .uartclk = UART_CLK, \
  115. .iotype = UPIO_MEM, \
  116. .flags = UPF_BOOT_AUTOCONF, \
  117. }
  118. static struct plat_serial8250_port jazz_serial_data[] = {
  119. MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
  120. MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
  121. { },
  122. };
  123. static struct platform_device jazz_serial8250_device = {
  124. .name = "serial8250",
  125. .id = PLAT8250_DEV_PLATFORM,
  126. .dev = {
  127. .platform_data = jazz_serial_data,
  128. },
  129. };
  130. static struct resource jazz_esp_rsrc[] = {
  131. {
  132. .start = JAZZ_SCSI_BASE,
  133. .end = JAZZ_SCSI_BASE + 31,
  134. .flags = IORESOURCE_MEM
  135. },
  136. {
  137. .start = JAZZ_SCSI_DMA,
  138. .end = JAZZ_SCSI_DMA,
  139. .flags = IORESOURCE_MEM
  140. },
  141. {
  142. .start = JAZZ_SCSI_IRQ,
  143. .end = JAZZ_SCSI_IRQ,
  144. .flags = IORESOURCE_IRQ
  145. }
  146. };
  147. static struct platform_device jazz_esp_pdev = {
  148. .name = "jazz_esp",
  149. .num_resources = ARRAY_SIZE(jazz_esp_rsrc),
  150. .resource = jazz_esp_rsrc
  151. };
  152. static struct resource jazz_sonic_rsrc[] = {
  153. {
  154. .start = JAZZ_ETHERNET_BASE,
  155. .end = JAZZ_ETHERNET_BASE + 0xff,
  156. .flags = IORESOURCE_MEM
  157. },
  158. {
  159. .start = JAZZ_ETHERNET_IRQ,
  160. .end = JAZZ_ETHERNET_IRQ,
  161. .flags = IORESOURCE_IRQ
  162. }
  163. };
  164. static struct platform_device jazz_sonic_pdev = {
  165. .name = "jazzsonic",
  166. .num_resources = ARRAY_SIZE(jazz_sonic_rsrc),
  167. .resource = jazz_sonic_rsrc
  168. };
  169. static struct resource jazz_cmos_rsrc[] = {
  170. {
  171. .start = 0x70,
  172. .end = 0x71,
  173. .flags = IORESOURCE_IO
  174. },
  175. {
  176. .start = 8,
  177. .end = 8,
  178. .flags = IORESOURCE_IRQ
  179. }
  180. };
  181. static struct platform_device jazz_cmos_pdev = {
  182. .name = "rtc_cmos",
  183. .num_resources = ARRAY_SIZE(jazz_cmos_rsrc),
  184. .resource = jazz_cmos_rsrc
  185. };
  186. static int __init jazz_setup_devinit(void)
  187. {
  188. platform_device_register(&jazz_serial8250_device);
  189. platform_device_register(&jazz_esp_pdev);
  190. platform_device_register(&jazz_sonic_pdev);
  191. platform_device_register(&jazz_cmos_pdev);
  192. return 0;
  193. }
  194. device_initcall(jazz_setup_devinit);