serial.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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_OCELOT_3
  75. #define OCELOT_3_BASE_BAUD ( 20000000 / 16 )
  76. #define OCELOT_3_SERIAL_IRQ 6
  77. #define OCELOT_3_SERIAL_BASE (signed)0xfd000020
  78. #define _OCELOT_3_SERIAL_INIT(int, base) \
  79. { .baud_base = OCELOT_3_BASE_BAUD, irq: int, \
  80. .flags = STD_COM_FLAGS, \
  81. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  82. io_type: SERIAL_IO_MEM }
  83. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
  84. _OCELOT_3_SERIAL_INIT(OCELOT_3_SERIAL_IRQ, OCELOT_3_SERIAL_BASE)
  85. #else
  86. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  87. #endif
  88. #ifdef CONFIG_MOMENCO_OCELOT
  89. /* Ordinary NS16552 duart with a 20MHz crystal. */
  90. #define OCELOT_BASE_BAUD ( 20000000 / 16 )
  91. #define OCELOT_SERIAL1_IRQ 4
  92. #define OCELOT_SERIAL1_BASE 0xe0001020
  93. #define _OCELOT_SERIAL_INIT(int, base) \
  94. { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
  95. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  96. .io_type = SERIAL_IO_MEM }
  97. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  98. _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE)
  99. #else
  100. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS
  101. #endif
  102. #ifdef CONFIG_MOMENCO_OCELOT_C
  103. /* Ordinary NS16552 duart with a 20MHz crystal. */
  104. #define OCELOT_C_BASE_BAUD ( 20000000 / 16 )
  105. #define OCELOT_C_SERIAL1_IRQ 80
  106. #define OCELOT_C_SERIAL1_BASE 0xfd000020
  107. #define OCELOT_C_SERIAL2_IRQ 81
  108. #define OCELOT_C_SERIAL2_BASE 0xfd000000
  109. #define _OCELOT_C_SERIAL_INIT(int, base) \
  110. { .baud_base = OCELOT_C_BASE_BAUD, \
  111. .irq = (int), \
  112. .flags = STD_COM_FLAGS, \
  113. .iomem_base = (u8 *) base, \
  114. .iomem_reg_shift = 2, \
  115. .io_type = SERIAL_IO_MEM \
  116. }
  117. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  118. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL1_IRQ, OCELOT_C_SERIAL1_BASE), \
  119. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL2_IRQ, OCELOT_C_SERIAL2_BASE)
  120. #else
  121. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS
  122. #endif
  123. #ifdef CONFIG_DDB5477
  124. #include <asm/ddb5xxx/ddb5477.h>
  125. #define DDB5477_SERIAL_PORT_DEFNS \
  126. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \
  127. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \
  128. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \
  129. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \
  130. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \
  131. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM},
  132. #else
  133. #define DDB5477_SERIAL_PORT_DEFNS
  134. #endif
  135. #ifdef CONFIG_SGI_IP32
  136. /*
  137. * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
  138. * They are initialized in ip32_setup
  139. */
  140. #define IP32_SERIAL_PORT_DEFNS \
  141. {},{},
  142. #else
  143. #define IP32_SERIAL_PORT_DEFNS
  144. #endif /* CONFIG_SGI_IP32 */
  145. #define SERIAL_PORT_DFNS \
  146. DDB5477_SERIAL_PORT_DEFNS \
  147. EV64120_SERIAL_PORT_DEFNS \
  148. IP32_SERIAL_PORT_DEFNS \
  149. JAZZ_SERIAL_PORT_DEFNS \
  150. STD_SERIAL_PORT_DEFNS \
  151. MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  152. MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  153. MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  154. #endif /* _ASM_SERIAL_H */