From 5f5e682764e3ea7f3e2a9aa78e53f3b0731f5bd3 Mon Sep 17 00:00:00 2001 From: Damon Lee Date: Tue, 14 May 2024 14:00:25 +1000 Subject: [PATCH] libplatsupport: Add support for imx8mp-evk The i.MX 8M Plus Evaluation Kit is similar to the other platforms in the i.MX 8M family and shares the same serial and timer peripherals. Signed-off-by: Damon Lee --- libplatsupport/CMakeLists.txt | 11 +++++++++-- .../mach_include/imx/platsupport/mach/serial.h | 2 +- .../imx8m/platsupport/plat/gpt_constants.h | 5 +++++ .../plat_include/imx8m/platsupport/plat/serial.h | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libplatsupport/CMakeLists.txt b/libplatsupport/CMakeLists.txt index ab7799f70..0bae33f2c 100644 --- a/libplatsupport/CMakeLists.txt +++ b/libplatsupport/CMakeLists.txt @@ -105,12 +105,13 @@ if( OR KernelPlatformImx7Sabre OR KernelPlatformImx8mq-evk OR KernelPlatformImx8mm-evk + OR KernelPlatformImx8mp-evk OR KernelPlatformMaaxboard ) list(APPEND deps src/mach/${LibPlatSupportMach}/serial/serial.c) endif() -if(KernelPlatImx8mq OR KernelPlatformImx8mm-evk) +if(KernelPlatImx8mq OR KernelPlatformImx8mm-evk OR KernelPlatformImx8mp-evk) list(APPEND deps src/plat/imx8m/chardev.c) # There's no clock driver at the moment, but this is to allow the # libethdrivers to build for imx8mq @@ -132,7 +133,13 @@ add_config_library(platsupport "${configure_string}") add_library(platsupport EXCLUDE_FROM_ALL ${deps}) -if(KernelPlatImx8mq OR KernelPlatformImx8mm-evk) +if(KernelPlatImx8mq OR KernelPlatformImx8mm-evk OR KernelPlatformImx8mp-evk) + if(KernelPlatformImx8mp-evk) + # For the imx8mp, the DTS is in a different format compared to those of + # the imx8mm and imx8mq, there are some constants in the headers that + # point to the proper path + target_compile_definitions(platsupport PRIVATE USE_IMX8MP_GPT_PATH) + endif() target_include_directories(platsupport PUBLIC plat_include/imx8m) endif() diff --git a/libplatsupport/mach_include/imx/platsupport/mach/serial.h b/libplatsupport/mach_include/imx/platsupport/mach/serial.h index 7accd53fe..8def431dd 100644 --- a/libplatsupport/mach_include/imx/platsupport/mach/serial.h +++ b/libplatsupport/mach_include/imx/platsupport/mach/serial.h @@ -23,7 +23,7 @@ enum chardev_id { PS_SERIAL3 = IMX_UART4, PS_SERIAL4 = IMX_UART5, -#if defined(CONFIG_PLAT_SABRE) || defined(CONFIG_PLAT_IMX8MM_EVK) +#if defined(CONFIG_PLAT_SABRE) || defined(CONFIG_PLAT_IMX8MM_EVK) || defined(CONFIG_PLAT_IMX8MP_EVK) PS_SERIAL_DEFAULT = IMX_UART2 diff --git a/libplatsupport/plat_include/imx8m/platsupport/plat/gpt_constants.h b/libplatsupport/plat_include/imx8m/platsupport/plat/gpt_constants.h index 78b696ef2..f5eb499e6 100644 --- a/libplatsupport/plat_include/imx8m/platsupport/plat/gpt_constants.h +++ b/libplatsupport/plat_include/imx8m/platsupport/plat/gpt_constants.h @@ -6,8 +6,13 @@ #pragma once +#ifdef USE_IMX8MP_GPT_PATH +#define GPT1_PATH "/soc@0/bus@30000000/timer@302d0000" +#define GPT2_PATH "/soc@0/bus@30000000/timer@302e0000" +#else #define GPT1_PATH "/gpt@302d0000" #define GPT2_PATH "/gpt@302e0000" +#endif #define GPT_PRESCALER (0) diff --git a/libplatsupport/plat_include/imx8m/platsupport/plat/serial.h b/libplatsupport/plat_include/imx8m/platsupport/plat/serial.h index 9edde7867..09453c19a 100644 --- a/libplatsupport/plat_include/imx8m/platsupport/plat/serial.h +++ b/libplatsupport/plat_include/imx8m/platsupport/plat/serial.h @@ -22,7 +22,7 @@ #define UART_REF_CLK 12096000 -#if defined(CONFIG_PLAT_IMX8MM_EVK) +#if defined(CONFIG_PLAT_IMX8MM_EVK) || defined(CONFIG_PLAT_IMX8MP_EVK) #define DEFAULT_SERIAL_PADDR UART2_PADDR #define DEFAULT_SERIAL_INTERRUPT UART2_IRQ #elif defined(CONFIG_PLAT_IMX8MQ_EVK) || defined(CONFIG_PLAT_MAAXBOARD)