1 /*
2  * Copyright 2021 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <assert.h>
9 
10 #include <common/debug.h>
11 #include <dcfg.h>
12 #include <drivers/arm/pl011.h>
13 #include <drivers/console.h>
14 #include <lib/utils.h>
15 
16 /*
17  * Perform Arm specific early platform setup. At this moment we only initialize
18  * the console and the memory layout.
19  */
plat_console_init(uintptr_t nxp_console_addr,uint32_t uart_clk_div,uint32_t baud)20 void plat_console_init(uintptr_t nxp_console_addr, uint32_t uart_clk_div,
21 			uint32_t baud)
22 {
23 	struct sysinfo sys;
24 	static console_t nxp_console;
25 
26 	zeromem(&sys, sizeof(sys));
27 	if (get_clocks(&sys)) {
28 		ERROR("System clocks are not set\n");
29 		panic();
30 	}
31 
32 	console_pl011_register(nxp_console_addr,
33 			      (sys.freq_platform/uart_clk_div),
34 			       baud, &nxp_console);
35 }
36