serial.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1999 by Ralf Baechle
  7. * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  8. */
  9. #ifndef _ASM_SERIAL_H
  10. #define _ASM_SERIAL_H
  11. /*
  12. * This assumes you have a 1.8432 MHz clock for your UART.
  13. *
  14. * It'd be nice if someone built a serial card with a 24.576 MHz
  15. * clock, since the 16550A is capable of handling a top speed of 1.5
  16. * megabits/second; but this requires the faster clock.
  17. */
  18. #define BASE_BAUD (1843200 / 16)
  19. /* Standard COM flags (except for COM4, because of the 8514 problem) */
  20. #ifdef CONFIG_SERIAL_DETECT_IRQ
  21. #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
  22. #define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
  23. #else
  24. #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
  25. #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
  26. #endif
  27. #ifdef CONFIG_MACH_JAZZ
  28. #include <asm/jazz.h>
  29. #ifndef CONFIG_OLIVETTI_M700
  30. /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
  31. exactly which ones ... XXX */
  32. #define JAZZ_BASE_BAUD ( 8000000 / 16 ) /* ( 3072000 / 16) */
  33. #else
  34. /* but the M700 isn't such a strange beast */
  35. #define JAZZ_BASE_BAUD BASE_BAUD
  36. #endif
  37. #define _JAZZ_SERIAL_INIT(int, base) \
  38. { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
  39. .iomem_base = (u8 *) base, .iomem_reg_shift = 0, \
  40. .io_type = SERIAL_IO_MEM }
  41. #define JAZZ_SERIAL_PORT_DEFNS \
  42. _JAZZ_SERIAL_INIT(JAZZ_SERIAL1_IRQ, JAZZ_SERIAL1_BASE), \
  43. _JAZZ_SERIAL_INIT(JAZZ_SERIAL2_IRQ, JAZZ_SERIAL2_BASE),
  44. #else
  45. #define JAZZ_SERIAL_PORT_DEFNS
  46. #endif
  47. /*
  48. * Galileo EV64120 evaluation board
  49. */
  50. #ifdef CONFIG_MIPS_EV64120
  51. #include <asm/galileo-boards/ev96100.h>
  52. #include <asm/galileo-boards/ev96100int.h>
  53. #define EV96100_SERIAL_PORT_DEFNS \
  54. { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \
  55. .flags = STD_COM_FLAGS, \
  56. .iomem_base = EV96100_UART0_REGS_BASE, .iomem_reg_shift = 2, \
  57. .io_type = SERIAL_IO_MEM }, \
  58. { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \
  59. .flags = STD_COM_FLAGS, \
  60. .iomem_base = EV96100_UART1_REGS_BASE, .iomem_reg_shift = 2, \
  61. .io_type = SERIAL_IO_MEM },
  62. #else
  63. #define EV96100_SERIAL_PORT_DEFNS
  64. #endif
  65. #ifdef CONFIG_MIPS_ITE8172
  66. #include <asm/it8172/it8172.h>
  67. #include <asm/it8172/it8172_int.h>
  68. #include <asm/it8712.h>
  69. #define ITE_SERIAL_PORT_DEFNS \
  70. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
  71. .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  72. { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \
  73. .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  74. /* Smart Card Reader 0 */ \
  75. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \
  76. .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  77. /* Smart Card Reader 1 */ \
  78. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
  79. .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
  80. #else
  81. #define ITE_SERIAL_PORT_DEFNS
  82. #endif
  83. #ifdef CONFIG_MIPS_IVR
  84. #include <asm/it8172/it8172.h>
  85. #include <asm/it8172/it8172_int.h>
  86. #define IVR_SERIAL_PORT_DEFNS \
  87. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
  88. .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  89. /* Smart Card Reader 1 */ \
  90. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
  91. .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
  92. #else
  93. #define IVR_SERIAL_PORT_DEFNS
  94. #endif
  95. #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
  96. #define STD_SERIAL_PORT_DEFNS \
  97. /* UART CLK PORT IRQ FLAGS */ \
  98. { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
  99. { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
  100. { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
  101. { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
  102. #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  103. #define STD_SERIAL_PORT_DEFNS
  104. #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  105. #ifdef CONFIG_MOMENCO_JAGUAR_ATX
  106. /* Ordinary NS16552 duart with a 20MHz crystal. */
  107. #define JAGUAR_ATX_UART_CLK 20000000
  108. #define JAGUAR_ATX_BASE_BAUD (JAGUAR_ATX_UART_CLK / 16)
  109. #define JAGUAR_ATX_SERIAL1_IRQ 6
  110. #define JAGUAR_ATX_SERIAL1_BASE 0xfd000023L
  111. #define _JAGUAR_ATX_SERIAL_INIT(int, base) \
  112. { .baud_base = JAGUAR_ATX_BASE_BAUD, irq: int, \
  113. .flags = (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
  114. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  115. io_type: SERIAL_IO_MEM }
  116. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS \
  117. _JAGUAR_ATX_SERIAL_INIT(JAGUAR_ATX_SERIAL1_IRQ, JAGUAR_ATX_SERIAL1_BASE)
  118. #else
  119. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS
  120. #endif
  121. #ifdef CONFIG_MOMENCO_OCELOT_3
  122. #define OCELOT_3_BASE_BAUD ( 20000000 / 16 )
  123. #define OCELOT_3_SERIAL_IRQ 6
  124. #define OCELOT_3_SERIAL_BASE (signed)0xfd000020
  125. #define _OCELOT_3_SERIAL_INIT(int, base) \
  126. { .baud_base = OCELOT_3_BASE_BAUD, irq: int, \
  127. .flags = STD_COM_FLAGS, \
  128. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  129. io_type: SERIAL_IO_MEM }
  130. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
  131. _OCELOT_3_SERIAL_INIT(OCELOT_3_SERIAL_IRQ, OCELOT_3_SERIAL_BASE)
  132. #else
  133. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  134. #endif
  135. #ifdef CONFIG_MOMENCO_OCELOT
  136. /* Ordinary NS16552 duart with a 20MHz crystal. */
  137. #define OCELOT_BASE_BAUD ( 20000000 / 16 )
  138. #define OCELOT_SERIAL1_IRQ 4
  139. #define OCELOT_SERIAL1_BASE 0xe0001020
  140. #define _OCELOT_SERIAL_INIT(int, base) \
  141. { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
  142. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  143. .io_type = SERIAL_IO_MEM }
  144. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  145. _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE)
  146. #else
  147. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS
  148. #endif
  149. #ifdef CONFIG_MOMENCO_OCELOT_G
  150. /* Ordinary NS16552 duart with a 20MHz crystal. */
  151. #define OCELOT_G_BASE_BAUD ( 20000000 / 16 )
  152. #define OCELOT_G_SERIAL1_IRQ 4
  153. #if 0
  154. #define OCELOT_G_SERIAL1_BASE 0xe0001020
  155. #else
  156. #define OCELOT_G_SERIAL1_BASE 0xfd000020
  157. #endif
  158. #define _OCELOT_G_SERIAL_INIT(int, base) \
  159. { .baud_base = OCELOT_G_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS,\
  160. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  161. .io_type = SERIAL_IO_MEM }
  162. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  163. _OCELOT_G_SERIAL_INIT(OCELOT_G_SERIAL1_IRQ, OCELOT_G_SERIAL1_BASE)
  164. #else
  165. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS
  166. #endif
  167. #ifdef CONFIG_MOMENCO_OCELOT_C
  168. /* Ordinary NS16552 duart with a 20MHz crystal. */
  169. #define OCELOT_C_BASE_BAUD ( 20000000 / 16 )
  170. #define OCELOT_C_SERIAL1_IRQ 80
  171. #define OCELOT_C_SERIAL1_BASE 0xfd000020
  172. #define OCELOT_C_SERIAL2_IRQ 81
  173. #define OCELOT_C_SERIAL2_BASE 0xfd000000
  174. #define _OCELOT_C_SERIAL_INIT(int, base) \
  175. { .baud_base = OCELOT_C_BASE_BAUD, \
  176. .irq = (int), \
  177. .flags = STD_COM_FLAGS, \
  178. .iomem_base = (u8 *) base, \
  179. .iomem_reg_shift = 2, \
  180. .io_type = SERIAL_IO_MEM \
  181. }
  182. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  183. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL1_IRQ, OCELOT_C_SERIAL1_BASE), \
  184. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL2_IRQ, OCELOT_C_SERIAL2_BASE)
  185. #else
  186. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS
  187. #endif
  188. #ifdef CONFIG_DDB5477
  189. #include <asm/ddb5xxx/ddb5477.h>
  190. #define DDB5477_SERIAL_PORT_DEFNS \
  191. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \
  192. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \
  193. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \
  194. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \
  195. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \
  196. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM},
  197. #else
  198. #define DDB5477_SERIAL_PORT_DEFNS
  199. #endif
  200. #ifdef CONFIG_SGI_IP32
  201. /*
  202. * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
  203. * They are initialized in ip32_setup
  204. */
  205. #define IP32_SERIAL_PORT_DEFNS \
  206. {},{},
  207. #else
  208. #define IP32_SERIAL_PORT_DEFNS
  209. #endif /* CONFIG_SGI_IP32 */
  210. #define SERIAL_PORT_DFNS \
  211. DDB5477_SERIAL_PORT_DEFNS \
  212. EV96100_SERIAL_PORT_DEFNS \
  213. IP32_SERIAL_PORT_DEFNS \
  214. ITE_SERIAL_PORT_DEFNS \
  215. IVR_SERIAL_PORT_DEFNS \
  216. JAZZ_SERIAL_PORT_DEFNS \
  217. STD_SERIAL_PORT_DEFNS \
  218. MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  219. MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  220. MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  221. MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  222. #endif /* _ASM_SERIAL_H */