serial.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
  48. #define STD_SERIAL_PORT_DEFNS \
  49. /* UART CLK PORT IRQ FLAGS */ \
  50. { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
  51. { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
  52. { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
  53. { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
  54. #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  55. #define STD_SERIAL_PORT_DEFNS
  56. #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  57. #ifdef CONFIG_MOMENCO_OCELOT_3
  58. #define OCELOT_3_BASE_BAUD ( 20000000 / 16 )
  59. #define OCELOT_3_SERIAL_IRQ 6
  60. #define OCELOT_3_SERIAL_BASE (signed)0xfd000020
  61. #define _OCELOT_3_SERIAL_INIT(int, base) \
  62. { .baud_base = OCELOT_3_BASE_BAUD, irq: int, \
  63. .flags = STD_COM_FLAGS, \
  64. .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
  65. io_type: SERIAL_IO_MEM }
  66. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
  67. _OCELOT_3_SERIAL_INIT(OCELOT_3_SERIAL_IRQ, OCELOT_3_SERIAL_BASE)
  68. #else
  69. #define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  70. #endif
  71. #ifdef CONFIG_MOMENCO_OCELOT
  72. /* Ordinary NS16552 duart with a 20MHz crystal. */
  73. #define OCELOT_BASE_BAUD ( 20000000 / 16 )
  74. #define OCELOT_SERIAL1_IRQ 4
  75. #define OCELOT_SERIAL1_BASE 0xe0001020
  76. #define _OCELOT_SERIAL_INIT(int, base) \
  77. { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
  78. .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
  79. .io_type = SERIAL_IO_MEM }
  80. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  81. _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE)
  82. #else
  83. #define MOMENCO_OCELOT_SERIAL_PORT_DEFNS
  84. #endif
  85. #ifdef CONFIG_MOMENCO_OCELOT_C
  86. /* Ordinary NS16552 duart with a 20MHz crystal. */
  87. #define OCELOT_C_BASE_BAUD ( 20000000 / 16 )
  88. #define OCELOT_C_SERIAL1_IRQ 80
  89. #define OCELOT_C_SERIAL1_BASE 0xfd000020
  90. #define OCELOT_C_SERIAL2_IRQ 81
  91. #define OCELOT_C_SERIAL2_BASE 0xfd000000
  92. #define _OCELOT_C_SERIAL_INIT(int, base) \
  93. { .baud_base = OCELOT_C_BASE_BAUD, \
  94. .irq = (int), \
  95. .flags = STD_COM_FLAGS, \
  96. .iomem_base = (u8 *) base, \
  97. .iomem_reg_shift = 2, \
  98. .io_type = SERIAL_IO_MEM \
  99. }
  100. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  101. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL1_IRQ, OCELOT_C_SERIAL1_BASE), \
  102. _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL2_IRQ, OCELOT_C_SERIAL2_BASE)
  103. #else
  104. #define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS
  105. #endif
  106. #ifdef CONFIG_DDB5477
  107. #include <asm/ddb5xxx/ddb5477.h>
  108. #define DDB5477_SERIAL_PORT_DEFNS \
  109. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \
  110. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \
  111. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \
  112. { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \
  113. .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \
  114. .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM},
  115. #else
  116. #define DDB5477_SERIAL_PORT_DEFNS
  117. #endif
  118. #ifdef CONFIG_SGI_IP32
  119. /*
  120. * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
  121. * They are initialized in ip32_setup
  122. */
  123. #define IP32_SERIAL_PORT_DEFNS \
  124. {},{},
  125. #else
  126. #define IP32_SERIAL_PORT_DEFNS
  127. #endif /* CONFIG_SGI_IP32 */
  128. #define SERIAL_PORT_DFNS \
  129. DDB5477_SERIAL_PORT_DEFNS \
  130. IP32_SERIAL_PORT_DEFNS \
  131. JAZZ_SERIAL_PORT_DEFNS \
  132. STD_SERIAL_PORT_DEFNS \
  133. MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
  134. MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
  135. MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
  136. #endif /* _ASM_SERIAL_H */