diff --git a/soc/arm/ti_k3/CMakeLists.txt b/soc/arm/ti_k3/CMakeLists.txt new file mode 100644 index 00000000000..4f789e9b56e --- /dev/null +++ b/soc/arm/ti_k3/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(.) + +add_subdirectory(${SOC_SERIES}) diff --git a/soc/arm/ti_k3/Kconfig b/soc/arm/ti_k3/Kconfig new file mode 100644 index 00000000000..501654fec1a --- /dev/null +++ b/soc/arm/ti_k3/Kconfig @@ -0,0 +1,19 @@ +# Texas Instruments K3 Family +# +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_TI_K3 + bool + +if SOC_FAMILY_TI_K3 + +config SOC_FAMILY + string + default "ti_k3" + +source "soc/arm/ti_k3/*/Kconfig.soc" + +endif # SOC_FAMILY_TI_K3 diff --git a/soc/arm/ti_k3/Kconfig.defconfig b/soc/arm/ti_k3/Kconfig.defconfig new file mode 100644 index 00000000000..668e287ccf7 --- /dev/null +++ b/soc/arm/ti_k3/Kconfig.defconfig @@ -0,0 +1,8 @@ +# Texas Instruments K3 Family +# +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +source "soc/arm/ti_k3/*/Kconfig.defconfig.series" diff --git a/soc/arm/ti_k3/Kconfig.soc b/soc/arm/ti_k3/Kconfig.soc new file mode 100644 index 00000000000..65d1506917b --- /dev/null +++ b/soc/arm/ti_k3/Kconfig.soc @@ -0,0 +1,8 @@ +# Texas Instruments K3 Family +# +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +source "soc/arm/ti_k3/*/Kconfig.series" diff --git a/soc/arm/ti_k3/am62x_m4/CMakeLists.txt b/soc/arm/ti_k3/am62x_m4/CMakeLists.txt new file mode 100644 index 00000000000..e8d816988de --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources(soc.c) + +if(CONFIG_OPENAMP_RSC_TABLE) + zephyr_linker_section(NAME .resource_table GROUP ROM_REGION NOINPUT) + zephyr_linker_section_configure(SECTION .resource_table KEEP INPUT ".resource_table*") +endif() diff --git a/soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.am62xm4 b/soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.am62xm4 new file mode 100644 index 00000000000..688efcd841f --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.am62xm4 @@ -0,0 +1,13 @@ +# Texas Instruments Sitara AM62x-SK-M4 EVM +# +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +if SOC_AM62x_M4 + +config SOC + default "am62x_m4" + +endif diff --git a/soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.series b/soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.series new file mode 100644 index 00000000000..d85c54d9c00 --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.series @@ -0,0 +1,52 @@ +# Texas Instruments Sitara AM62x-SK-M4 EVM +# +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_AM62X_M4 + +source "soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.am62xm4*" + +config SOC_SERIES + default "am62x_m4" + +DT_CHOSEN_Z_FLASH := zephyr,flash + +config FLASH_SIZE + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0,K) + +config FLASH_BASE_ADDRESS + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) + +config NUM_IRQS + default 64 + +config SYS_CLOCK_HW_CYCLES_PER_SEC + int + default 400000000 + +config PINCTRL + default y + +if SERIAL + +config UART_NS16550 + default y + +config UART_NS16550_TI_K3 + default y + +choice UART_NS16550_VARIANT + default UART_NS16550_VARIANT_NS16750 +endchoice + +endif # SERIAL + +config BUILD_OUTPUT_BIN + default n + +source "soc/arm/ti_k3/am62x_m4/Kconfig.defconfig.am62*" + +endif # SOC_SERIES_AM62X_M4 diff --git a/soc/arm/ti_k3/am62x_m4/Kconfig.series b/soc/arm/ti_k3/am62x_m4/Kconfig.series new file mode 100644 index 00000000000..0e675950067 --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/Kconfig.series @@ -0,0 +1,22 @@ +# Texas Instruments Sitara AM62x-SK-M4 EVM +# +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_AM62X_M4 + bool "TI AM62X M4 Core Series" + select SOC_FAMILY_TI_K3 + select ARM + select CPU_CORTEX_M4 + select CPU_CORTEX_M_HAS_SYSTICK + select DYNAMIC_INTERRUPTS + select CPU_CORTEX_M_HAS_DWT + select OPENAMP_RSC_TABLE + select UART_NS16550_ACCESS_WORD_ONLY + select EXTERNAL_ADDRESS_TRANSLATION + select MM_DRV + select MM_TI_RAT + help + Enable support for AM62X M4 Series. diff --git a/soc/arm/ti_k3/am62x_m4/Kconfig.soc b/soc/arm/ti_k3/am62x_m4/Kconfig.soc new file mode 100644 index 00000000000..b0eec320f17 --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/Kconfig.soc @@ -0,0 +1,28 @@ +# Texas Instruments Sitara AM62x-SK-M4 +# +# Copyright (c) 2023 Texas Instruments Incorporated +# Copyright (c) 2023 L Lakshmanan +# +# SPDX-License-Identifier: Apache-2.0 + +choice +prompt "TI AM62X M4 Selection" +depends on SOC_SERIES_AM62X_M4 + +config SOC_AM62x_M4 + bool "TI AM62x M4" + select SOC_PART_NUMBER_AM62x + +endchoice + +config SOC_PART_NUMBER_AM62x + bool + +config SOC_PART_NUMBER_AM62X_M4 + string + default "AM62x" if SOC_PART_NUMBER_AM62x + help + Full part number of the SoC. Do not select directly. + +config SOC_PART_NUMBER + default SOC_PART_NUMBER_AM62X_M4 if SOC_SERIES_AM62X_M4 diff --git a/soc/arm/ti_k3/am62x_m4/linker.ld b/soc/arm/ti_k3/am62x_m4/linker.ld new file mode 100644 index 00000000000..793177b7f72 --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/linker.ld @@ -0,0 +1,18 @@ +/* linker.ld - Linker command/script file + * + * Copyright (c) 2023 Texas Instruments Incorporated + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +SECTIONS +{ +#ifdef CONFIG_OPENAMP_RSC_TABLE + SECTION_PROLOGUE(.resource_table,, SUBALIGN(4)) + { + KEEP(*(.resource_table*)) + } GROUP_LINK_IN(DDR) +#endif +} diff --git a/soc/arm/ti_k3/am62x_m4/soc.c b/soc/arm/ti_k3/am62x_m4/soc.c new file mode 100644 index 00000000000..29c76ec3550 --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/soc.c @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 Texas Instruments Incorporated + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define ADDR_TRANSLATE_RAT_BASE_ADDR (0x044200000u) + +static struct address_trans_region_config region_config[] = { + { + .system_addr = 0x0u, + .local_addr = 0x80000000u, + .size = address_trans_region_size_512M, + }, + { + .local_addr = 0xA0000000u, + .system_addr = 0x20000000u, + .size = address_trans_region_size_512M, + }, + { + .local_addr = 0xC0000000u, + .system_addr = 0x40000000u, + .size = address_trans_region_size_512M, + }, + { + .local_addr = 0x60000000u, + .system_addr = 0x60000000u, + .size = address_trans_region_size_512M, + }, + +/* + * Add regions here if you want to map more memory. + */ +}; + +static int am62x_m4_init(void) +{ + sys_mm_drv_ti_rat_init( + region_config, ADDR_TRANSLATE_RAT_BASE_ADDR, ARRAY_SIZE(region_config)); + return 0; +} + +SYS_INIT(am62x_m4_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/soc/arm/ti_k3/am62x_m4/soc.h b/soc/arm/ti_k3/am62x_m4/soc.h new file mode 100644 index 00000000000..089479dc6fd --- /dev/null +++ b/soc/arm/ti_k3/am62x_m4/soc.h @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2023 Texas Instruments Incorporated + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include