2 * Driver for OMAP-UART controller.
3 * Based on drivers/serial/8250.c
5 * Copyright (C) 2010 Texas Instruments.
8 * Govindraj R <govindraj.raja@ti.com>
9 * Thara Gopinath <thara@ti.com>
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.
17 #ifndef __OMAP_SERIAL_H__
18 #define __OMAP_SERIAL_H__
20 #include <linux/serial_core.h>
21 #include <linux/platform_device.h>
22 #include <linux/pm_qos.h>
26 #define DRIVER_NAME "omap_uart"
29 * Use tty device name as ttyO, [O -> OMAP]
30 * in bootargs we specify as console=ttyO0 if uart1
31 * is used as console uart.
33 #define OMAP_SERIAL_NAME "ttyO"
35 #define OMAP_MODE13X_SPEED 230400
37 #define OMAP_UART_SCR_TX_EMPTY 0x08
40 * Enable module level wakeup in WER reg
42 #define OMAP_UART_WER_MOD_WKUP 0X7F
44 /* Enable XON/XOFF flow control on output */
45 #define OMAP_UART_SW_TX 0x04
47 /* Enable XON/XOFF flow control on input */
48 #define OMAP_UART_SW_RX 0x04
50 #define OMAP_UART_SYSC_RESET 0X07
51 #define OMAP_UART_TCR_TRIG 0X0F
52 #define OMAP_UART_SW_CLR 0XF0
53 #define OMAP_UART_FIFO_CLR 0X06
55 #define OMAP_UART_DMA_CH_FREE -1
57 #define OMAP_MAX_HSUART_PORTS 4
59 #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
61 #define UART_ERRATA_i202_MDR1_ACCESS BIT(0)
62 #define UART_ERRATA_i291_DMA_FORCEIDLE BIT(1)
64 struct omap_uart_port_info {
65 bool dma_enabled; /* To specify DMA Mode */
66 unsigned int uartclk; /* UART clock rate */
67 upf_t flags; /* UPF_* flags */
68 unsigned int dma_rx_buf_size;
69 unsigned int dma_rx_timeout;
70 unsigned int autosuspend_timeout;
71 unsigned int dma_rx_poll_rate;
76 int (*get_context_loss_count)(struct device *);
77 void (*set_forceidle)(struct platform_device *);
78 void (*set_noidle)(struct platform_device *);
79 void (*enable_wakeup)(struct platform_device *, bool);
82 struct uart_omap_dma {
87 dma_addr_t rx_buf_dma_phys;
88 dma_addr_t tx_buf_dma_phys;
89 unsigned int uart_base;
91 * Buffer for rx dma.It is not required for tx because the buffer
92 * comes from port structure.
94 unsigned char *rx_buf;
95 unsigned int prev_rx_dma_pos;
101 /* timer to poll activity on rx dma */
102 struct timer_list rx_timer;
103 unsigned int rx_buf_size;
104 unsigned int rx_poll_rate;
105 unsigned int rx_timeout;
108 struct uart_omap_port {
109 struct uart_port port;
110 struct uart_omap_dma uart_dma;
111 struct platform_device *pdev;
125 * Some bits in registers are cleared on a read, so they must
126 * be saved whenever the register is read but the bits will not
127 * be immediately processed.
129 unsigned int lsr_break_flag;
130 unsigned char msr_saved_flags;
132 unsigned long port_activity;
133 u32 context_loss_cnt;
141 struct pm_qos_request pm_qos_request;
144 struct work_struct qos_work;
147 #endif /* __OMAP_SERIAL_H__ */