diff options
author | Andre Przywara <andre.przywara@arm.com> | 2020-03-11 15:18:03 +0000 |
---|---|---|
committer | Andre Przywara <andre.przywara@arm.com> | 2020-03-17 13:44:55 +0000 |
commit | 9cc3fa1b8ae31c18fd3a6070b782b3384590523e (patch) | |
tree | 48cee2fee944d1c2bd262b4785258eb7630c4187 /plat/rpi | |
parent | 29e8c460664c88dc3834813d94785fbf6e27b8d1 (diff) | |
download | trusted-firmware-a-9cc3fa1b8ae31c18fd3a6070b782b3384590523e.tar.gz |
rpi: console: Autodetect Mini-UART vs. PL011 configuration
The Raspberry Pi has two different UART devices pin-muxed to GPIO 14&15:
One ARM PL011 one and the 8250 compatible "Mini-UART".
A dtoverlay parameter in config.txt will tell the firmware to switch
between the two: it will setup the right clocks and will configure the
pinmuxes accordingly.
To autodetect the user's choice, we read the pinmux register and check
its setting: ALT5 (0x2) means the Mini-UART is used, ALT0 (0x4) points
to the PL011.
Based on that we select the UART driver to initialise.
This will allow console output in any case.
Change-Id: I620d3ce68de6c6576599f2a405636020e1fd1376
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'plat/rpi')
-rw-r--r-- | plat/rpi/common/rpi3_common.c | 6 | ||||
-rw-r--r-- | plat/rpi/rpi4/platform.mk | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/plat/rpi/common/rpi3_common.c b/plat/rpi/common/rpi3_common.c index 8fc357a788..ef88bf10e6 100644 --- a/plat/rpi/common/rpi3_common.c +++ b/plat/rpi/common/rpi3_common.c @@ -13,6 +13,7 @@ #include <common/debug.h> #include <bl31/interrupt_mgmt.h> #include <drivers/console.h> +#include <drivers/rpi3/gpio/rpi3_gpio.h> #include <drivers/ti/uart/uart_16550.h> #include <drivers/arm/pl011.h> #include <lib/xlat_tables/xlat_tables_v2.h> @@ -105,9 +106,10 @@ static const mmap_region_t plat_rpi3_mmap[] = { ******************************************************************************/ static console_t rpi3_console; + static bool rpi3_use_mini_uart(void) { - return true; + return rpi3_gpio_get_select(14) == RPI3_GPIO_FUNC_ALT5; } void rpi3_console_init(void) @@ -118,6 +120,8 @@ void rpi3_console_init(void) if (RPI3_RUNTIME_UART != -1) console_scope |= CONSOLE_FLAG_RUNTIME; + rpi3_gpio_init(); + if (rpi3_use_mini_uart()) rc = console_16550_register(PLAT_RPI_MINI_UART_BASE, 0, diff --git a/plat/rpi/rpi4/platform.mk b/plat/rpi/rpi4/platform.mk index 28fcda8b0c..49e78dfed0 100644 --- a/plat/rpi/rpi4/platform.mk +++ b/plat/rpi/rpi4/platform.mk @@ -21,6 +21,9 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a72.S \ drivers/arm/gic/common/gic_common.c \ drivers/arm/gic/v2/gicv2_helpers.c \ drivers/arm/gic/v2/gicv2_main.c \ + drivers/delay_timer/delay_timer.c \ + drivers/gpio/gpio.c \ + drivers/rpi3/gpio/rpi3_gpio.c \ plat/common/plat_gicv2.c \ plat/rpi/rpi4/rpi4_bl31_setup.c \ plat/rpi/common/rpi3_pm.c \ |