14ecca339SDan Handley /* 24ecca339SDan Handley * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. 34ecca339SDan Handley * 44ecca339SDan Handley * Redistribution and use in source and binary forms, with or without 54ecca339SDan Handley * modification, are permitted provided that the following conditions are met: 64ecca339SDan Handley * 74ecca339SDan Handley * Redistributions of source code must retain the above copyright notice, this 84ecca339SDan Handley * list of conditions and the following disclaimer. 94ecca339SDan Handley * 104ecca339SDan Handley * Redistributions in binary form must reproduce the above copyright notice, 114ecca339SDan Handley * this list of conditions and the following disclaimer in the documentation 124ecca339SDan Handley * and/or other materials provided with the distribution. 134ecca339SDan Handley * 144ecca339SDan Handley * Neither the name of ARM nor the names of its contributors may be used 154ecca339SDan Handley * to endorse or promote products derived from this software without specific 164ecca339SDan Handley * prior written permission. 174ecca339SDan Handley * 184ecca339SDan Handley * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 194ecca339SDan Handley * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 204ecca339SDan Handley * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 214ecca339SDan Handley * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 224ecca339SDan Handley * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 234ecca339SDan Handley * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 244ecca339SDan Handley * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 254ecca339SDan Handley * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 264ecca339SDan Handley * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 274ecca339SDan Handley * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 284ecca339SDan Handley * POSSIBILITY OF SUCH DAMAGE. 294ecca339SDan Handley */ 304ecca339SDan Handley 314ecca339SDan Handley #ifndef __PL011_H__ 324ecca339SDan Handley #define __PL011_H__ 334ecca339SDan Handley 344ecca339SDan Handley /* PL011 Registers */ 354ecca339SDan Handley #define UARTDR 0x000 364ecca339SDan Handley #define UARTRSR 0x004 374ecca339SDan Handley #define UARTECR 0x004 384ecca339SDan Handley #define UARTFR 0x018 39*12f654b6SJuan Castillo #define UARTIMSC 0x038 40*12f654b6SJuan Castillo #define UARTRIS 0x03C 41*12f654b6SJuan Castillo #define UARTICR 0x044 42*12f654b6SJuan Castillo 43*12f654b6SJuan Castillo /* PL011 registers (out of the SBSA specification) */ 44*12f654b6SJuan Castillo #if !PL011_GENERIC_UART 454ecca339SDan Handley #define UARTILPR 0x020 464ecca339SDan Handley #define UARTIBRD 0x024 474ecca339SDan Handley #define UARTFBRD 0x028 484ecca339SDan Handley #define UARTLCR_H 0x02C 494ecca339SDan Handley #define UARTCR 0x030 504ecca339SDan Handley #define UARTIFLS 0x034 514ecca339SDan Handley #define UARTMIS 0x040 524ecca339SDan Handley #define UARTDMACR 0x048 53*12f654b6SJuan Castillo #endif /* !PL011_GENERIC_UART */ 544ecca339SDan Handley 554ecca339SDan Handley /* Data status bits */ 564ecca339SDan Handley #define UART_DATA_ERROR_MASK 0x0F00 574ecca339SDan Handley 584ecca339SDan Handley /* Status reg bits */ 594ecca339SDan Handley #define UART_STATUS_ERROR_MASK 0x0F 604ecca339SDan Handley 614ecca339SDan Handley /* Flag reg bits */ 624ecca339SDan Handley #define PL011_UARTFR_RI (1 << 8) /* Ring indicator */ 634ecca339SDan Handley #define PL011_UARTFR_TXFE (1 << 7) /* Transmit FIFO empty */ 644ecca339SDan Handley #define PL011_UARTFR_RXFF (1 << 6) /* Receive FIFO full */ 654ecca339SDan Handley #define PL011_UARTFR_TXFF (1 << 5) /* Transmit FIFO full */ 664ecca339SDan Handley #define PL011_UARTFR_RXFE (1 << 4) /* Receive FIFO empty */ 674ecca339SDan Handley #define PL011_UARTFR_BUSY (1 << 3) /* UART busy */ 684ecca339SDan Handley #define PL011_UARTFR_DCD (1 << 2) /* Data carrier detect */ 694ecca339SDan Handley #define PL011_UARTFR_DSR (1 << 1) /* Data set ready */ 704ecca339SDan Handley #define PL011_UARTFR_CTS (1 << 0) /* Clear to send */ 714ecca339SDan Handley 72fce5f750SSoby Mathew #define PL011_UARTFR_TXFF_BIT 5 /* Transmit FIFO full bit in UARTFR register */ 73fce5f750SSoby Mathew #define PL011_UARTFR_RXFE_BIT 4 /* Receive FIFO empty bit in UARTFR register */ 74fce5f750SSoby Mathew 754ecca339SDan Handley /* Control reg bits */ 76*12f654b6SJuan Castillo #if !PL011_GENERIC_UART 774ecca339SDan Handley #define PL011_UARTCR_CTSEN (1 << 15) /* CTS hardware flow control enable */ 784ecca339SDan Handley #define PL011_UARTCR_RTSEN (1 << 14) /* RTS hardware flow control enable */ 794ecca339SDan Handley #define PL011_UARTCR_RTS (1 << 11) /* Request to send */ 804ecca339SDan Handley #define PL011_UARTCR_DTR (1 << 10) /* Data transmit ready. */ 814ecca339SDan Handley #define PL011_UARTCR_RXE (1 << 9) /* Receive enable */ 824ecca339SDan Handley #define PL011_UARTCR_TXE (1 << 8) /* Transmit enable */ 834ecca339SDan Handley #define PL011_UARTCR_LBE (1 << 7) /* Loopback enable */ 844ecca339SDan Handley #define PL011_UARTCR_UARTEN (1 << 0) /* UART Enable */ 854ecca339SDan Handley 864ecca339SDan Handley #if !defined(PL011_LINE_CONTROL) 874ecca339SDan Handley /* FIFO Enabled / No Parity / 8 Data bit / One Stop Bit */ 884ecca339SDan Handley #define PL011_LINE_CONTROL (PL011_UARTLCR_H_FEN | PL011_UARTLCR_H_WLEN_8) 894ecca339SDan Handley #endif 904ecca339SDan Handley 914ecca339SDan Handley /* Line Control Register Bits */ 924ecca339SDan Handley #define PL011_UARTLCR_H_SPS (1 << 7) /* Stick parity select */ 934ecca339SDan Handley #define PL011_UARTLCR_H_WLEN_8 (3 << 5) 944ecca339SDan Handley #define PL011_UARTLCR_H_WLEN_7 (2 << 5) 954ecca339SDan Handley #define PL011_UARTLCR_H_WLEN_6 (1 << 5) 964ecca339SDan Handley #define PL011_UARTLCR_H_WLEN_5 (0 << 5) 974ecca339SDan Handley #define PL011_UARTLCR_H_FEN (1 << 4) /* FIFOs Enable */ 984ecca339SDan Handley #define PL011_UARTLCR_H_STP2 (1 << 3) /* Two stop bits select */ 994ecca339SDan Handley #define PL011_UARTLCR_H_EPS (1 << 2) /* Even parity select */ 1004ecca339SDan Handley #define PL011_UARTLCR_H_PEN (1 << 1) /* Parity Enable */ 1014ecca339SDan Handley #define PL011_UARTLCR_H_BRK (1 << 0) /* Send break */ 1024ecca339SDan Handley 103*12f654b6SJuan Castillo #endif /* !PL011_GENERIC_UART */ 104*12f654b6SJuan Castillo 1054ecca339SDan Handley #endif /* __PL011_H__ */ 106