omap-serial.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_uart"
  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. /* WER = 0x7F
  30. * Enable module level wakeup in WER reg
  31. */
  32. #define OMAP_UART_WER_MOD_WKUP 0X7F
  33. /* Enable XON/XOFF flow control on output */
  34. #define OMAP_UART_SW_TX 0x04
  35. /* Enable XON/XOFF flow control on input */
  36. #define OMAP_UART_SW_RX 0x04
  37. #define OMAP_UART_SYSC_RESET 0X07
  38. #define OMAP_UART_TCR_TRIG 0X0F
  39. #define OMAP_UART_SW_CLR 0XF0
  40. #define OMAP_UART_FIFO_CLR 0X06
  41. #define OMAP_UART_DMA_CH_FREE -1
  42. #define RX_TIMEOUT (3 * HZ)
  43. #define OMAP_MAX_HSUART_PORTS 4
  44. #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
  45. struct omap_uart_port_info {
  46. bool dma_enabled; /* To specify DMA Mode */
  47. unsigned int uartclk; /* UART clock rate */
  48. void __iomem *membase; /* ioremap cookie or NULL */
  49. resource_size_t mapbase; /* resource base */
  50. unsigned long irqflags; /* request_irq flags */
  51. upf_t flags; /* UPF_* flags */
  52. };
  53. struct uart_omap_dma {
  54. u8 uart_dma_tx;
  55. u8 uart_dma_rx;
  56. int rx_dma_channel;
  57. int tx_dma_channel;
  58. dma_addr_t rx_buf_dma_phys;
  59. dma_addr_t tx_buf_dma_phys;
  60. unsigned int uart_base;
  61. /*
  62. * Buffer for rx dma.It is not required for tx because the buffer
  63. * comes from port structure.
  64. */
  65. unsigned char *rx_buf;
  66. unsigned int prev_rx_dma_pos;
  67. int tx_buf_size;
  68. int tx_dma_used;
  69. int rx_dma_used;
  70. spinlock_t tx_lock;
  71. spinlock_t rx_lock;
  72. /* timer to poll activity on rx dma */
  73. struct timer_list rx_timer;
  74. int rx_buf_size;
  75. int rx_timeout;
  76. };
  77. struct uart_omap_port {
  78. struct uart_port port;
  79. struct uart_omap_dma uart_dma;
  80. struct platform_device *pdev;
  81. unsigned char ier;
  82. unsigned char lcr;
  83. unsigned char mcr;
  84. unsigned char fcr;
  85. unsigned char efr;
  86. int use_dma;
  87. /*
  88. * Some bits in registers are cleared on a read, so they must
  89. * be saved whenever the register is read but the bits will not
  90. * be immediately processed.
  91. */
  92. unsigned int lsr_break_flag;
  93. unsigned char msr_saved_flags;
  94. char name[20];
  95. unsigned long port_activity;
  96. };
  97. #endif /* __OMAP_SERIAL_H__ */