serial.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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 <mach-gt64120.h>
  52. #define EV64120_SERIAL_PORT_DEFNS \
  53. { .baud_base = EV64120_BASE_BAUD, .irq = EV64120_UART_IRQ, \
  54. .flags = STD_COM_FLAGS, \
  55. .iomem_base = EV64120_UART0_REGS_BASE, .iomem_reg_shift = 2, \
  56. .io_type = SERIAL_IO_MEM }, \
  57. { .baud_base = EV64120_BASE_BAUD, .irq = EV64120_UART_IRQ, \
  58. .flags = STD_COM_FLAGS, \
  59. .iomem_base = EV64120_UART1_REGS_BASE, .iomem_reg_shift = 2, \
  60. .io_type = SERIAL_IO_MEM },
  61. #else
  62. #define EV64120_SERIAL_PORT_DEFNS
  63. #endif
  64. #ifdef CONFIG_MIPS_ITE8172
  65. #include <asm/it8172/it8172.h>
  66. #include <asm/it8172/it8172_int.h>
  67. #include <asm/it8712.h>
  68. #define ITE_SERIAL_PORT_DEFNS \
  69. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
  70. .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  71. { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \
  72. .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  73. /* Smart Card Reader 0 */ \
  74. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \
  75. .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  76. /* Smart Card Reader 1 */ \
  77. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
  78. .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
  79. #else
  80. #define ITE_SERIAL_PORT_DEFNS
  81. #endif
  82. #ifdef CONFIG_MIPS_IVR
  83. #include <asm/it8172/it8172.h>
  84. #include <asm/it8172/it8172_int.h>
  85. #define IVR_SERIAL_PORT_DEFNS \
  86. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
  87. .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
  88. /* Smart Card Reader 1 */ \
  89. { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
  90. .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
  91. #else
  92. #define IVR_SERIAL_PORT_DEFNS
  93. #endif
  94. #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
  95. #define STD_SERIAL_PORT_DEFNS \
  96. /* UART CLK PORT IRQ FLAGS */ \
  97. { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
  98. { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
  99. { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
  100. { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
  101. #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  102. #define STD_SERIAL_PORT_DEFNS
  103. #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  104. #ifdef CONFIG_MOMENCO_JAGUAR_ATX
  105. /* Ordinary NS16552 duart with a 20MHz crystal. */
  106. #define JAGUAR_ATX_UART_CLK 20000000
  107. #define JAGUAR_ATX_BASE_BAUD (JAGUAR_ATX_UART_CLK / 16)
  108. #define JAGUAR_ATX_SERIAL1_IRQ 6
  109. #define JAGUAR_ATX_SERIAL1_BASE 0xfd000023L
  110. #define _JAGUAR_ATX_SERIAL_INIT(int, base) \
  111. { .baud_base = JAGUAR_ATX_BASE_BAUD, irq: int, \
  112. .flags = (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
  113. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  114. io_type: SERIAL_IO_MEM }
  115. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS \
  116. _JAGUAR_ATX_SERIAL_INIT(JAGUAR_ATX_SERIAL1_IRQ, JAGUAR_ATX_SERIAL1_BASE)
  117. #else
  118. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS
  119. #endif
  120. #ifdef CONFIG_MOMENCO_OCELOT_3
  121. #define OCELOT_3_BASE_BAUD ( 20000000 / 16 )
  122. #define OCELOT_3_SERIAL_IRQ 6
  123. #define OCELOT_3_SERIAL_BASE (signed)0xfd000020
  124. #define _OCELOT_3_SERIAL_INIT(int, base) \
  125. { .baud_base = OCELOT_3_BASE_BAUD, irq: int, \
  126. .flags = STD_COM_FLAGS, \
  127. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  128. io_type: SERIAL_IO_MEM }
  129. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
  130. _OCELOT_3_SERIAL_INIT(OCELOT_3_SERIAL_IRQ, OCELOT_3_SERIAL_BASE)
  131. #else
  132. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  133. #endif
  134. #ifdef CONFIG_MOMENCO_OCELOT
  135. /* Ordinary NS16552 duart with a 20MHz crystal. */
  136. #define OCELOT_BASE_BAUD ( 20000000 / 16 )
  137. #define OCELOT_SERIAL1_IRQ 4
  138. #define OCELOT_SERIAL1_BASE 0xe0001020
  139. #define _OCELOT_SERIAL_INIT(int, base) \
  140. { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
  141. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  142. .io_type = SERIAL_IO_MEM }
  143. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  144. _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE)
  145. #else
  146. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS
  147. #endif
  148. #ifdef CONFIG_MOMENCO_OCELOT_G
  149. /* Ordinary NS16552 duart with a 20MHz crystal. */
  150. #define OCELOT_G_BASE_BAUD ( 20000000 / 16 )
  151. #define OCELOT_G_SERIAL1_IRQ 4
  152. #if 0
  153. #define OCELOT_G_SERIAL1_BASE 0xe0001020
  154. #else
  155. #define OCELOT_G_SERIAL1_BASE 0xfd000020
  156. #endif
  157. #define _OCELOT_G_SERIAL_INIT(int, base) \
  158. { .baud_base = OCELOT_G_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS,\
  159. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  160. .io_type = SERIAL_IO_MEM }
  161. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  162. _OCELOT_G_SERIAL_INIT(OCELOT_G_SERIAL1_IRQ, OCELOT_G_SERIAL1_BASE)
  163. #else
  164. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS
  165. #endif
  166. #ifdef CONFIG_MOMENCO_OCELOT_C
  167. /* Ordinary NS16552 duart with a 20MHz crystal. */
  168. #define OCELOT_C_BASE_BAUD ( 20000000 / 16 )
  169. #define OCELOT_C_SERIAL1_IRQ 80
  170. #define OCELOT_C_SERIAL1_BASE 0xfd000020
  171. #define OCELOT_C_SERIAL2_IRQ 81
  172. #define OCELOT_C_SERIAL2_BASE 0xfd000000
  173. #define _OCELOT_C_SERIAL_INIT(int, base) \
  174. { .baud_base = OCELOT_C_BASE_BAUD, \
  175. .irq = (int), \
  176. .flags = STD_COM_FLAGS, \
  177. .iomem_base = (u8 *) base, \
  178. .iomem_reg_shift = 2, \
  179. .io_type = SERIAL_IO_MEM \
  180. }
  181. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  182. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL1_IRQ, OCELOT_C_SERIAL1_BASE), \
  183. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL2_IRQ, OCELOT_C_SERIAL2_BASE)
  184. #else
  185. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS
  186. #endif
  187. #ifdef CONFIG_DDB5477
  188. #include <asm/ddb5xxx/ddb5477.h>
  189. #define DDB5477_SERIAL_PORT_DEFNS \
  190. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \
  191. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \
  192. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \
  193. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \
  194. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \
  195. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM},
  196. #else
  197. #define DDB5477_SERIAL_PORT_DEFNS
  198. #endif
  199. #ifdef CONFIG_SGI_IP32
  200. /*
  201. * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
  202. * They are initialized in ip32_setup
  203. */
  204. #define IP32_SERIAL_PORT_DEFNS \
  205. {},{},
  206. #else
  207. #define IP32_SERIAL_PORT_DEFNS
  208. #endif /* CONFIG_SGI_IP32 */
  209. #define SERIAL_PORT_DFNS \
  210. DDB5477_SERIAL_PORT_DEFNS \
  211. EV64120_SERIAL_PORT_DEFNS \
  212. IP32_SERIAL_PORT_DEFNS \
  213. ITE_SERIAL_PORT_DEFNS \
  214. IVR_SERIAL_PORT_DEFNS \
  215. JAZZ_SERIAL_PORT_DEFNS \
  216. STD_SERIAL_PORT_DEFNS \
  217. MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  218. MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  219. MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  220. MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  221. #endif /* _ASM_SERIAL_H */