xref: /rk3399_ARM-atf/include/drivers/ti/uart/uart_16550.h (revision 861ac52a7e80c0399b6e543e7125a9c1e18a63f8)
1c13b2e32SVarun Wadekar /*
2c13b2e32SVarun Wadekar  * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3c13b2e32SVarun Wadekar  *
4c13b2e32SVarun Wadekar  * Redistribution and use in source and binary forms, with or without
5c13b2e32SVarun Wadekar  * modification, are permitted provided that the following conditions are met:
6c13b2e32SVarun Wadekar  *
7c13b2e32SVarun Wadekar  * Redistributions of source code must retain the above copyright notice, this
8c13b2e32SVarun Wadekar  * list of conditions and the following disclaimer.
9c13b2e32SVarun Wadekar  *
10c13b2e32SVarun Wadekar  * Redistributions in binary form must reproduce the above copyright notice,
11c13b2e32SVarun Wadekar  * this list of conditions and the following disclaimer in the documentation
12c13b2e32SVarun Wadekar  * and/or other materials provided with the distribution.
13c13b2e32SVarun Wadekar  *
14c13b2e32SVarun Wadekar  * Neither the name of ARM nor the names of its contributors may be used
15c13b2e32SVarun Wadekar  * to endorse or promote products derived from this software without specific
16c13b2e32SVarun Wadekar  * prior written permission.
17c13b2e32SVarun Wadekar  *
18c13b2e32SVarun Wadekar  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19c13b2e32SVarun Wadekar  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20c13b2e32SVarun Wadekar  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21c13b2e32SVarun Wadekar  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22c13b2e32SVarun Wadekar  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23c13b2e32SVarun Wadekar  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24c13b2e32SVarun Wadekar  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25c13b2e32SVarun Wadekar  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26c13b2e32SVarun Wadekar  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27c13b2e32SVarun Wadekar  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28c13b2e32SVarun Wadekar  * POSSIBILITY OF SUCH DAMAGE.
29c13b2e32SVarun Wadekar  */
30c13b2e32SVarun Wadekar 
31c13b2e32SVarun Wadekar #ifndef __UART_16550_H__
32c13b2e32SVarun Wadekar #define __UART_16550_H__
33c13b2e32SVarun Wadekar 
34c13b2e32SVarun Wadekar /* UART16550 Registers */
35c13b2e32SVarun Wadekar #define UARTTX			0x0
36c13b2e32SVarun Wadekar #define UARTRX			0x0
37c13b2e32SVarun Wadekar #define UARTDLL			0x0
38c13b2e32SVarun Wadekar #define UARTIER			0x4
39c13b2e32SVarun Wadekar #define UARTDLLM		0x4
40c13b2e32SVarun Wadekar #define UARTIIR			0x8
41c13b2e32SVarun Wadekar #define UARTFCR			0x8
42c13b2e32SVarun Wadekar #define UARTLCR			0xc
43c13b2e32SVarun Wadekar #define UARTMCR			0x10
44c13b2e32SVarun Wadekar #define UARTLSR			0x14
45c13b2e32SVarun Wadekar #define UARTMSR			0x18
46c13b2e32SVarun Wadekar #define UARTSPR			0x1c
47c13b2e32SVarun Wadekar #define UARTCSR			0x20
48c13b2e32SVarun Wadekar #define UARTRXFIFOCFG		0x24
49c13b2e32SVarun Wadekar #define UARTMIE			0x28
50c13b2e32SVarun Wadekar #define UARTVNDR		0x2c
51c13b2e32SVarun Wadekar #define UARTASR			0x3c
52c13b2e32SVarun Wadekar 
53c13b2e32SVarun Wadekar /* FIFO Control Register bits */
54c13b2e32SVarun Wadekar #define UARTFCR_FIFOMD_16450	(0 << 6)
55c13b2e32SVarun Wadekar #define UARTFCR_FIFOMD_16550	(1 << 6)
56c13b2e32SVarun Wadekar #define UARTFCR_RXTRIG_1	(0 << 6)
57c13b2e32SVarun Wadekar #define UARTFCR_RXTRIG_4	(1 << 6)
58c13b2e32SVarun Wadekar #define UARTFCR_RXTRIG_8	(2 << 6)
59c13b2e32SVarun Wadekar #define UARTFCR_RXTRIG_16	(3 << 6)
60c13b2e32SVarun Wadekar #define UARTFCR_TXTRIG_1	(0 << 4)
61c13b2e32SVarun Wadekar #define UARTFCR_TXTRIG_4	(1 << 4)
62c13b2e32SVarun Wadekar #define UARTFCR_TXTRIG_8	(2 << 4)
63c13b2e32SVarun Wadekar #define UARTFCR_TXTRIG_16	(3 << 4)
64c13b2e32SVarun Wadekar #define UARTFCR_DMAEN		(1 << 3)	/* Enable DMA mode */
65c13b2e32SVarun Wadekar #define UARTFCR_TXCLR		(1 << 2)	/* Clear contents of Tx FIFO */
66c13b2e32SVarun Wadekar #define UARTFCR_RXCLR		(1 << 1)	/* Clear contents of Rx FIFO */
67c13b2e32SVarun Wadekar #define UARTFCR_FIFOEN		(1 << 0)	/* Enable the Tx/Rx FIFO */
68c13b2e32SVarun Wadekar 
69c13b2e32SVarun Wadekar /* Line Control Register bits */
70c13b2e32SVarun Wadekar #define UARTLCR_DLAB		(1 << 7)	/* Divisor Latch Access */
71c13b2e32SVarun Wadekar #define UARTLCR_SETB		(1 << 6)	/* Set BREAK Condition */
72c13b2e32SVarun Wadekar #define UARTLCR_SETP		(1 << 5)	/* Set Parity to LCR[4] */
73c13b2e32SVarun Wadekar #define UARTLCR_EVEN		(1 << 4)	/* Even Parity Format */
74c13b2e32SVarun Wadekar #define UARTLCR_PAR		(1 << 3)	/* Parity */
75c13b2e32SVarun Wadekar #define UARTLCR_STOP		(1 << 2)	/* Stop Bit */
76c13b2e32SVarun Wadekar #define UARTLCR_WORDSZ_5	0		/* Word Length of 5 */
77c13b2e32SVarun Wadekar #define UARTLCR_WORDSZ_6	1		/* Word Length of 6 */
78c13b2e32SVarun Wadekar #define UARTLCR_WORDSZ_7	2		/* Word Length of 7 */
79c13b2e32SVarun Wadekar #define UARTLCR_WORDSZ_8	3		/* Word Length of 8 */
80c13b2e32SVarun Wadekar 
81c13b2e32SVarun Wadekar /* Line Status Register bits */
82c13b2e32SVarun Wadekar #define UARTLSR_RXFIFOEMT	(1 << 9)	/* Rx Fifo Empty */
83c13b2e32SVarun Wadekar #define UARTLSR_TXFIFOFULL	(1 << 8)	/* Tx Fifo Full */
84c13b2e32SVarun Wadekar #define UARTLSR_RXFIFOERR	(1 << 7)	/* Rx Fifo Error */
85c13b2e32SVarun Wadekar #define UARTLSR_TEMT		(1 << 6)	/* Tx Shift Register Empty */
86c13b2e32SVarun Wadekar #define UARTLSR_THRE		(1 << 5)	/* Tx Holding Register Empty */
87c13b2e32SVarun Wadekar #define UARTLSR_BRK		(1 << 4)	/* Break Condition Detected */
88c13b2e32SVarun Wadekar #define UARTLSR_FERR		(1 << 3)	/* Framing Error */
89c13b2e32SVarun Wadekar #define UARTLSR_PERR		(1 << 3)	/* Parity Error */
90c13b2e32SVarun Wadekar #define UARTLSR_OVRF		(1 << 2)	/* Rx Overrun Error */
91*861ac52aSNishanth Menon #define UARTLSR_RDR_BIT		(0)		/* Rx Data Ready Bit */
92*861ac52aSNishanth Menon #define UARTLSR_RDR		(1 << UARTLSR_RDR_BIT)	/* Rx Data Ready */
93c13b2e32SVarun Wadekar 
94c13b2e32SVarun Wadekar #endif	/* __UART_16550_H__ */
95