serial.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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, .type = 0x3 }, \
  73. { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \
  74. .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .type = 0x3 }, \
  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, .type = 0x3 }, \
  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, .type = 0x3 },
  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, .type = 0x3 }, \
  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, .type = 0x3 },
  93. #else
  94. #define IVR_SERIAL_PORT_DEFNS
  95. #endif
  96. #ifdef CONFIG_SERIAL_AU1X00
  97. #include <asm/mach-au1x00/au1000.h>
  98. #ifdef CONFIG_SOC_AU1000
  99. #define AU1000_SERIAL_PORT_DEFNS \
  100. { .baud_base = 0, .port = UART0_ADDR, \
  101. .iomem_base = (unsigned char *)UART0_ADDR, \
  102. .irq = AU1000_UART0_INT, .flags = STD_COM_FLAGS, \
  103. .iomem_reg_shift = 2 }, \
  104. { .baud_base = 0, .port = UART1_ADDR, \
  105. .iomem_base = (unsigned char *)UART1_ADDR, \
  106. .irq = AU1000_UART1_INT, .flags = STD_COM_FLAGS, \
  107. .iomem_reg_shift = 2 }, \
  108. { .baud_base = 0, .port = UART2_ADDR, \
  109. .iomem_base = (unsigned char *)UART2_ADDR, \
  110. .irq = AU1000_UART2_INT, .flags = STD_COM_FLAGS, \
  111. .iomem_reg_shift = 2 }, \
  112. { .baud_base = 0, .port = UART3_ADDR, \
  113. .iomem_base = (unsigned char *)UART3_ADDR, \
  114. .irq = AU1000_UART3_INT, .flags = STD_COM_FLAGS, \
  115. .iomem_reg_shift = 2 },
  116. #endif
  117. #ifdef CONFIG_SOC_AU1500
  118. #define AU1000_SERIAL_PORT_DEFNS \
  119. { .baud_base = 0, .port = UART0_ADDR, \
  120. .iomem_base = (unsigned char *)UART0_ADDR, \
  121. .irq = AU1500_UART0_INT, .flags = STD_COM_FLAGS, \
  122. .iomem_reg_shift = 2 }, \
  123. { .baud_base = 0, .port = UART3_ADDR, \
  124. .iomem_base = (unsigned char *)UART3_ADDR, \
  125. .irq = AU1500_UART3_INT, .flags = STD_COM_FLAGS, \
  126. .iomem_reg_shift = 2 },
  127. #endif
  128. #ifdef CONFIG_SOC_AU1100
  129. #define AU1000_SERIAL_PORT_DEFNS \
  130. { .baud_base = 0, .port = UART0_ADDR, \
  131. .iomem_base = (unsigned char *)UART0_ADDR, \
  132. .irq = AU1100_UART0_INT, .flags = STD_COM_FLAGS, \
  133. .iomem_reg_shift = 2 }, \
  134. { .baud_base = 0, .port = UART1_ADDR, \
  135. .iomem_base = (unsigned char *)UART1_ADDR, \
  136. .irq = AU1100_UART1_INT, .flags = STD_COM_FLAGS, \
  137. .iomem_reg_shift = 2 }, \
  138. { .baud_base = 0, .port = UART3_ADDR, \
  139. .iomem_base = (unsigned char *)UART3_ADDR, \
  140. .irq = AU1100_UART3_INT, .flags = STD_COM_FLAGS, \
  141. .iomem_reg_shift = 2 },
  142. #endif
  143. #ifdef CONFIG_SOC_AU1550
  144. #define AU1000_SERIAL_PORT_DEFNS \
  145. { .baud_base = 0, .port = UART0_ADDR, \
  146. .iomem_base = (unsigned char *)UART0_ADDR, \
  147. .irq = AU1550_UART0_INT, .flags = STD_COM_FLAGS, \
  148. .iomem_reg_shift = 2 }, \
  149. { .baud_base = 0, .port = UART1_ADDR, \
  150. .iomem_base = (unsigned char *)UART1_ADDR, \
  151. .irq = AU1550_UART1_INT, .flags = STD_COM_FLAGS, \
  152. .iomem_reg_shift = 2 }, \
  153. { .baud_base = 0, .port = UART3_ADDR, \
  154. .iomem_base = (unsigned char *)UART3_ADDR, \
  155. .irq = AU1550_UART3_INT, .flags = STD_COM_FLAGS,\
  156. .iomem_reg_shift = 2 },
  157. #endif
  158. #ifdef CONFIG_SOC_AU1200
  159. #define AU1000_SERIAL_PORT_DEFNS \
  160. { .baud_base = 0, .port = UART0_ADDR, \
  161. .iomem_base = (unsigned char *)UART0_ADDR, \
  162. .irq = AU1200_UART0_INT, .flags = STD_COM_FLAGS, \
  163. .iomem_reg_shift = 2 }, \
  164. { .baud_base = 0, .port = UART1_ADDR, \
  165. .iomem_base = (unsigned char *)UART1_ADDR, \
  166. .irq = AU1200_UART1_INT, .flags = STD_COM_FLAGS, \
  167. .iomem_reg_shift = 2 },
  168. #endif
  169. #else
  170. #define AU1000_SERIAL_PORT_DEFNS
  171. #endif
  172. #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
  173. #define STD_SERIAL_PORT_DEFNS \
  174. /* UART CLK PORT IRQ FLAGS */ \
  175. { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
  176. { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
  177. { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
  178. { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
  179. #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  180. #define STD_SERIAL_PORT_DEFNS
  181. #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  182. #ifdef CONFIG_MOMENCO_JAGUAR_ATX
  183. /* Ordinary NS16552 duart with a 20MHz crystal. */
  184. #define JAGUAR_ATX_UART_CLK 20000000
  185. #define JAGUAR_ATX_BASE_BAUD (JAGUAR_ATX_UART_CLK / 16)
  186. #define JAGUAR_ATX_SERIAL1_IRQ 6
  187. #define JAGUAR_ATX_SERIAL1_BASE 0xfd000023L
  188. #define _JAGUAR_ATX_SERIAL_INIT(int, base) \
  189. { .baud_base = JAGUAR_ATX_BASE_BAUD, irq: int, \
  190. .flags = (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
  191. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  192. io_type: SERIAL_IO_MEM }
  193. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS \
  194. _JAGUAR_ATX_SERIAL_INIT(JAGUAR_ATX_SERIAL1_IRQ, JAGUAR_ATX_SERIAL1_BASE)
  195. #else
  196. #define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS
  197. #endif
  198. #ifdef CONFIG_MOMENCO_OCELOT_3
  199. #define OCELOT_3_BASE_BAUD ( 20000000 / 16 )
  200. #define OCELOT_3_SERIAL_IRQ 6
  201. #define OCELOT_3_SERIAL_BASE (signed)0xfd000020
  202. #define _OCELOT_3_SERIAL_INIT(int, base) \
  203. { .baud_base = OCELOT_3_BASE_BAUD, irq: int, \
  204. .flags = STD_COM_FLAGS, \
  205. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  206. io_type: SERIAL_IO_MEM }
  207. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
  208. _OCELOT_3_SERIAL_INIT(OCELOT_3_SERIAL_IRQ, OCELOT_3_SERIAL_BASE)
  209. #else
  210. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  211. #endif
  212. #ifdef CONFIG_MOMENCO_OCELOT
  213. /* Ordinary NS16552 duart with a 20MHz crystal. */
  214. #define OCELOT_BASE_BAUD ( 20000000 / 16 )
  215. #define OCELOT_SERIAL1_IRQ 4
  216. #define OCELOT_SERIAL1_BASE 0xe0001020
  217. #define _OCELOT_SERIAL_INIT(int, base) \
  218. { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
  219. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  220. .io_type = SERIAL_IO_MEM }
  221. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  222. _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE)
  223. #else
  224. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS
  225. #endif
  226. #ifdef CONFIG_MOMENCO_OCELOT_G
  227. /* Ordinary NS16552 duart with a 20MHz crystal. */
  228. #define OCELOT_G_BASE_BAUD ( 20000000 / 16 )
  229. #define OCELOT_G_SERIAL1_IRQ 4
  230. #if 0
  231. #define OCELOT_G_SERIAL1_BASE 0xe0001020
  232. #else
  233. #define OCELOT_G_SERIAL1_BASE 0xfd000020
  234. #endif
  235. #define _OCELOT_G_SERIAL_INIT(int, base) \
  236. { .baud_base = OCELOT_G_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS,\
  237. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  238. .io_type = SERIAL_IO_MEM }
  239. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  240. _OCELOT_G_SERIAL_INIT(OCELOT_G_SERIAL1_IRQ, OCELOT_G_SERIAL1_BASE)
  241. #else
  242. #define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS
  243. #endif
  244. #ifdef CONFIG_MOMENCO_OCELOT_C
  245. /* Ordinary NS16552 duart with a 20MHz crystal. */
  246. #define OCELOT_C_BASE_BAUD ( 20000000 / 16 )
  247. #define OCELOT_C_SERIAL1_IRQ 80
  248. #define OCELOT_C_SERIAL1_BASE 0xfd000020
  249. #define OCELOT_C_SERIAL2_IRQ 81
  250. #define OCELOT_C_SERIAL2_BASE 0xfd000000
  251. #define _OCELOT_C_SERIAL_INIT(int, base) \
  252. { .baud_base = OCELOT_C_BASE_BAUD, \
  253. .irq = (int), \
  254. .flags = STD_COM_FLAGS, \
  255. .iomem_base = (u8 *) base, \
  256. .iomem_reg_shift = 2, \
  257. .io_type = SERIAL_IO_MEM \
  258. }
  259. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  260. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL1_IRQ, OCELOT_C_SERIAL1_BASE), \
  261. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL2_IRQ, OCELOT_C_SERIAL2_BASE)
  262. #else
  263. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS
  264. #endif
  265. #ifdef CONFIG_DDB5477
  266. #include <asm/ddb5xxx/ddb5477.h>
  267. #define DDB5477_SERIAL_PORT_DEFNS \
  268. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \
  269. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \
  270. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \
  271. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \
  272. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \
  273. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM},
  274. #else
  275. #define DDB5477_SERIAL_PORT_DEFNS
  276. #endif
  277. #ifdef CONFIG_SGI_IP32
  278. /*
  279. * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
  280. * They are initialized in ip32_setup
  281. */
  282. #define IP32_SERIAL_PORT_DEFNS \
  283. {},{},
  284. #else
  285. #define IP32_SERIAL_PORT_DEFNS
  286. #endif /* CONFIG_SGI_IP32 */
  287. #define SERIAL_PORT_DFNS \
  288. DDB5477_SERIAL_PORT_DEFNS \
  289. EV96100_SERIAL_PORT_DEFNS \
  290. IP32_SERIAL_PORT_DEFNS \
  291. ITE_SERIAL_PORT_DEFNS \
  292. IVR_SERIAL_PORT_DEFNS \
  293. JAZZ_SERIAL_PORT_DEFNS \
  294. STD_SERIAL_PORT_DEFNS \
  295. MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
  296. MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  297. MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  298. MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
  299. AU1000_SERIAL_PORT_DEFNS
  300. #endif /* _ASM_SERIAL_H */