setup.c 4.9 KB

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