diff --git a/soc/CMakeLists.txt b/soc/CMakeLists.txt index 353179fbea5..f9d754cfbb3 100644 --- a/soc/CMakeLists.txt +++ b/soc/CMakeLists.txt @@ -9,6 +9,8 @@ if(_SOC_IS_IN_TREE) endif() unset(_SOC_IS_IN_TREE) +add_subdirectory(common) + if(HWMv1) if(EXISTS ${SOC_DIR}/${ARCH}/CMakeLists.txt) add_subdirectory(${SOC_DIR}/${ARCH} soc/${ARCH}) diff --git a/soc/Kconfig b/soc/Kconfig index a4e2124c988..0063021c3e3 100644 --- a/soc/Kconfig +++ b/soc/Kconfig @@ -15,6 +15,9 @@ osource "soc/soc_legacy/$(ARCH)/Kconfig" # Source Zephyr Kconfig specifics from SoC roots. osource "$(KCONFIG_BINARY_DIR)/soc/Kconfig" +# Source common Kconfig file +osource "soc/common/Kconfig" + module = SOC module-str = SOC source "subsys/logging/Kconfig.template.log_config" diff --git a/soc/soc_legacy/riscv/andes_v5/CMakeLists.txt b/soc/andes/CMakeLists.txt similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/CMakeLists.txt rename to soc/andes/CMakeLists.txt diff --git a/soc/soc_legacy/riscv/andes_v5/Kconfig.soc b/soc/andes/Kconfig similarity index 60% rename from soc/soc_legacy/riscv/andes_v5/Kconfig.soc rename to soc/andes/Kconfig index 17724b9d4b9..6e79404ba50 100644 --- a/soc/soc_legacy/riscv/andes_v5/Kconfig.soc +++ b/soc/andes/Kconfig @@ -1,4 +1,4 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "soc/soc_legacy/riscv/andes_v5/*/Kconfig.series" +rsource "*/Kconfig" diff --git a/soc/soc_legacy/riscv/andes_v5/Kconfig b/soc/andes/Kconfig.defconfig similarity index 50% rename from soc/soc_legacy/riscv/andes_v5/Kconfig rename to soc/andes/Kconfig.defconfig index d71ce317ee1..1560bc1c4fd 100644 --- a/soc/soc_legacy/riscv/andes_v5/Kconfig +++ b/soc/andes/Kconfig.defconfig @@ -1,15 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config SOC_FAMILY_ANDES_V5 - bool - if SOC_FAMILY_ANDES_V5 -config SOC_FAMILY - string - default "andes_v5" - -source "soc/soc_legacy/riscv/andes_v5/*/Kconfig.soc" +rsource "*/Kconfig.defconfig" endif # SOC_FAMILY_ANDES_V5 diff --git a/soc/andes/Kconfig.soc b/soc/andes/Kconfig.soc new file mode 100644 index 00000000000..56bfb37f633 --- /dev/null +++ b/soc/andes/Kconfig.soc @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_ANDES_V5 + bool + +config SOC_FAMILY + default "andes_v5" if SOC_FAMILY_ANDES_V5 + +rsource "*/Kconfig.soc" diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/CMakeLists.txt b/soc/andes/ae350/CMakeLists.txt similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/CMakeLists.txt rename to soc/andes/ae350/CMakeLists.txt diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.soc b/soc/andes/ae350/Kconfig similarity index 95% rename from soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.soc rename to soc/andes/ae350/Kconfig index 1731cc08f51..1a0a2443492 100644 --- a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.soc +++ b/soc/andes/ae350/Kconfig @@ -1,12 +1,12 @@ # Copyright (c) 2021 Andes Technology Corporation # SPDX-License-Identifier: Apache-2.0 -choice -prompt "Andes V5 SoC Selection" -depends on SOC_SERIES_ANDES_AE350 +config SOC_SERIES_ANDES_AE350 + select RISCV + select RISCV_PRIVILEGED + select RISCV_HAS_PLIC config SOC_ANDES_AE350 - bool "Andes AE350 SoC implementation" select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR select RISCV_ISA_EXT_M @@ -16,8 +16,6 @@ config SOC_ANDES_AE350 select CPU_HAS_ICACHE select RISCV_PMP -endchoice - if SOC_SERIES_ANDES_AE350 choice diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.defconfig.series b/soc/andes/ae350/Kconfig.defconfig similarity index 87% rename from soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.defconfig.series rename to soc/andes/ae350/Kconfig.defconfig index 6cac4e02ed9..ba36eddc354 100644 --- a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.defconfig.series +++ b/soc/andes/ae350/Kconfig.defconfig @@ -6,10 +6,7 @@ if SOC_SERIES_ANDES_AE350 # Kconfig picks the first default with a satisfied condition. # SoC defaults should be parsed before SoC Series defaults, because SoCs usually # overrides SoC Series values. -source "soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.defconfig.ae*" - -config SOC_SERIES - default "ae350" +rsource "Kconfig.defconfig.ae*" config SYS_CLOCK_HW_CYCLES_PER_SEC default 60000000 diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 b/soc/andes/ae350/Kconfig.defconfig.ae350 similarity index 93% rename from soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 rename to soc/andes/ae350/Kconfig.defconfig.ae350 index fee73684b71..ba661c96e63 100644 --- a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 +++ b/soc/andes/ae350/Kconfig.defconfig.ae350 @@ -3,9 +3,6 @@ if SOC_ANDES_AE350 -config SOC - default "ae350" - config SYS_CLOCK_TICKS_PER_SEC default 100 if (!ICACHE || XIP) diff --git a/soc/andes/ae350/Kconfig.soc b/soc/andes/ae350/Kconfig.soc new file mode 100644 index 00000000000..be7310adcc2 --- /dev/null +++ b/soc/andes/ae350/Kconfig.soc @@ -0,0 +1,20 @@ +# Copyright (c) 2021 Andes Technology Corporation +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_ANDES_AE350 + bool + select SOC_FAMILY_ANDES_V5 + help + Andes V5 AE350 SoC Series Implementation" + +config SOC_ANDES_AE350 + bool + select SOC_SERIES_ANDES_AE350 + help + Andes AE350 SoC implementation" + +config SOC_SERIES + default "ae350" if SOC_SERIES_ANDES_AE350 + +config SOC + default "ae350" if SOC_ANDES_AE350 diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/common_linker/execit.ld b/soc/andes/ae350/common_linker/execit.ld similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/common_linker/execit.ld rename to soc/andes/ae350/common_linker/execit.ld diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/common_linker/init.ld b/soc/andes/ae350/common_linker/init.ld similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/common_linker/init.ld rename to soc/andes/ae350/common_linker/init.ld diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/common_linker/ram_start_nonzero.ld b/soc/andes/ae350/common_linker/ram_start_nonzero.ld similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/common_linker/ram_start_nonzero.ld rename to soc/andes/ae350/common_linker/ram_start_nonzero.ld diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/l2_cache.c b/soc/andes/ae350/l2_cache.c similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/l2_cache.c rename to soc/andes/ae350/l2_cache.c diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/linker.ld b/soc/andes/ae350/linker.ld similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/linker.ld rename to soc/andes/ae350/linker.ld diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/pma.c b/soc/andes/ae350/pma.c similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/pma.c rename to soc/andes/ae350/pma.c diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/soc_context.h b/soc/andes/ae350/soc_context.h similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/soc_context.h rename to soc/andes/ae350/soc_context.h diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/soc_irq.S b/soc/andes/ae350/soc_irq.S similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/soc_irq.S rename to soc/andes/ae350/soc_irq.S diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/soc_offsets.h b/soc/andes/ae350/soc_offsets.h similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/soc_offsets.h rename to soc/andes/ae350/soc_offsets.h diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/soc_v5.h b/soc/andes/ae350/soc_v5.h similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/soc_v5.h rename to soc/andes/ae350/soc_v5.h diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/start.S b/soc/andes/ae350/start.S similarity index 100% rename from soc/soc_legacy/riscv/andes_v5/ae350/start.S rename to soc/andes/ae350/start.S diff --git a/soc/andes/soc.yml b/soc/andes/soc.yml new file mode 100644 index 00000000000..be842155259 --- /dev/null +++ b/soc/andes/soc.yml @@ -0,0 +1,6 @@ +family: +- name: andes_v5 + series: + - name: ae350 + socs: + - name: ae350 diff --git a/soc/soc_legacy/riscv/andes_v5/Kconfig.defconfig b/soc/common/CMakeLists.txt similarity index 56% rename from soc/soc_legacy/riscv/andes_v5/Kconfig.defconfig rename to soc/common/CMakeLists.txt index e5ab28a3689..8deca3ca0e0 100644 --- a/soc/soc_legacy/riscv/andes_v5/Kconfig.defconfig +++ b/soc/common/CMakeLists.txt @@ -1,4 +1,4 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -source "soc/soc_legacy/riscv/andes_v5/*/Kconfig.defconfig.series" +add_subdirectory_ifdef(CONFIG_RISCV_PRIVILEGED riscv-privileged) diff --git a/soc/soc_legacy/riscv/common/Kconfig b/soc/common/Kconfig similarity index 50% rename from soc/soc_legacy/riscv/common/Kconfig rename to soc/common/Kconfig index 89e27dbde4d..3f8105b3689 100644 --- a/soc/soc_legacy/riscv/common/Kconfig +++ b/soc/common/Kconfig @@ -1,4 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -# -source "soc/soc_legacy/riscv/common/riscv-privileged/Kconfig" + +if RISCV_PRIVILEGED + +rsource "riscv-privileged/Kconfig" + +endif # RISCV_PRIVILEGED diff --git a/soc/soc_legacy/riscv/common/riscv-privileged/CMakeLists.txt b/soc/common/riscv-privileged/CMakeLists.txt similarity index 100% rename from soc/soc_legacy/riscv/common/riscv-privileged/CMakeLists.txt rename to soc/common/riscv-privileged/CMakeLists.txt diff --git a/soc/soc_legacy/riscv/common/riscv-privileged/Kconfig b/soc/common/riscv-privileged/Kconfig similarity index 100% rename from soc/soc_legacy/riscv/common/riscv-privileged/Kconfig rename to soc/common/riscv-privileged/Kconfig diff --git a/soc/soc_legacy/riscv/common/riscv-privileged/soc_common_irq.c b/soc/common/riscv-privileged/soc_common_irq.c similarity index 100% rename from soc/soc_legacy/riscv/common/riscv-privileged/soc_common_irq.c rename to soc/common/riscv-privileged/soc_common_irq.c diff --git a/soc/soc_legacy/riscv/common/riscv-privileged/soc_irq.S b/soc/common/riscv-privileged/soc_irq.S similarity index 100% rename from soc/soc_legacy/riscv/common/riscv-privileged/soc_irq.S rename to soc/common/riscv-privileged/soc_irq.S diff --git a/soc/soc_legacy/riscv/common/riscv-privileged/vector.S b/soc/common/riscv-privileged/vector.S similarity index 100% rename from soc/soc_legacy/riscv/common/riscv-privileged/vector.S rename to soc/common/riscv-privileged/vector.S diff --git a/soc/soc_legacy/riscv/CMakeLists.txt b/soc/soc_legacy/riscv/CMakeLists.txt index 79d115704b2..b826da926ca 100644 --- a/soc/soc_legacy/riscv/CMakeLists.txt +++ b/soc/soc_legacy/riscv/CMakeLists.txt @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -add_subdirectory(common) - if(SOC_FAMILY) add_subdirectory(${SOC_FAMILY}) else() diff --git a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.series b/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.series deleted file mode 100644 index c2e9b40bfb7..00000000000 --- a/soc/soc_legacy/riscv/andes_v5/ae350/Kconfig.series +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2021 Andes Technology Corporation -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_ANDES_AE350 - bool "Andes V5 AE350 SoC Series Implementation" - select RISCV - select RISCV_PRIVILEGED - select RISCV_HAS_PLIC - select SOC_FAMILY_ANDES_V5 - help - Enable support for Andes V5 AE350 SoC Series diff --git a/soc/soc_legacy/riscv/common/CMakeLists.txt b/soc/soc_legacy/riscv/common/CMakeLists.txt deleted file mode 100644 index 91ef5c975b9..00000000000 --- a/soc/soc_legacy/riscv/common/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory_ifdef(CONFIG_RISCV_PRIVILEGED riscv-privileged)