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