Add support for stm32mp2 SoC family
Add support for STM32MP2 SoC A35 core and stm32mp25-ev1 board. Supports HYP and SMP configurations -DPLATFORM=stm32mp2 -DKernelARMlatform=stm32mp257f-ev1 (default) Supports MCS configuration (for Microkit build) Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
This commit is contained in:
parent
a0b4f2d25d
commit
c75cf0e2da
7 changed files with 3005 additions and 0 deletions
14
libsel4/sel4_plat_include/stm32mp2/sel4/plat/api/constants.h
Normal file
14
libsel4/sel4_plat_include/stm32mp2/sel4/plat/api/constants.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright 2026, STMicroelectronics
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sel4/config.h>
|
||||
#include <sel4/arch/constants_cortex_a35.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_AARCH32
|
||||
#error "AARCH32 is unsupported"
|
||||
#endif
|
||||
|
|
@ -21,3 +21,5 @@ register_driver(compatibility_strings "qcom,msm-uartdm" PREFIX src/drivers/seria
|
|||
register_driver(compatibility_strings "xlnx,xuartps" PREFIX src/drivers/serial CFILES "xuartps.c")
|
||||
register_driver(compatibility_strings "amlogic,meson-gx-uart" PREFIX src/drivers/serial
|
||||
CFILES "meson-gx-uart.c")
|
||||
register_driver(compatibility_strings "st,stm32h7-uart" PREFIX src/drivers/serial
|
||||
CFILES "stm32h7-uart.c")
|
||||
|
|
|
|||
33
src/drivers/serial/stm32h7-uart.c
Normal file
33
src/drivers/serial/stm32h7-uart.c
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2026, STMicroelectronics
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdint.h>
|
||||
#include <util.h>
|
||||
#include <machine/io.h>
|
||||
#include <plat/machine/devices_gen.h>
|
||||
|
||||
#define USART_ISR 0x1C
|
||||
#define USART_TDR 0x28
|
||||
|
||||
#define USART_ISR_TXE 0x80U
|
||||
|
||||
#define UART_REG(x) ((volatile uint32_t *)(UART_PPTR + (x)))
|
||||
|
||||
#ifdef CONFIG_PRINTING
|
||||
void uart_drv_putchar(unsigned char c)
|
||||
{
|
||||
while (!(*UART_REG(USART_ISR) & USART_ISR_TXE));
|
||||
*UART_REG(USART_TDR) = c;
|
||||
}
|
||||
#endif /* CONFIG_PRINTING */
|
||||
|
||||
#ifdef CONFIG_DEBUG_BUILD
|
||||
unsigned char uart_drv_getchar(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_BUILD */
|
||||
46
src/plat/stm32mp2/config.cmake
Normal file
46
src/plat/stm32mp2/config.cmake
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Copyright 2026, STMicroelectronics
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
declare_platform(stm32mp2 KernelPlatformMP2 PLAT_STM32MP2 KernelSel4ArchAarch64)
|
||||
|
||||
set(c_configs PLAT_STM32MP25_EV1)
|
||||
set(cmake_configs KernelPlatformMP25_EV1)
|
||||
set(plat_lists stm32mp257f-ev1)
|
||||
foreach(config IN LISTS cmake_configs)
|
||||
unset(${config} CACHE)
|
||||
endforeach()
|
||||
|
||||
if(KernelPlatformMP2)
|
||||
declare_seL4_arch(aarch64)
|
||||
|
||||
check_platform_and_fallback_to_default(KernelARMPlatform "stm32mp257f-ev1")
|
||||
|
||||
list(FIND plat_lists ${KernelARMPlatform} index)
|
||||
if("${index}" STREQUAL "-1")
|
||||
message(FATAL_ERROR "Which stm32mp2 platform not specified ${KernelARMPlatform}")
|
||||
endif()
|
||||
|
||||
list(GET c_configs ${index} c_config)
|
||||
list(GET cmake_configs ${index} cmake_config)
|
||||
config_set(${cmake_config} ${c_config} ON)
|
||||
list(APPEND KernelDTSList "tools/dts/${KernelARMPlatform}.dts")
|
||||
list(APPEND KernelDTSList "src/plat/stm32mp2/overlay-stm32mp2.dts")
|
||||
|
||||
set(KernelArmCortexA35 ON)
|
||||
set(KernelArchArmV8a ON)
|
||||
set(KernelArmGicV2 ON)
|
||||
|
||||
message(STATUS "KernelARMPlatform is ${KernelARMPlatform}")
|
||||
config_set(KernelARMPlatform ARM_PLAT ${KernelARMPlatform})
|
||||
config_set(KernelARMMach MACH "stm32mp2")
|
||||
|
||||
declare_default_headers(
|
||||
TIMER_FREQUENCY 40000000 NUM_PPI 32 MAX_IRQ 415 INTERRUPT_CONTROLLER arch/machine/gic_v2.h
|
||||
TIMER drivers/timer/arm_generic.h KERNEL_WCET 10u)
|
||||
endif()
|
||||
|
||||
add_sources(DEP "KernelPlatformMP2" CFILES src/arch/arm/machine/gic_v2.c
|
||||
src/arch/arm/machine/l2c_nop.c)
|
||||
24
src/plat/stm32mp2/overlay-stm32mp2.dts
Normal file
24
src/plat/stm32mp2/overlay-stm32mp2.dts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright 2026, STMicroelectronics
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
seL4,elfloader-devices =
|
||||
"serial0",
|
||||
&{/psci};
|
||||
|
||||
seL4,kernel-devices =
|
||||
"serial0",
|
||||
&{/interrupt-controller@4ac00000},
|
||||
&{/timer};
|
||||
};
|
||||
|
||||
/* vgic maintenance interrupt */
|
||||
interrupt-controller@4ac00000 {
|
||||
interrupt-parent = <0x05>;
|
||||
interrupts = <0x01 0x09 0x308>;
|
||||
};
|
||||
};
|
||||
2885
tools/dts/stm32mp257f-ev1.dts
Normal file
2885
tools/dts/stm32mp257f-ev1.dts
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -191,6 +191,7 @@ devices:
|
|||
- qcom,msm-uartdm
|
||||
- samsung,exynos4210-uart
|
||||
- snps,dw-apb-uart
|
||||
- st,stm32h7-uart
|
||||
- ti,omap3-uart
|
||||
- xlnx,xuartps
|
||||
- ns16550a
|
||||
|
|
|
|||
Loading…
Reference in a new issue