omap-serial.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/device.h>
  20. #include <linux/pm_qos.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. #define OMAP_UART_SCR_TX_EMPTY 0x08
  30. /* WER = 0x7F
  31. * Enable module level wakeup in WER reg
  32. */
  33. #define OMAP_UART_WER_MOD_WKUP 0X7F
  34. /* Enable XON/XOFF flow control on output */
  35. #define OMAP_UART_SW_TX 0x8
  36. /* Enable XON/XOFF flow control on input */
  37. #define OMAP_UART_SW_RX 0x2
  38. #define OMAP_UART_SYSC_RESET 0X07
  39. #define OMAP_UART_TCR_TRIG 0X0F
  40. #define OMAP_UART_SW_CLR 0XF0
  41. #define OMAP_UART_FIFO_CLR 0X06
  42. #define OMAP_UART_DMA_CH_FREE -1
  43. #define OMAP_MAX_HSUART_PORTS 6
  44. #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
  45. #define UART_ERRATA_i202_MDR1_ACCESS BIT(0)
  46. #define UART_ERRATA_i291_DMA_FORCEIDLE BIT(1)
  47. struct omap_uart_port_info {
  48. bool dma_enabled; /* To specify DMA Mode */
  49. unsigned int uartclk; /* UART clock rate */
  50. upf_t flags; /* UPF_* flags */
  51. unsigned int dma_rx_buf_size;
  52. unsigned int dma_rx_timeout;
  53. unsigned int autosuspend_timeout;
  54. unsigned int dma_rx_poll_rate;
  55. int DTR_gpio;
  56. int DTR_inverted;
  57. int DTR_present;
  58. int (*get_context_loss_count)(struct device *);
  59. void (*set_forceidle)(struct device *);
  60. void (*set_noidle)(struct device *);
  61. void (*enable_wakeup)(struct device *, bool);
  62. };
  63. struct uart_omap_dma {
  64. u8 uart_dma_tx;
  65. u8 uart_dma_rx;
  66. int rx_dma_channel;
  67. int tx_dma_channel;
  68. dma_addr_t rx_buf_dma_phys;
  69. dma_addr_t tx_buf_dma_phys;
  70. unsigned int uart_base;
  71. /*
  72. * Buffer for rx dma.It is not required for tx because the buffer
  73. * comes from port structure.
  74. */
  75. unsigned char *rx_buf;
  76. unsigned int prev_rx_dma_pos;
  77. int tx_buf_size;
  78. int tx_dma_used;
  79. int rx_dma_used;
  80. spinlock_t tx_lock;
  81. spinlock_t rx_lock;
  82. /* timer to poll activity on rx dma */
  83. struct timer_list rx_timer;
  84. unsigned int rx_buf_size;
  85. unsigned int rx_poll_rate;
  86. unsigned int rx_timeout;
  87. };
  88. #endif /* __OMAP_SERIAL_H__ */