xref: /rk3399_ARM-atf/include/drivers/nxp/console/plat_console.h (revision 87311b4c16730b884c7e4ff01e3faea83f2731be)
1*050a99a6SPankaj Gupta /*
2*050a99a6SPankaj Gupta  * Copyright 2021 NXP
3*050a99a6SPankaj Gupta  *
4*050a99a6SPankaj Gupta  * SPDX-License-Identifier: BSD-3-Clause
5*050a99a6SPankaj Gupta  *
6*050a99a6SPankaj Gupta  */
7*050a99a6SPankaj Gupta 
8*050a99a6SPankaj Gupta #ifndef PLAT_CONSOLE_H
9*050a99a6SPankaj Gupta #define PLAT_CONSOLE_H
10*050a99a6SPankaj Gupta 
11*050a99a6SPankaj Gupta #include <stdint.h>
12*050a99a6SPankaj Gupta #include <drivers/console.h>
13*050a99a6SPankaj Gupta 
14*050a99a6SPankaj Gupta #if (NXP_CONSOLE == NS16550)
15*050a99a6SPankaj Gupta /*
16*050a99a6SPankaj Gupta  * NXP specific UART - 16550 configuration
17*050a99a6SPankaj Gupta  *
18*050a99a6SPankaj Gupta  * Initialize a NXP 16550 console instance and register it with the console
19*050a99a6SPankaj Gupta  * framework. The |console| pointer must point to storage that will be valid
20*050a99a6SPankaj Gupta  * for the lifetime of the console, such as a global or static local variable.
21*050a99a6SPankaj Gupta  * Its contents will be reinitialized from scratch.
22*050a99a6SPankaj Gupta  * When |clock| has a value of 0, the UART will *not* be initialised. This
23*050a99a6SPankaj Gupta  * means the UART should already be enabled and the baudrate and clock setup
24*050a99a6SPankaj Gupta  * should have been done already, either by platform specific code or by
25*050a99a6SPankaj Gupta  * previous firmware stages. The |baud| parameter will be ignored in this
26*050a99a6SPankaj Gupta  * case as well.
27*050a99a6SPankaj Gupta  */
28*050a99a6SPankaj Gupta int nxp_console_16550_register(uintptr_t baseaddr, uint32_t clock,
29*050a99a6SPankaj Gupta 			       uint32_t baud, console_t *console);
30*050a99a6SPankaj Gupta #endif
31*050a99a6SPankaj Gupta /*
32*050a99a6SPankaj Gupta  * Function to initialize platform's console
33*050a99a6SPankaj Gupta  * and register with console framework
34*050a99a6SPankaj Gupta  */
35*050a99a6SPankaj Gupta void plat_console_init(uintptr_t nxp_console_addr, uint32_t uart_clk_div,
36*050a99a6SPankaj Gupta 			uint32_t baud);
37*050a99a6SPankaj Gupta 
38*050a99a6SPankaj Gupta #endif
39