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/device.h>
22 #include <linux/pm_qos.h>
24 #define DRIVER_NAME "omap_uart"
27 * Use tty device name as ttyO, [O -> OMAP]
28 * in bootargs we specify as console=ttyO0 if uart1
29 * is used as console uart.
31 #define OMAP_SERIAL_NAME "ttyO"
33 #define OMAP_MODE13X_SPEED 230400
35 #define OMAP_UART_SCR_TX_EMPTY 0x08
38 * Enable module level wakeup in WER reg
40 #define OMAP_UART_WER_MOD_WKUP 0X7F
42 /* Enable XON/XOFF flow control on output */
43 #define OMAP_UART_SW_TX 0x8
45 /* Enable XON/XOFF flow control on input */
46 #define OMAP_UART_SW_RX 0x2
48 #define OMAP_UART_SYSC_RESET 0X07
49 #define OMAP_UART_TCR_TRIG 0X0F
50 #define OMAP_UART_SW_CLR 0XF0
51 #define OMAP_UART_FIFO_CLR 0X06
53 #define OMAP_UART_DMA_CH_FREE -1
55 #define OMAP_MAX_HSUART_PORTS 4
57 #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
59 #define UART_ERRATA_i202_MDR1_ACCESS BIT(0)
60 #define UART_ERRATA_i291_DMA_FORCEIDLE BIT(1)
62 struct omap_uart_port_info
{
63 bool dma_enabled
; /* To specify DMA Mode */
64 unsigned int uartclk
; /* UART clock rate */
65 upf_t flags
; /* UPF_* flags */
66 unsigned int dma_rx_buf_size
;
67 unsigned int dma_rx_timeout
;
68 unsigned int autosuspend_timeout
;
69 unsigned int dma_rx_poll_rate
;
74 int (*get_context_loss_count
)(struct device
*);
75 void (*set_forceidle
)(struct device
*);
76 void (*set_noidle
)(struct device
*);
77 void (*enable_wakeup
)(struct device
*, bool);
80 struct uart_omap_dma
{
85 dma_addr_t rx_buf_dma_phys
;
86 dma_addr_t tx_buf_dma_phys
;
87 unsigned int uart_base
;
89 * Buffer for rx dma.It is not required for tx because the buffer
90 * comes from port structure.
92 unsigned char *rx_buf
;
93 unsigned int prev_rx_dma_pos
;
99 /* timer to poll activity on rx dma */
100 struct timer_list rx_timer
;
101 unsigned int rx_buf_size
;
102 unsigned int rx_poll_rate
;
103 unsigned int rx_timeout
;
106 #endif /* __OMAP_SERIAL_H__ */