serial_sci.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #ifndef __LINUX_SERIAL_SCI_H
  2. #define __LINUX_SERIAL_SCI_H
  3. #include <linux/serial_core.h>
  4. #include <linux/sh_dma.h>
  5. /*
  6. * Generic header for SuperH (H)SCI(F) (used by sh/sh64 and related parts)
  7. */
  8. #define SCIx_NOT_SUPPORTED (-1)
  9. /* SCSMR (Serial Mode Register) */
  10. #define SCSMR_CHR (1 << 6) /* 7-bit Character Length */
  11. #define SCSMR_PE (1 << 5) /* Parity Enable */
  12. #define SCSMR_ODD (1 << 4) /* Odd Parity */
  13. #define SCSMR_STOP (1 << 3) /* Stop Bit Length */
  14. #define SCSMR_CKS 0x0003 /* Clock Select */
  15. /* Serial Control Register (@ = not supported by all parts) */
  16. #define SCSCR_TIE (1 << 7) /* Transmit Interrupt Enable */
  17. #define SCSCR_RIE (1 << 6) /* Receive Interrupt Enable */
  18. #define SCSCR_TE (1 << 5) /* Transmit Enable */
  19. #define SCSCR_RE (1 << 4) /* Receive Enable */
  20. #define SCSCR_REIE (1 << 3) /* Receive Error Interrupt Enable @ */
  21. #define SCSCR_TOIE (1 << 2) /* Timeout Interrupt Enable @ */
  22. #define SCSCR_CKE1 (1 << 1) /* Clock Enable 1 */
  23. #define SCSCR_CKE0 (1 << 0) /* Clock Enable 0 */
  24. /* SCIFA/SCIFB only */
  25. #define SCSCR_TDRQE (1 << 15) /* Tx Data Transfer Request Enable */
  26. #define SCSCR_RDRQE (1 << 14) /* Rx Data Transfer Request Enable */
  27. /* SCxSR (Serial Status Register) on SCI */
  28. #define SCI_TDRE 0x80 /* Transmit Data Register Empty */
  29. #define SCI_RDRF 0x40 /* Receive Data Register Full */
  30. #define SCI_ORER 0x20 /* Overrun Error */
  31. #define SCI_FER 0x10 /* Framing Error */
  32. #define SCI_PER 0x08 /* Parity Error */
  33. #define SCI_TEND 0x04 /* Transmit End */
  34. #define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
  35. /* SCxSR (Serial Status Register) on SCIF, HSCIF */
  36. #define SCIF_ER 0x0080 /* Receive Error */
  37. #define SCIF_TEND 0x0040 /* Transmission End */
  38. #define SCIF_TDFE 0x0020 /* Transmit FIFO Data Empty */
  39. #define SCIF_BRK 0x0010 /* Break Detect */
  40. #define SCIF_FER 0x0008 /* Framing Error */
  41. #define SCIF_PER 0x0004 /* Parity Error */
  42. #define SCIF_RDF 0x0002 /* Receive FIFO Data Full */
  43. #define SCIF_DR 0x0001 /* Receive Data Ready */
  44. #define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
  45. /* SCFCR (FIFO Control Register) */
  46. #define SCFCR_LOOP (1 << 0) /* Loopback Test */
  47. /* SCSPTR (Serial Port Register), optional */
  48. #define SCSPTR_RTSIO (1 << 7) /* Serial Port RTS Pin Input/Output */
  49. #define SCSPTR_CTSIO (1 << 5) /* Serial Port CTS Pin Input/Output */
  50. #define SCSPTR_SPB2IO (1 << 1) /* Serial Port Break Input/Output */
  51. #define SCSPTR_SPB2DT (1 << 0) /* Serial Port Break Data */
  52. /* HSSRR HSCIF */
  53. #define HSCIF_SRE 0x8000 /* Sampling Rate Register Enable */
  54. enum {
  55. SCIx_PROBE_REGTYPE,
  56. SCIx_SCI_REGTYPE,
  57. SCIx_IRDA_REGTYPE,
  58. SCIx_SCIFA_REGTYPE,
  59. SCIx_SCIFB_REGTYPE,
  60. SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  61. SCIx_SH3_SCIF_REGTYPE,
  62. SCIx_SH4_SCIF_REGTYPE,
  63. SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
  64. SCIx_SH4_SCIF_FIFODATA_REGTYPE,
  65. SCIx_SH7705_SCIF_REGTYPE,
  66. SCIx_HSCIF_REGTYPE,
  67. SCIx_NR_REGTYPES,
  68. };
  69. /*
  70. * SCI register subset common for all port types.
  71. * Not all registers will exist on all parts.
  72. */
  73. enum {
  74. SCSMR, /* Serial Mode Register */
  75. SCBRR, /* Bit Rate Register */
  76. SCSCR, /* Serial Control Register */
  77. SCxSR, /* Serial Status Register */
  78. SCFCR, /* FIFO Control Register */
  79. SCFDR, /* FIFO Data Count Register */
  80. SCxTDR, /* Transmit (FIFO) Data Register */
  81. SCxRDR, /* Receive (FIFO) Data Register */
  82. SCLSR, /* Line Status Register */
  83. SCTFDR, /* Transmit FIFO Data Count Register */
  84. SCRFDR, /* Receive FIFO Data Count Register */
  85. SCSPTR, /* Serial Port Register */
  86. HSSRR, /* Sampling Rate Register */
  87. SCIx_NR_REGS,
  88. };
  89. struct device;
  90. struct plat_sci_port_ops {
  91. void (*init_pins)(struct uart_port *, unsigned int cflag);
  92. };
  93. /*
  94. * Port-specific capabilities
  95. */
  96. #define SCIx_HAVE_RTSCTS (1 << 0)
  97. /*
  98. * Platform device specific platform_data struct
  99. */
  100. struct plat_sci_port {
  101. unsigned int type; /* SCI / SCIF / IRDA / HSCIF */
  102. upf_t flags; /* UPF_* flags */
  103. unsigned long capabilities; /* Port features/capabilities */
  104. unsigned int sampling_rate;
  105. unsigned int scscr; /* SCSCR initialization */
  106. /*
  107. * Platform overrides if necessary, defaults otherwise.
  108. */
  109. int port_reg;
  110. unsigned char regshift;
  111. unsigned char regtype;
  112. struct plat_sci_port_ops *ops;
  113. unsigned int dma_slave_tx;
  114. unsigned int dma_slave_rx;
  115. };
  116. #endif /* __LINUX_SERIAL_SCI_H */