feat(imx8mq): detect console base address during runtime

On the i.MX8M SoCs, TF-A doesn't itself initialize the UART, but depends
on BL2 to set it up beforehand. To allow using the same TF-A binary on
boards with different UART assignment, TF-A On i.MX8M M/N/P supports
dynamically determining the UART in use. The code is also applicable to
the i.MX8MQ, so enable it there too.

Change-Id: I9ba70f7068e762da979bd103390fa006c3a5d480
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
This commit is contained in:
Leonard Göhrs 2024-03-13 02:08:54 +01:00 committed by Ahmad Fatoum
parent 79da348916
commit 52ee817304
2 changed files with 11 additions and 1 deletions

View file

@ -26,6 +26,7 @@
#include <imx_aipstz.h>
#include <imx_uart.h>
#include <imx8m_caam.h>
#include <imx8m_ccm.h>
#include <plat_imx8.h>
#define TRUSTY_PARAMS_LEN_BYTES (4096*2)
@ -145,6 +146,7 @@ static void bl31_tz380_setup(void)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
unsigned int console_base = IMX_BOOT_UART_BASE;
static console_t console;
int i;
/* enable CSU NS access permission */
@ -154,7 +156,11 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
imx_aipstz_init(aipstz);
console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
if (console_base == 0U) {
console_base = imx8m_uart_get_base();
}
console_imx_uart_register(console_base, IMX_BOOT_UART_CLK_IN_HZ,
IMX_CONSOLE_BAUDRATE, &console);
/* This console is only used for boot stage */
console_set_scope(&console, CONSOLE_FLAG_BOOT);

View file

@ -31,6 +31,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \
plat/imx/imx8m/gpc_common.c \
plat/imx/imx8m/imx_aipstz.c \
plat/imx/imx8m/imx8m_caam.c \
plat/imx/imx8m/imx8m_ccm.c \
plat/imx/imx8m/imx8m_psci_common.c \
plat/imx/imx8m/imx8mq/gpc.c \
plat/imx/common/imx8_topology.c \
@ -66,6 +67,9 @@ BL32_SIZE ?= 0x2000000
$(eval $(call add_define,BL32_SIZE))
IMX_BOOT_UART_BASE ?= 0x30860000
ifeq (${IMX_BOOT_UART_BASE},auto)
override IMX_BOOT_UART_BASE := 0
endif
$(eval $(call add_define,IMX_BOOT_UART_BASE))
ifeq (${SPD},trusty)