omap-serial.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Driver for OMAP-UART controller.
  3. * Based on drivers/serial/8250.c
  4. *
  5. * Copyright (C) 2010 Texas Instruments.
  6. *
  7. * Authors:
  8. * Govindraj R <govindraj.raja@ti.com>
  9. * Thara Gopinath <thara@ti.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. */
  16. #ifndef __OMAP_SERIAL_H__
  17. #define __OMAP_SERIAL_H__
  18. #include <linux/serial_core.h>
  19. #include <linux/platform_device.h>
  20. #include <plat/control.h>
  21. #include <plat/mux.h>
  22. #define DRIVER_NAME "omap-hsuart"
  23. /*
  24. * Use tty device name as ttyO, [O -> OMAP]
  25. * in bootargs we specify as console=ttyO0 if uart1
  26. * is used as console uart.
  27. */
  28. #define OMAP_SERIAL_NAME "ttyO"
  29. #define OMAP_MDR1_DISABLE 0x07
  30. #define OMAP_MDR1_MODE13X 0x03
  31. #define OMAP_MDR1_MODE16X 0x00
  32. #define OMAP_MODE13X_SPEED 230400
  33. /*
  34. * LCR = 0XBF: Switch to Configuration Mode B.
  35. * In configuration mode b allow access
  36. * to EFR,DLL,DLH.
  37. * Reference OMAP TRM Chapter 17
  38. * Section: 1.4.3 Mode Selection
  39. */
  40. #define OMAP_UART_LCR_CONF_MDB 0XBF
  41. /* WER = 0x7F
  42. * Enable module level wakeup in WER reg
  43. */
  44. #define OMAP_UART_WER_MOD_WKUP 0X7F
  45. /* Enable XON/XOFF flow control on output */
  46. #define OMAP_UART_SW_TX 0x04
  47. /* Enable XON/XOFF flow control on input */
  48. #define OMAP_UART_SW_RX 0x04
  49. #define OMAP_UART_SYSC_RESET 0X07
  50. #define OMAP_UART_TCR_TRIG 0X0F
  51. #define OMAP_UART_SW_CLR 0XF0
  52. #define OMAP_UART_FIFO_CLR 0X06
  53. #define OMAP_UART_DMA_CH_FREE -1
  54. #define RX_TIMEOUT (3 * HZ)
  55. #define OMAP_MAX_HSUART_PORTS 4
  56. #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
  57. struct omap_uart_port_info {
  58. bool dma_enabled; /* To specify DMA Mode */
  59. unsigned int uartclk; /* UART clock rate */
  60. void __iomem *membase; /* ioremap cookie or NULL */
  61. resource_size_t mapbase; /* resource base */
  62. unsigned long irqflags; /* request_irq flags */
  63. upf_t flags; /* UPF_* flags */
  64. };
  65. struct uart_omap_dma {
  66. u8 uart_dma_tx;
  67. u8 uart_dma_rx;
  68. int rx_dma_channel;
  69. int tx_dma_channel;
  70. dma_addr_t rx_buf_dma_phys;
  71. dma_addr_t tx_buf_dma_phys;
  72. unsigned int uart_base;
  73. /*
  74. * Buffer for rx dma.It is not required for tx because the buffer
  75. * comes from port structure.
  76. */
  77. unsigned char *rx_buf;
  78. unsigned int prev_rx_dma_pos;
  79. int tx_buf_size;
  80. int tx_dma_used;
  81. int rx_dma_used;
  82. spinlock_t tx_lock;
  83. spinlock_t rx_lock;
  84. /* timer to poll activity on rx dma */
  85. struct timer_list rx_timer;
  86. int rx_buf_size;
  87. int rx_timeout;
  88. };
  89. struct uart_omap_port {
  90. struct uart_port port;
  91. struct uart_omap_dma uart_dma;
  92. struct platform_device *pdev;
  93. unsigned char ier;
  94. unsigned char lcr;
  95. unsigned char mcr;
  96. unsigned char fcr;
  97. unsigned char efr;
  98. int use_dma;
  99. /*
  100. * Some bits in registers are cleared on a read, so they must
  101. * be saved whenever the register is read but the bits will not
  102. * be immediately processed.
  103. */
  104. unsigned int lsr_break_flag;
  105. unsigned char msr_saved_flags;
  106. char name[20];
  107. unsigned long port_activity;
  108. };
  109. #endif /* __OMAP_SERIAL_H__ */