From 384144dc6559e6c80c242409ce149a449eac7a9c Mon Sep 17 00:00:00 2001 From: Jianxiong Gu Date: Thu, 12 Dec 2024 03:57:22 +0800 Subject: [PATCH] soc: wch: reorganize series directories by core Place ch32v003 under the qingke_v2a series. Place qingke series under the ch32v family. Signed-off-by: Jianxiong Gu --- modules/hal_wch/CMakeLists.txt | 2 +- soc/wch/{ch32v00x => ch32v}/CMakeLists.txt | 5 +---- soc/wch/ch32v/Kconfig | 15 +++++++++++++++ soc/wch/ch32v/Kconfig.defconfig | 9 +++++++++ soc/wch/ch32v/Kconfig.soc | 11 +++++++++++ soc/wch/ch32v/qingke_v2a/CMakeLists.txt | 10 ++++++++++ soc/wch/{ch32v00x => ch32v/qingke_v2a}/Kconfig | 7 +------ .../qingke_v2a}/Kconfig.defconfig | 9 ++++----- .../ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 | 9 +++++++++ soc/wch/ch32v/qingke_v2a/Kconfig.soc | 11 +++++++++++ .../qingke_v2a/Kconfig.soc.ch32v003} | 8 +------- .../{ch32v00x => ch32v/qingke_v2a}/pinctrl_soc.h | 0 soc/wch/{ch32v00x => ch32v/qingke_v2a}/soc_irq.S | 0 soc/wch/{ch32v00x => ch32v/qingke_v2a}/vector.S | 0 soc/wch/{ch32v00x => ch32v}/soc.yml | 8 +++++--- 15 files changed, 78 insertions(+), 26 deletions(-) rename soc/wch/{ch32v00x => ch32v}/CMakeLists.txt (80%) create mode 100644 soc/wch/ch32v/Kconfig create mode 100644 soc/wch/ch32v/Kconfig.defconfig create mode 100644 soc/wch/ch32v/Kconfig.soc create mode 100644 soc/wch/ch32v/qingke_v2a/CMakeLists.txt rename soc/wch/{ch32v00x => ch32v/qingke_v2a}/Kconfig (59%) rename soc/wch/{ch32v00x => ch32v/qingke_v2a}/Kconfig.defconfig (78%) create mode 100644 soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 create mode 100644 soc/wch/ch32v/qingke_v2a/Kconfig.soc rename soc/wch/{ch32v00x/Kconfig.soc => ch32v/qingke_v2a/Kconfig.soc.ch32v003} (54%) rename soc/wch/{ch32v00x => ch32v/qingke_v2a}/pinctrl_soc.h (100%) rename soc/wch/{ch32v00x => ch32v/qingke_v2a}/soc_irq.S (100%) rename soc/wch/{ch32v00x => ch32v/qingke_v2a}/vector.S (100%) rename soc/wch/{ch32v00x => ch32v}/soc.yml (53%) diff --git a/modules/hal_wch/CMakeLists.txt b/modules/hal_wch/CMakeLists.txt index 729bc403567..822f83b867b 100644 --- a/modules/hal_wch/CMakeLists.txt +++ b/modules/hal_wch/CMakeLists.txt @@ -1,3 +1,3 @@ -if(CONFIG_SOC_SERIES_CH32V00X) +if(CONFIG_SOC_CH32V003) zephyr_include_directories(${ZEPHYR_HAL_WCH_MODULE_DIR}/ch32v003fun .) endif() diff --git a/soc/wch/ch32v00x/CMakeLists.txt b/soc/wch/ch32v/CMakeLists.txt similarity index 80% rename from soc/wch/ch32v00x/CMakeLists.txt rename to soc/wch/ch32v/CMakeLists.txt index e1688933580..0f127dd9c75 100644 --- a/soc/wch/ch32v00x/CMakeLists.txt +++ b/soc/wch/ch32v/CMakeLists.txt @@ -1,9 +1,6 @@ # Copyright (c) 2024 Michael Hope # SPDX-License-Identifier: Apache-2.0 -zephyr_sources( - soc_irq.S - vector.S -) +add_subdirectory(${SOC_SERIES}) set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/wch/ch32v/Kconfig b/soc/wch/ch32v/Kconfig new file mode 100644 index 00000000000..736c76ba659 --- /dev/null +++ b/soc/wch/ch32v/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Michael Hope +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_CH32V + select RISCV + select BUILD_OUTPUT_HEX + select CH32V00X_SYSTICK + select ATOMIC_OPERATIONS_C + imply XIP + +if SOC_FAMILY_CH32V + +rsource "*/Kconfig" + +endif # SOC_FAMILY_CH32V diff --git a/soc/wch/ch32v/Kconfig.defconfig b/soc/wch/ch32v/Kconfig.defconfig new file mode 100644 index 00000000000..7d710b5b910 --- /dev/null +++ b/soc/wch/ch32v/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Michael Hope +# Copyright (c) 2024 Jianxiong Gu +# SPDX-License-Identifier: Apache-2.0 + +if SOC_FAMILY_CH32V + +rsource "*/Kconfig.defconfig" + +endif # SOC_FAMILY_CH32V diff --git a/soc/wch/ch32v/Kconfig.soc b/soc/wch/ch32v/Kconfig.soc new file mode 100644 index 00000000000..39cb7270b1c --- /dev/null +++ b/soc/wch/ch32v/Kconfig.soc @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Michael Hope +# Copyright (c) 2024 Jianxiong Gu +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_CH32V + bool + +config SOC_FAMILY + default "ch32v" if SOC_FAMILY_CH32V + +rsource "*/Kconfig.soc" diff --git a/soc/wch/ch32v/qingke_v2a/CMakeLists.txt b/soc/wch/ch32v/qingke_v2a/CMakeLists.txt new file mode 100644 index 00000000000..a7e9de643d6 --- /dev/null +++ b/soc/wch/ch32v/qingke_v2a/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Michael Hope +# Copyright (c) 2024 Jianxiong Gu +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources( + soc_irq.S + vector.S +) + +zephyr_include_directories(.) diff --git a/soc/wch/ch32v00x/Kconfig b/soc/wch/ch32v/qingke_v2a/Kconfig similarity index 59% rename from soc/wch/ch32v00x/Kconfig rename to soc/wch/ch32v/qingke_v2a/Kconfig index c5de3547451..de004227a47 100644 --- a/soc/wch/ch32v00x/Kconfig +++ b/soc/wch/ch32v/qingke_v2a/Kconfig @@ -1,13 +1,8 @@ # Copyright (c) 2024 Michael Hope # SPDX-License-Identifier: Apache-2.0 -config SOC_CH32V003 - select RISCV - select BUILD_OUTPUT_HEX +config SOC_SERIES_QINGKE_V2A select RISCV_ISA_RV32E select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI select RISCV_ISA_EXT_C - select CH32V00X_SYSTICK - select ATOMIC_OPERATIONS_C - imply XIP diff --git a/soc/wch/ch32v00x/Kconfig.defconfig b/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig similarity index 78% rename from soc/wch/ch32v00x/Kconfig.defconfig rename to soc/wch/ch32v/qingke_v2a/Kconfig.defconfig index ecdd57f74f7..02aa7004c3c 100644 --- a/soc/wch/ch32v00x/Kconfig.defconfig +++ b/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig @@ -1,10 +1,7 @@ # Copyright (c) 2024 Michael Hope # SPDX-License-Identifier: Apache-2.0 -if SOC_CH32V003 - -config NUM_IRQS - default 48 +if SOC_SERIES_QINGKE_V2A config SYS_CLOCK_HW_CYCLES_PER_SEC default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) @@ -21,4 +18,6 @@ config ISR_STACK_SIZE config CLOCK_CONTROL default y -endif # SOC_CH32V003 +rsource "Kconfig.defconfig.*" + +endif # SOC_SERIES_QINGKE_V2A diff --git a/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 b/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 new file mode 100644 index 00000000000..d687a36a7a2 --- /dev/null +++ b/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Michael Hope +# SPDX-License-Identifier: Apache-2.0 + +if SOC_CH32V003 + +config NUM_IRQS + default 48 + +endif # SOC_CH32V003 diff --git a/soc/wch/ch32v/qingke_v2a/Kconfig.soc b/soc/wch/ch32v/qingke_v2a/Kconfig.soc new file mode 100644 index 00000000000..ccf0d2fdf37 --- /dev/null +++ b/soc/wch/ch32v/qingke_v2a/Kconfig.soc @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Jianxiong Gu +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_QINGKE_V2A + bool + select SOC_FAMILY_CH32V + +config SOC_SERIES + default "qingke_v2a" if SOC_SERIES_QINGKE_V2A + +rsource "Kconfig.soc.*" diff --git a/soc/wch/ch32v00x/Kconfig.soc b/soc/wch/ch32v/qingke_v2a/Kconfig.soc.ch32v003 similarity index 54% rename from soc/wch/ch32v00x/Kconfig.soc rename to soc/wch/ch32v/qingke_v2a/Kconfig.soc.ch32v003 index c717a405603..b8ffe5e596b 100644 --- a/soc/wch/ch32v00x/Kconfig.soc +++ b/soc/wch/ch32v/qingke_v2a/Kconfig.soc.ch32v003 @@ -1,15 +1,9 @@ # Copyright (c) 2024 Michael Hope # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_CH32V00X - bool - config SOC_CH32V003 bool - select SOC_SERIES_CH32V00X - -config SOC_SERIES - default "ch32v00x" if SOC_SERIES_CH32V00X + select SOC_SERIES_QINGKE_V2A config SOC default "ch32v003" if SOC_CH32V003 diff --git a/soc/wch/ch32v00x/pinctrl_soc.h b/soc/wch/ch32v/qingke_v2a/pinctrl_soc.h similarity index 100% rename from soc/wch/ch32v00x/pinctrl_soc.h rename to soc/wch/ch32v/qingke_v2a/pinctrl_soc.h diff --git a/soc/wch/ch32v00x/soc_irq.S b/soc/wch/ch32v/qingke_v2a/soc_irq.S similarity index 100% rename from soc/wch/ch32v00x/soc_irq.S rename to soc/wch/ch32v/qingke_v2a/soc_irq.S diff --git a/soc/wch/ch32v00x/vector.S b/soc/wch/ch32v/qingke_v2a/vector.S similarity index 100% rename from soc/wch/ch32v00x/vector.S rename to soc/wch/ch32v/qingke_v2a/vector.S diff --git a/soc/wch/ch32v00x/soc.yml b/soc/wch/ch32v/soc.yml similarity index 53% rename from soc/wch/ch32v00x/soc.yml rename to soc/wch/ch32v/soc.yml index 5c39c57a7c7..c01905a7ed7 100644 --- a/soc/wch/ch32v00x/soc.yml +++ b/soc/wch/ch32v/soc.yml @@ -1,7 +1,9 @@ # Copyright (c) 2024 Michael Hope # SPDX-License-Identifier: Apache-2.0 -series: - - name: ch32v00x +family: +- name: ch32v + series: + - name: qingke-v2 socs: - - name: ch32v003 + - name: ch32v003