xref: /rk3399_ARM-atf/include/drivers/cadence/cdns_uart.h (revision 665e71b8ea28162ec7737c1411bca3ea89e5957e)
1 /*
2  * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef CDNS_UART_H
8 #define CDNS_UART_H
9 
10 #include <drivers/console.h>
11 
12 /* This is very minimalistic and will only work in QEMU.  */
13 
14 /* CADENCE Registers */
15 #define R_UART_CR	0
16 #define R_UART_CR_RXRST	(1 << 0) /* RX logic reset */
17 #define R_UART_CR_TXRST	(1 << 1) /* TX logic reset */
18 #define R_UART_CR_RX_EN	(1 << 2) /* RX enabled */
19 #define R_UART_CR_TX_EN	(1 << 4) /* TX enabled */
20 
21 #define R_UART_SR		0x2C
22 #define UART_SR_INTR_REMPTY_BIT	1
23 #define UART_SR_INTR_TFUL_BIT	4
24 
25 #define R_UART_TX	0x30
26 #define R_UART_RX	0x30
27 
28 #ifndef __ASSEMBLER__
29 
30 #include <stdint.h>
31 
32 /*
33  * Initialize a new Cadence console instance and register it with the console
34  * framework. The |console| pointer must point to storage that will be valid
35  * for the lifetime of the console, such as a global or static local variable.
36  * Its contents will be reinitialized from scratch.
37  */
38 int console_cdns_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
39 			  console_t *console);
40 
41 #endif /*__ASSEMBLER__*/
42 
43 #endif /* CDNS_UART_H */
44