setup.c 4.8 KB

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