setup.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. isa_slot_offset = 0xe3000000;
  76. /* request I/O space for devices used on all i[345]86 PCs */
  77. for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
  78. request_resource(&ioport_resource, jazz_io_resources + i);
  79. /* The RTC is outside the port address space */
  80. _machine_restart = jazz_machine_restart;
  81. #ifdef CONFIG_VT
  82. screen_info = (struct screen_info) {
  83. 0, 0, /* orig-x, orig-y */
  84. 0, /* unused */
  85. 0, /* orig_video_page */
  86. 0, /* orig_video_mode */
  87. 160, /* orig_video_cols */
  88. 0, 0, 0, /* unused, ega_bx, unused */
  89. 64, /* orig_video_lines */
  90. 0, /* orig_video_isVGA */
  91. 16 /* orig_video_points */
  92. };
  93. #endif
  94. add_preferred_console("ttyS", 0, "9600");
  95. }
  96. #ifdef CONFIG_OLIVETTI_M700
  97. #define UART_CLK 1843200
  98. #else
  99. /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
  100. exactly which ones ... XXX */
  101. #define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
  102. #endif
  103. #define MEMPORT(_base, _irq) \
  104. { \
  105. .mapbase = (_base), \
  106. .membase = (void *)(_base), \
  107. .irq = (_irq), \
  108. .uartclk = UART_CLK, \
  109. .iotype = UPIO_MEM, \
  110. .flags = UPF_BOOT_AUTOCONF, \
  111. }
  112. static struct plat_serial8250_port jazz_serial_data[] = {
  113. MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
  114. MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
  115. { },
  116. };
  117. static struct platform_device jazz_serial8250_device = {
  118. .name = "serial8250",
  119. .id = PLAT8250_DEV_PLATFORM,
  120. .dev = {
  121. .platform_data = jazz_serial_data,
  122. },
  123. };
  124. static struct resource jazz_esp_rsrc[] = {
  125. {
  126. .start = JAZZ_SCSI_BASE,
  127. .end = JAZZ_SCSI_BASE + 31,
  128. .flags = IORESOURCE_MEM
  129. },
  130. {
  131. .start = JAZZ_SCSI_DMA,
  132. .end = JAZZ_SCSI_DMA,
  133. .flags = IORESOURCE_MEM
  134. },
  135. {
  136. .start = JAZZ_SCSI_IRQ,
  137. .end = JAZZ_SCSI_IRQ,
  138. .flags = IORESOURCE_IRQ
  139. }
  140. };
  141. static struct platform_device jazz_esp_pdev = {
  142. .name = "jazz_esp",
  143. .num_resources = ARRAY_SIZE(jazz_esp_rsrc),
  144. .resource = jazz_esp_rsrc
  145. };
  146. static struct resource jazz_sonic_rsrc[] = {
  147. {
  148. .start = JAZZ_ETHERNET_BASE,
  149. .end = JAZZ_ETHERNET_BASE + 0xff,
  150. .flags = IORESOURCE_MEM
  151. },
  152. {
  153. .start = JAZZ_ETHERNET_IRQ,
  154. .end = JAZZ_ETHERNET_IRQ,
  155. .flags = IORESOURCE_IRQ
  156. }
  157. };
  158. static struct platform_device jazz_sonic_pdev = {
  159. .name = "jazzsonic",
  160. .num_resources = ARRAY_SIZE(jazz_sonic_rsrc),
  161. .resource = jazz_sonic_rsrc
  162. };
  163. static struct resource jazz_cmos_rsrc[] = {
  164. {
  165. .start = 0x70,
  166. .end = 0x71,
  167. .flags = IORESOURCE_IO
  168. },
  169. {
  170. .start = 8,
  171. .end = 8,
  172. .flags = IORESOURCE_IRQ
  173. }
  174. };
  175. static struct platform_device jazz_cmos_pdev = {
  176. .name = "rtc_cmos",
  177. .num_resources = ARRAY_SIZE(jazz_cmos_rsrc),
  178. .resource = jazz_cmos_rsrc
  179. };
  180. static int __init jazz_setup_devinit(void)
  181. {
  182. platform_device_register(&jazz_serial8250_device);
  183. platform_device_register(&jazz_esp_pdev);
  184. platform_device_register(&jazz_sonic_pdev);
  185. platform_device_register(&jazz_cmos_pdev);
  186. return 0;
  187. }
  188. device_initcall(jazz_setup_devinit);