serial.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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_HAVE_STD_PC_SERIAL_PORT
  65. #define STD_SERIAL_PORT_DEFNS \
  66. /* UART CLK PORT IRQ FLAGS */ \
  67. { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
  68. { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
  69. { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
  70. { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
  71. #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  72. #define STD_SERIAL_PORT_DEFNS
  73. #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  74. #ifdef CONFIG_MOMENCO_JAGUAR_ATX
  75. /* Ordinary NS16552 duart with a 20MHz crystal. */
  76. #define JAGUAR_ATX_UART_CLK 20000000
  77. #define JAGUAR_ATX_BASE_BAUD (JAGUAR_ATX_UART_CLK / 16)
  78. #define JAGUAR_ATX_SERIAL1_IRQ 6
  79. #define JAGUAR_ATX_SERIAL1_BASE 0xfd000023L
  80. #define _JAGUAR_ATX_SERIAL_INIT(int, base) \
  81. { .baud_base = JAGUAR_ATX_BASE_BAUD, irq: int, \
  82. .flags = (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
  83. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  84. io_type: SERIAL_IO_MEM }
  85. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS \
  86. _JAGUAR_ATX_SERIAL_INIT(JAGUAR_ATX_SERIAL1_IRQ, JAGUAR_ATX_SERIAL1_BASE)
  87. #else
  88. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS
  89. #endif
  90. #ifdef CONFIG_MOMENCO_OCELOT_3
  91. #define OCELOT_3_BASE_BAUD ( 20000000 / 16 )
  92. #define OCELOT_3_SERIAL_IRQ 6
  93. #define OCELOT_3_SERIAL_BASE (signed)0xfd000020
  94. #define _OCELOT_3_SERIAL_INIT(int, base) \
  95. { .baud_base = OCELOT_3_BASE_BAUD, irq: int, \
  96. .flags = STD_COM_FLAGS, \
  97. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  98. io_type: SERIAL_IO_MEM }
  99. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
  100. _OCELOT_3_SERIAL_INIT(OCELOT_3_SERIAL_IRQ, OCELOT_3_SERIAL_BASE)
  101. #else
  102. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  103. #endif
  104. #ifdef CONFIG_MOMENCO_OCELOT
  105. /* Ordinary NS16552 duart with a 20MHz crystal. */
  106. #define OCELOT_BASE_BAUD ( 20000000 / 16 )
  107. #define OCELOT_SERIAL1_IRQ 4
  108. #define OCELOT_SERIAL1_BASE 0xe0001020
  109. #define _OCELOT_SERIAL_INIT(int, base) \
  110. { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
  111. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  112. .io_type = SERIAL_IO_MEM }
  113. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  114. _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE)
  115. #else
  116. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS
  117. #endif
  118. #ifdef CONFIG_MOMENCO_OCELOT_G
  119. /* Ordinary NS16552 duart with a 20MHz crystal. */
  120. #define OCELOT_G_BASE_BAUD ( 20000000 / 16 )
  121. #define OCELOT_G_SERIAL1_IRQ 4
  122. #if 0
  123. #define OCELOT_G_SERIAL1_BASE 0xe0001020
  124. #else
  125. #define OCELOT_G_SERIAL1_BASE 0xfd000020
  126. #endif
  127. #define _OCELOT_G_SERIAL_INIT(int, base) \
  128. { .baud_base = OCELOT_G_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS,\
  129. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  130. .io_type = SERIAL_IO_MEM }
  131. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  132. _OCELOT_G_SERIAL_INIT(OCELOT_G_SERIAL1_IRQ, OCELOT_G_SERIAL1_BASE)
  133. #else
  134. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS
  135. #endif
  136. #ifdef CONFIG_MOMENCO_OCELOT_C
  137. /* Ordinary NS16552 duart with a 20MHz crystal. */
  138. #define OCELOT_C_BASE_BAUD ( 20000000 / 16 )
  139. #define OCELOT_C_SERIAL1_IRQ 80
  140. #define OCELOT_C_SERIAL1_BASE 0xfd000020
  141. #define OCELOT_C_SERIAL2_IRQ 81
  142. #define OCELOT_C_SERIAL2_BASE 0xfd000000
  143. #define _OCELOT_C_SERIAL_INIT(int, base) \
  144. { .baud_base = OCELOT_C_BASE_BAUD, \
  145. .irq = (int), \
  146. .flags = STD_COM_FLAGS, \
  147. .iomem_base = (u8 *) base, \
  148. .iomem_reg_shift = 2, \
  149. .io_type = SERIAL_IO_MEM \
  150. }
  151. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  152. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL1_IRQ, OCELOT_C_SERIAL1_BASE), \
  153. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL2_IRQ, OCELOT_C_SERIAL2_BASE)
  154. #else
  155. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS
  156. #endif
  157. #ifdef CONFIG_DDB5477
  158. #include <asm/ddb5xxx/ddb5477.h>
  159. #define DDB5477_SERIAL_PORT_DEFNS \
  160. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \
  161. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \
  162. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \
  163. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \
  164. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \
  165. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM},
  166. #else
  167. #define DDB5477_SERIAL_PORT_DEFNS
  168. #endif
  169. #ifdef CONFIG_SGI_IP32
  170. /*
  171. * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
  172. * They are initialized in ip32_setup
  173. */
  174. #define IP32_SERIAL_PORT_DEFNS \
  175. {},{},
  176. #else
  177. #define IP32_SERIAL_PORT_DEFNS
  178. #endif /* CONFIG_SGI_IP32 */
  179. #define SERIAL_PORT_DFNS \
  180. DDB5477_SERIAL_PORT_DEFNS \
  181. EV64120_SERIAL_PORT_DEFNS \
  182. IP32_SERIAL_PORT_DEFNS \
  183. JAZZ_SERIAL_PORT_DEFNS \
  184. STD_SERIAL_PORT_DEFNS \
  185. MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  186. MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  187. MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  188. MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  189. #endif /* _ASM_SERIAL_H */