setup.c 4.9 KB

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