omap-serial.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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/mux.h>
  21. #define DRIVER_NAME "omap-hsuart"
  22. /*
  23. * Use tty device name as ttyO, [O -> OMAP]
  24. * in bootargs we specify as console=ttyO0 if uart1
  25. * is used as console uart.
  26. */
  27. #define OMAP_SERIAL_NAME "ttyO"
  28. #define OMAP_MODE13X_SPEED 230400
  29. /*
  30. * LCR = 0XBF: Switch to Configuration Mode B.
  31. * In configuration mode b allow access
  32. * to EFR,DLL,DLH.
  33. * Reference OMAP TRM Chapter 17
  34. * Section: 1.4.3 Mode Selection
  35. */
  36. #define OMAP_UART_LCR_CONF_MDB 0XBF
  37. /* WER = 0x7F
  38. * Enable module level wakeup in WER reg
  39. */
  40. #define OMAP_UART_WER_MOD_WKUP 0X7F
  41. /* Enable XON/XOFF flow control on output */
  42. #define OMAP_UART_SW_TX 0x04
  43. /* Enable XON/XOFF flow control on input */
  44. #define OMAP_UART_SW_RX 0x04
  45. #define OMAP_UART_SYSC_RESET 0X07
  46. #define OMAP_UART_TCR_TRIG 0X0F
  47. #define OMAP_UART_SW_CLR 0XF0
  48. #define OMAP_UART_FIFO_CLR 0X06
  49. #define OMAP_UART_DMA_CH_FREE -1
  50. #define RX_TIMEOUT (3 * HZ)
  51. #define OMAP_MAX_HSUART_PORTS 4
  52. #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
  53. struct omap_uart_port_info {
  54. bool dma_enabled; /* To specify DMA Mode */
  55. unsigned int uartclk; /* UART clock rate */
  56. void __iomem *membase; /* ioremap cookie or NULL */
  57. resource_size_t mapbase; /* resource base */
  58. unsigned long irqflags; /* request_irq flags */
  59. upf_t flags; /* UPF_* flags */
  60. };
  61. struct uart_omap_dma {
  62. u8 uart_dma_tx;
  63. u8 uart_dma_rx;
  64. int rx_dma_channel;
  65. int tx_dma_channel;
  66. dma_addr_t rx_buf_dma_phys;
  67. dma_addr_t tx_buf_dma_phys;
  68. unsigned int uart_base;
  69. /*
  70. * Buffer for rx dma.It is not required for tx because the buffer
  71. * comes from port structure.
  72. */
  73. unsigned char *rx_buf;
  74. unsigned int prev_rx_dma_pos;
  75. int tx_buf_size;
  76. int tx_dma_used;
  77. int rx_dma_used;
  78. spinlock_t tx_lock;
  79. spinlock_t rx_lock;
  80. /* timer to poll activity on rx dma */
  81. struct timer_list rx_timer;
  82. int rx_buf_size;
  83. int rx_timeout;
  84. };
  85. struct uart_omap_port {
  86. struct uart_port port;
  87. struct uart_omap_dma uart_dma;
  88. struct platform_device *pdev;
  89. unsigned char ier;
  90. unsigned char lcr;
  91. unsigned char mcr;
  92. unsigned char fcr;
  93. unsigned char efr;
  94. int use_dma;
  95. /*
  96. * Some bits in registers are cleared on a read, so they must
  97. * be saved whenever the register is read but the bits will not
  98. * be immediately processed.
  99. */
  100. unsigned int lsr_break_flag;
  101. unsigned char msr_saved_flags;
  102. char name[20];
  103. unsigned long port_activity;
  104. };
  105. #endif /* __OMAP_SERIAL_H__ */