rpi3: console: Use same "clock-less" setup scheme as RPi4
In the wake of the upcoming unification of the console setup code between RPi3 and RPi4, extend the "clock-less" setup scheme to the RPi3. This avoid programming any clocks or baud rate registers, which makes the port more robust against GPU firmware changes. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Change-Id: Ida83a963bb18a878997e9cbd55f8ceac6a2e1c1f
This commit is contained in:
parent
0d92745e10
commit
795aefe5e8
|
@ -14,7 +14,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/* Utility functions */
|
||||
void rpi3_console_init(unsigned int base_clk_rate);
|
||||
void rpi3_console_init(void);
|
||||
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,16 +104,19 @@ static const mmap_region_t plat_rpi3_mmap[] = {
|
|||
******************************************************************************/
|
||||
static console_t rpi3_console;
|
||||
|
||||
void rpi3_console_init(unsigned int base_clk_rate)
|
||||
void rpi3_console_init(void)
|
||||
{
|
||||
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,
|
||||
base_clk_rate,
|
||||
PLAT_RPI3_UART_BAUDRATE,
|
||||
&rpi3_console);
|
||||
int rc;
|
||||
|
||||
if (RPI3_RUNTIME_UART != -1)
|
||||
console_scope |= CONSOLE_FLAG_RUNTIME;
|
||||
|
||||
rc = console_16550_register(PLAT_RPI_MINI_UART_BASE,
|
||||
0,
|
||||
PLAT_RPI_UART_BAUDRATE,
|
||||
&rpi3_console);
|
||||
|
||||
if (rc == 0) {
|
||||
/*
|
||||
* The crash console doesn't use the multi console API, it uses
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include <assert_macros.S>
|
||||
#include <platform_def.h>
|
||||
|
||||
#include "../include/rpi_hw.h"
|
||||
|
||||
.globl plat_crash_console_flush
|
||||
.globl plat_crash_console_init
|
||||
.globl plat_crash_console_putc
|
||||
|
@ -133,9 +131,9 @@ endfunc platform_mem_init
|
|||
* ---------------------------------------------
|
||||
*/
|
||||
func plat_crash_console_init
|
||||
mov_imm x0, PLAT_RPI3_UART_BASE
|
||||
mov_imm x1, PLAT_RPI3_UART_CLK_IN_HZ
|
||||
mov_imm x2, PLAT_RPI3_UART_BAUDRATE
|
||||
mov_imm x0, PLAT_RPI_MINI_UART_BASE
|
||||
mov x1, xzr
|
||||
mov x2, xzr
|
||||
b console_16550_core_init
|
||||
endfunc plat_crash_console_init
|
||||
|
||||
|
@ -147,7 +145,7 @@ endfunc plat_crash_console_init
|
|||
* ---------------------------------------------
|
||||
*/
|
||||
func plat_crash_console_putc
|
||||
mov_imm x1, PLAT_RPI3_UART_BASE
|
||||
mov_imm x1, PLAT_RPI_MINI_UART_BASE
|
||||
b console_16550_core_putc
|
||||
endfunc plat_crash_console_putc
|
||||
|
||||
|
@ -160,6 +158,6 @@ endfunc plat_crash_console_putc
|
|||
* ---------------------------------------------
|
||||
*/
|
||||
func plat_crash_console_flush
|
||||
mov_imm x0, PLAT_RPI3_UART_BASE
|
||||
mov_imm x0, PLAT_RPI_MINI_UART_BASE
|
||||
b console_16550_core_flush
|
||||
endfunc plat_crash_console_flush
|
||||
|
|
|
@ -249,9 +249,8 @@
|
|||
/*
|
||||
* Serial-related constants.
|
||||
*/
|
||||
#define PLAT_RPI3_UART_BASE RPI3_MINI_UART_BASE
|
||||
#define PLAT_RPI3_UART_CLK_IN_HZ RPI3_MINI_UART_CLK_IN_HZ
|
||||
#define PLAT_RPI3_UART_BAUDRATE ULL(115200)
|
||||
#define PLAT_RPI_MINI_UART_BASE RPI3_MINI_UART_BASE
|
||||
#define PLAT_RPI_UART_BAUDRATE ULL(115200)
|
||||
|
||||
/*
|
||||
* System counter
|
||||
|
|
|
@ -81,7 +81,6 @@
|
|||
*/
|
||||
#define RPI3_IO_MINI_UART_OFFSET ULL(0x00215040)
|
||||
#define RPI3_MINI_UART_BASE (RPI_IO_BASE + RPI3_IO_MINI_UART_OFFSET)
|
||||
#define RPI3_MINI_UART_CLK_IN_HZ ULL(500000000)
|
||||
|
||||
/*
|
||||
* GPIO controller
|
||||
|
|
|
@ -35,7 +35,7 @@ void bl1_early_platform_setup(void)
|
|||
0x80000000);
|
||||
|
||||
/* Initialize the console to provide early debug support */
|
||||
rpi3_console_init(PLAT_RPI3_UART_CLK_IN_HZ);
|
||||
rpi3_console_init();
|
||||
|
||||
/* Allow BL1 to see the whole Trusted RAM */
|
||||
bl1_tzram_layout.total_base = BL_RAM_BASE;
|
||||
|
|
|
@ -51,7 +51,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(PLAT_RPI3_UART_CLK_IN_HZ);
|
||||
rpi3_console_init();
|
||||
|
||||
/* Enable arch timer */
|
||||
generic_delay_timer_init();
|
||||
|
|
|
@ -72,7 +72,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(PLAT_RPI3_UART_CLK_IN_HZ);
|
||||
rpi3_console_init();
|
||||
|
||||
/*
|
||||
* In debug builds, a special value is passed in 'arg1' to verify
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#include <platform_def.h>
|
||||
#include <cortex_a72.h>
|
||||
|
||||
#include "../include/rpi_hw.h"
|
||||
|
||||
.globl plat_crash_console_flush
|
||||
.globl plat_crash_console_init
|
||||
.globl plat_crash_console_putc
|
||||
|
@ -135,7 +133,7 @@ endfunc platform_mem_init
|
|||
* ---------------------------------------------
|
||||
*/
|
||||
func plat_crash_console_init
|
||||
mov_imm x0, PLAT_RPI3_UART_BASE
|
||||
mov_imm x0, PLAT_RPI_MINI_UART_BASE
|
||||
mov x1, xzr
|
||||
mov x2, xzr
|
||||
b console_16550_core_init
|
||||
|
@ -149,7 +147,7 @@ endfunc plat_crash_console_init
|
|||
* ---------------------------------------------
|
||||
*/
|
||||
func plat_crash_console_putc
|
||||
mov_imm x1, PLAT_RPI3_UART_BASE
|
||||
mov_imm x1, PLAT_RPI_MINI_UART_BASE
|
||||
b console_16550_core_putc
|
||||
endfunc plat_crash_console_putc
|
||||
|
||||
|
@ -162,7 +160,7 @@ endfunc plat_crash_console_putc
|
|||
* ---------------------------------------------
|
||||
*/
|
||||
func plat_crash_console_flush
|
||||
mov_imm x0, PLAT_RPI3_UART_BASE
|
||||
mov_imm x0, PLAT_RPI_MINI_UART_BASE
|
||||
b console_16550_core_flush
|
||||
endfunc plat_crash_console_flush
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@
|
|||
/*
|
||||
* Serial-related constants.
|
||||
*/
|
||||
#define PLAT_RPI3_UART_BASE RPI3_MINI_UART_BASE
|
||||
#define PLAT_RPI3_UART_BAUDRATE ULL(115200)
|
||||
#define PLAT_RPI_MINI_UART_BASE RPI4_MINI_UART_BASE
|
||||
#define PLAT_RPI_UART_BAUDRATE ULL(115200)
|
||||
|
||||
/*
|
||||
* System counter
|
||||
|
|
|
@ -79,8 +79,8 @@
|
|||
/*
|
||||
* Serial port (called 'Mini UART' in the Broadcom documentation).
|
||||
*/
|
||||
#define RPI3_IO_MINI_UART_OFFSET ULL(0x00215040)
|
||||
#define RPI3_MINI_UART_BASE (RPI_IO_BASE + RPI3_IO_MINI_UART_OFFSET)
|
||||
#define RPI4_IO_MINI_UART_OFFSET ULL(0x00215040)
|
||||
#define RPI4_MINI_UART_BASE (RPI_IO_BASE + RPI4_IO_MINI_UART_OFFSET)
|
||||
|
||||
/*
|
||||
* GPIO controller
|
||||
|
|
|
@ -132,14 +132,8 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
/* Early GPU firmware revisions need a little break here. */
|
||||
ldelay(100000);
|
||||
|
||||
/*
|
||||
* Initialize the console to provide early debug support.
|
||||
* We rely on the GPU firmware to have initialised the UART correctly,
|
||||
* as the baud base clock rate differs across GPU firmware revisions.
|
||||
* Providing a base clock of 0 lets the 16550 UART init routine skip
|
||||
* the initial enablement and baud rate setup.
|
||||
*/
|
||||
rpi3_console_init(0);
|
||||
/* Initialize the console to provide early debug support. */
|
||||
rpi3_console_init();
|
||||
|
||||
bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
|
||||
bl33_image_ep_info.spsr = rpi3_get_spsr_for_bl33_entry();
|
||||
|
|
Loading…
Reference in New Issue