8250.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Driver for 8250/16550-type serial ports
  3. *
  4. * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
  5. *
  6. * Copyright (C) 2001 Russell King.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #include <linux/serial_8250.h>
  14. struct uart_8250_port {
  15. struct uart_port port;
  16. struct timer_list timer; /* "no irq" timer */
  17. struct list_head list; /* ports on this IRQ */
  18. unsigned short capabilities; /* port capabilities */
  19. unsigned short bugs; /* port bugs */
  20. unsigned int tx_loadsz; /* transmit fifo load size */
  21. unsigned char acr;
  22. unsigned char ier;
  23. unsigned char lcr;
  24. unsigned char mcr;
  25. unsigned char mcr_mask; /* mask of user bits */
  26. unsigned char mcr_force; /* mask of forced bits */
  27. unsigned char cur_iotype; /* Running I/O type */
  28. /*
  29. * Some bits in registers are cleared on a read, so they must
  30. * be saved whenever the register is read but the bits will not
  31. * be immediately processed.
  32. */
  33. #define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
  34. unsigned char lsr_saved_flags;
  35. #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
  36. unsigned char msr_saved_flags;
  37. };
  38. struct old_serial_port {
  39. unsigned int uart;
  40. unsigned int baud_base;
  41. unsigned int port;
  42. unsigned int irq;
  43. unsigned int flags;
  44. unsigned char hub6;
  45. unsigned char io_type;
  46. unsigned char *iomem_base;
  47. unsigned short iomem_reg_shift;
  48. unsigned long irqflags;
  49. };
  50. /*
  51. * This replaces serial_uart_config in include/linux/serial.h
  52. */
  53. struct serial8250_config {
  54. const char *name;
  55. unsigned short fifo_size;
  56. unsigned short tx_loadsz;
  57. unsigned char fcr;
  58. unsigned int flags;
  59. };
  60. #define UART_CAP_FIFO (1 << 8) /* UART has FIFO */
  61. #define UART_CAP_EFR (1 << 9) /* UART has EFR */
  62. #define UART_CAP_SLEEP (1 << 10) /* UART has IER sleep */
  63. #define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */
  64. #define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */
  65. #define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */
  66. #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
  67. #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
  68. #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */
  69. #define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */
  70. #define PROBE_RSA (1 << 0)
  71. #define PROBE_ANY (~0)
  72. #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
  73. #ifdef CONFIG_SERIAL_8250_SHARE_IRQ
  74. #define SERIAL8250_SHARE_IRQS 1
  75. #else
  76. #define SERIAL8250_SHARE_IRQS 0
  77. #endif
  78. #if defined(__alpha__) && !defined(CONFIG_PCI)
  79. /*
  80. * Digital did something really horribly wrong with the OUT1 and OUT2
  81. * lines on at least some ALPHA's. The failure mode is that if either
  82. * is cleared, the machine locks up with endless interrupts.
  83. */
  84. #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1)
  85. #elif defined(CONFIG_SBC8560)
  86. /*
  87. * WindRiver did something similarly broken on their SBC8560 board. The
  88. * UART tristates its IRQ output while OUT2 is clear, but they pulled
  89. * the interrupt line _up_ instead of down, so if we register the IRQ
  90. * while the UART is in that state, we die in an IRQ storm. */
  91. #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2)
  92. #else
  93. #define ALPHA_KLUDGE_MCR 0
  94. #endif