setup.c 4.6 KB

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