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