setup.c 4.9 KB

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