serial_sci.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 SCI(F) (used by sh/sh64/h8300 and related parts)
  7. */
  8. #define SCIx_NOT_SUPPORTED (-1)
  9. enum {
  10. SCBRR_ALGO_1, /* ((clk + 16 * bps) / (16 * bps) - 1) */
  11. SCBRR_ALGO_2, /* ((clk + 16 * bps) / (32 * bps) - 1) */
  12. SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
  13. SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
  14. SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */
  15. };
  16. #define SCSCR_TIE (1 << 7)
  17. #define SCSCR_RIE (1 << 6)
  18. #define SCSCR_TE (1 << 5)
  19. #define SCSCR_RE (1 << 4)
  20. #define SCSCR_REIE (1 << 3) /* not supported by all parts */
  21. #define SCSCR_TOIE (1 << 2) /* not supported by all parts */
  22. #define SCSCR_CKE1 (1 << 1)
  23. #define SCSCR_CKE0 (1 << 0)
  24. /* SCxSR SCI */
  25. #define SCI_TDRE 0x80
  26. #define SCI_RDRF 0x40
  27. #define SCI_ORER 0x20
  28. #define SCI_FER 0x10
  29. #define SCI_PER 0x08
  30. #define SCI_TEND 0x04
  31. #define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
  32. /* SCxSR SCIF */
  33. #define SCIF_ER 0x0080
  34. #define SCIF_TEND 0x0040
  35. #define SCIF_TDFE 0x0020
  36. #define SCIF_BRK 0x0010
  37. #define SCIF_FER 0x0008
  38. #define SCIF_PER 0x0004
  39. #define SCIF_RDF 0x0002
  40. #define SCIF_DR 0x0001
  41. #define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
  42. /* Offsets into the sci_port->irqs array */
  43. enum {
  44. SCIx_ERI_IRQ,
  45. SCIx_RXI_IRQ,
  46. SCIx_TXI_IRQ,
  47. SCIx_BRI_IRQ,
  48. SCIx_NR_IRQS,
  49. };
  50. #define SCIx_IRQ_MUXED(irq) \
  51. { \
  52. [SCIx_ERI_IRQ] = (irq), \
  53. [SCIx_RXI_IRQ] = (irq), \
  54. [SCIx_TXI_IRQ] = (irq), \
  55. [SCIx_BRI_IRQ] = (irq), \
  56. }
  57. struct device;
  58. /*
  59. * Platform device specific platform_data struct
  60. */
  61. struct plat_sci_port {
  62. unsigned long mapbase; /* resource base */
  63. unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
  64. unsigned int type; /* SCI / SCIF / IRDA */
  65. upf_t flags; /* UPF_* flags */
  66. unsigned int scbrr_algo_id; /* SCBRR calculation algo */
  67. unsigned int scscr; /* SCSCR initialization */
  68. /*
  69. * Platform overrides if necessary, defaults otherwise.
  70. */
  71. int overrun_bit;
  72. unsigned int error_mask;
  73. int port_reg;
  74. struct device *dma_dev;
  75. unsigned int dma_slave_tx;
  76. unsigned int dma_slave_rx;
  77. };
  78. #endif /* __LINUX_SERIAL_SCI_H */