12 #include <soc/clock.h>
15 #include <soc/addressmap.h>
44 #define UART_IBRD_BAUD_DIVINT_SHIFT 0
45 #define UART_IBRD_BAUD_DIVINT_MASK 0xffff
47 #define UART_FBRD_BAUD_DIVFRAC_SHIFT 0
48 #define UART_FBRD_BAUD_DIVFRAC_MASK 0x3f
53 #define UART_SCLK_DIV 3
63 static const u8 div[] = {1, 2, 4, 6, 8, 16, 24, 32};
88 (
struct cn81xx_uart *)CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
98 return CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
110 const size_t delay = (hclks * 1000000ULL) / hclk;
static void write32(void *addr, uint32_t val)
void write64(void *addr, uint64_t val)
uint64_t read64(const void *addr)
#define assert(statement)
void delay(unsigned int secs)
uintptr_t uart_platform_base(unsigned int idx)
#define PL011_UARTLCR_H_FEN
#define PL011_UARTCR_UARTEN
#define PL011_UARTLCR_H_WLEN_8
u64 thunderx_get_io_clock(void)
Returns the I/O clock speed in Hz.
static size_t uart_sclk_divisor(const size_t reg)
Returns the current UART HCLK divider.
#define UART_FBRD_BAUD_DIVFRAC_MASK
check_member(cn81xx_uart, uctl_ctl, 0x1000)
static void uart_wait_hclk(struct cn81xx_uart *uart, const size_t hclks)
Waits given count if HCLK cycles.
int uart_setup(const size_t bus, int baudrate)
Setup UART with desired BAUD rate in 8N1, no parity mode.
unsigned int uart_platform_refclk(void)
int uart_is_enabled(const size_t bus)
Returns the UART state.
static size_t uart_hclk(struct cn81xx_uart *uart)
Returns the current UART HCLK.
unsigned long long uint64_t
union cn81xx_uart_ctl uctl_ctl
struct cn81xx_uart_ctl::@445 s