Commit 7c0a1877 authored by Andre Przywara's avatar Andre Przywara
Browse files

rpi3: Allow runtime determination of UART base clock rate



At the moment the UART input clock rate is hard coded at compile time.
This works as long as the GPU firmware always sets up the same rate,
which does not seem to be true for the Raspberry Pi 4.

In preparation for being able to change this at runtime, add a base
clock parameter to the console setup function. This is still hardcoded
for the Raspberry Pi 3.

Change-Id: I398bc2f1e9b46f7af9a84cb0b33cbe8e78f2d900
Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
parent 66799507
......@@ -14,7 +14,7 @@
******************************************************************************/
/* Utility functions */
void rpi3_console_init(void);
void rpi3_console_init(unsigned int base_clk_rate);
void rpi3_setup_page_tables(uintptr_t total_base, size_t total_size,
uintptr_t code_start, uintptr_t code_limit,
uintptr_t rodata_start, uintptr_t rodata_limit
......
......@@ -104,14 +104,14 @@ static const mmap_region_t plat_rpi3_mmap[] = {
******************************************************************************/
static console_16550_t rpi3_console;
void rpi3_console_init(void)
void rpi3_console_init(unsigned int base_clk_rate)
{
int console_scope = CONSOLE_FLAG_BOOT;
#if RPI3_RUNTIME_UART != -1
console_scope |= CONSOLE_FLAG_RUNTIME;
#endif
int rc = console_16550_register(PLAT_RPI3_UART_BASE,
PLAT_RPI3_UART_CLK_IN_HZ,
base_clk_rate,
PLAT_RPI3_UART_BAUDRATE,
&rpi3_console);
if (rc == 0) {
......
......@@ -35,7 +35,7 @@ void bl1_early_platform_setup(void)
0x80000000);
/* Initialize the console to provide early debug support */
rpi3_console_init();
rpi3_console_init(PLAT_RPI3_UART_CLK_IN_HZ);
/* Allow BL1 to see the whole Trusted RAM */
bl1_tzram_layout.total_base = BL_RAM_BASE;
......
......@@ -62,7 +62,7 @@ void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
meminfo_t *mem_layout = (meminfo_t *) arg1;
/* Initialize the console to provide early debug support */
rpi3_console_init();
rpi3_console_init(PLAT_RPI3_UART_CLK_IN_HZ);
/* Enable arch timer */
generic_delay_timer_init();
......
......@@ -60,7 +60,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
{
/* Initialize the console to provide early debug support */
rpi3_console_init();
rpi3_console_init(PLAT_RPI3_UART_CLK_IN_HZ);
/*
* In debug builds, a special value is passed in 'arg1' to verify
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment