serial.h 8.6 KB

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