Skip to content

Commit bdc2db6

Browse files
committed
soc: wch: Reorganize Qingke V4 Socs for future
Reorganization for deduplication. Signed-off-by: Camille BAUD <mail@massdriver.space>
1 parent 8ae6dfa commit bdc2db6

34 files changed

+61
-186
lines changed

drivers/clock_control/clock_control_wch_rcc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void clock_control_wch_rcc_setup_flash(void)
9090
} else {
9191
latency = FLASH_ACTLR_LATENCY_1;
9292
}
93-
#elif defined(CONFIG_SOC_SERIES_CH32V00X)
93+
#elif defined(CONFIG_SOC_SERIES_QINGKE_V2)
9494
if (WCH_RCC_SYSCLK <= 15000000) {
9595
latency = FLASH_ACTLR_LATENCY_0;
9696
} else if (WCH_RCC_SYSCLK <= 24000000) {

drivers/timer/Kconfig.wch_ch32v00x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
config CH32V00X_SYSTICK
55
bool "CH32V QingKe core systick timer"
6-
depends on SOC_SERIES_QINGKE_V2A || SOC_SERIES_QINGKE_V4C || SOC_SERIES_CH32V00X
6+
depends on SOC_SERIES_QINGKE_V2 || SOC_SERIES_QINGKE_V4
77
default y
88
depends on DT_HAS_WCH_SYSTICK_ENABLED

modules/hal_wch/ch32fun.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@
77
#ifndef _CH32FUN_H
88
#define _CH32FUN_H
99

10-
#if defined(CONFIG_SOC_CH32V003)
10+
#if defined(CONFIG_SOC_CH32V003) || defined(CONFIG_SOC_CH32V006)
1111
#define CH32V003 1
1212
#include <ch32v003fun.h>
1313
#endif
1414

15-
#if defined(CONFIG_SOC_SERIES_CH32V00X)
16-
#define CH32V003 1
17-
#include <ch32v003fun.h>
18-
#endif
19-
20-
#if defined(CONFIG_SOC_SERIES_QINGKE_V4C)
15+
#if defined(CONFIG_SOC_CH32V208)
2116
#define CH32V20x 1
17+
#define CH32V20x_D8W 1
2218
#include <ch32v003fun.h>
2319
#endif
2420

soc/wch/ch32v/ch32v00x/Kconfig.soc

Lines changed: 0 additions & 11 deletions
This file was deleted.

soc/wch/ch32v/ch32v00x/CMakeLists.txt renamed to soc/wch/ch32v/qingke_v2/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Copyright (c) 2024 Michael Hope
2-
# Copyright (c) 2024 Jianxiong Gu
1+
# Copyright (c) 2025 MASSDRIVER EI
32
# SPDX-License-Identifier: Apache-2.0
43

54
zephyr_sources(

soc/wch/ch32v/qingke_v2/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
rsource "*/Kconfig"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if SOC_SERIES_QINGKE_V4C
4+
if SOC_SERIES_QINGKE_V2
55

66
config SYS_CLOCK_HW_CYCLES_PER_SEC
77
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency)
88

99
config CLOCK_CONTROL
1010
default y
1111

12-
rsource "Kconfig.defconfig.*"
12+
rsource "*/Kconfig.defconfig.*"
1313

14-
endif # SOC_SERIES_QINGKE_V4C
14+
endif # SOC_SERIES_QINGKE_V2
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
22
# SPDX-License-Identifier: Apache-2.0
33

4-
config SOC_SERIES_QINGKE_V4C
4+
config SOC_SERIES_QINGKE_V2
55
bool
66
select SOC_FAMILY_CH32V
77

88
config SOC_SERIES
9-
default "qingke_v4c" if SOC_SERIES_QINGKE_V4C
9+
default "qingke_v2" if SOC_SERIES_QINGKE_V2
1010

11-
rsource "Kconfig.soc.*"
11+
rsource "*/Kconfig.soc.*"

soc/wch/ch32v/qingke_v2a/pinctrl_soc.h renamed to soc/wch/ch32v/qingke_v2/pinctrl_soc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Michael Hope
2+
* Copyright (c) 2024-2025 Michael Hope
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -10,7 +10,7 @@
1010
/**
1111
* @brief Type to hold a pin's pinctrl configuration.
1212
*/
13-
struct ch32v003_pinctrl_soc_pin {
13+
struct qingke_v2_pinctrl_soc_pin {
1414
uint32_t config: 22;
1515
bool bias_pull_up: 1;
1616
bool bias_pull_down: 1;
@@ -21,7 +21,7 @@ struct ch32v003_pinctrl_soc_pin {
2121
uint8_t slew_rate: 2;
2222
};
2323

24-
typedef struct ch32v003_pinctrl_soc_pin pinctrl_soc_pin_t;
24+
typedef struct qingke_v2_pinctrl_soc_pin pinctrl_soc_pin_t;
2525

2626
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
2727
{ \

soc/wch/ch32v/qingke_v2a/Kconfig renamed to soc/wch/ch32v/qingke_v2/qingke_v2a/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2024 Michael Hope
22
# SPDX-License-Identifier: Apache-2.0
33

4-
config SOC_SERIES_QINGKE_V2A
4+
config SOC_CH32V003
55
select RISCV_ISA_RV32E
66
select RISCV_ISA_EXT_ZICSR
77
select RISCV_ISA_EXT_ZIFENCEI

soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 renamed to soc/wch/ch32v/qingke_v2/qingke_v2a/Kconfig.defconfig.ch32v003

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ if SOC_CH32V003
66
config VECTOR_TABLE_SIZE
77
default 38
88

9+
config MAIN_STACK_SIZE
10+
default 512
11+
12+
config IDLE_STACK_SIZE
13+
default 256
14+
15+
config ISR_STACK_SIZE
16+
default 256
17+
918
config NUM_IRQS
1019
default 48
1120

soc/wch/ch32v/qingke_v2a/Kconfig.soc.ch32v003 renamed to soc/wch/ch32v/qingke_v2/qingke_v2a/Kconfig.soc.ch32v003

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
config SOC_CH32V003
55
bool
6-
select SOC_SERIES_QINGKE_V2A
6+
select SOC_SERIES_QINGKE_V2
77

88
config SOC
99
default "ch32v003" if SOC_CH32V003

soc/wch/ch32v/ch32v00x/Kconfig renamed to soc/wch/ch32v/qingke_v2/qingke_v2c/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Copyright (c) 2025 Michael Hope <michaelh@juju.nz>
1+
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
22
# SPDX-License-Identifier: Apache-2.0
33

4-
config SOC_SERIES_CH32V00X
4+
config SOC_CH32V006
55
select RISCV_ISA_RV32E
66
select RISCV_ISA_EXT_ZICSR
77
select RISCV_ISA_EXT_ZIFENCEI
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Copyright (c) 2025 Michael Hope <michaelh@juju.nz>
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if SOC_SERIES_CH32V00X
4+
if SOC_CH32V006
55

66
config VECTOR_TABLE_SIZE
77
default 41
88

99
config NUM_IRQS
1010
default 41
1111

12-
endif # SOC_SERIES_CH32V00X
12+
endif # SOC_CH32V006

soc/wch/ch32v/ch32v00x/Kconfig.soc.ch32v006 renamed to soc/wch/ch32v/qingke_v2/qingke_v2c/Kconfig.soc.ch32v006

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
config SOC_CH32V006
55
bool
6-
select SOC_SERIES_CH32V00X
6+
select SOC_SERIES_QINGKE_V2
77

88
config SOC
99
default "ch32v006" if SOC_CH32V006
File renamed without changes.
File renamed without changes.

soc/wch/ch32v/qingke_v2a/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

soc/wch/ch32v/qingke_v2a/Kconfig.defconfig

Lines changed: 0 additions & 23 deletions
This file was deleted.

soc/wch/ch32v/qingke_v2a/Kconfig.soc

Lines changed: 0 additions & 11 deletions
This file was deleted.

soc/wch/ch32v/qingke_v2a/vector.S

Lines changed: 0 additions & 29 deletions
This file was deleted.

soc/wch/ch32v/qingke_v4c/CMakeLists.txt renamed to soc/wch/ch32v/qingke_v4/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Copyright (c) 2024 Michael Hope
2-
# Copyright (c) 2024 Jianxiong Gu
1+
# Copyright (c) 2025 MASSDRIVER EI
32
# SPDX-License-Identifier: Apache-2.0
43

54
zephyr_sources(

soc/wch/ch32v/qingke_v4/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
rsource "*/Kconfig"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Copyright (c) 2025 Michael Hope <michaelh@juju.nz>
1+
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if SOC_SERIES_CH32V00X
4+
if SOC_SERIES_QINGKE_V4
55

66
config SYS_CLOCK_HW_CYCLES_PER_SEC
77
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency)
88

99
config CLOCK_CONTROL
1010
default y
1111

12-
rsource "Kconfig.defconfig.*"
12+
rsource "*/Kconfig.defconfig.*"
1313

14-
endif # SOC_SERIES_CH32V00X
14+
endif # SOC_SERIES_QINGKE_V4

soc/wch/ch32v/qingke_v4/Kconfig.soc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_QINGKE_V4
5+
bool
6+
select SOC_FAMILY_CH32V
7+
8+
config SOC_SERIES
9+
default "qingke_v4" if SOC_SERIES_QINGKE_V4
10+
11+
rsource "*/Kconfig.soc.*"

soc/wch/ch32v/ch32v00x/pinctrl_soc.h renamed to soc/wch/ch32v/qingke_v4/pinctrl_soc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* @brief Type to hold a pin's pinctrl configuration.
1212
*/
13-
struct ch32v00x_pinctrl_soc_pin {
13+
struct qingke_v4_pinctrl_soc_pin {
1414
uint32_t config: 22;
1515
bool bias_pull_up: 1;
1616
bool bias_pull_down: 1;
@@ -21,7 +21,7 @@ struct ch32v00x_pinctrl_soc_pin {
2121
uint8_t slew_rate: 2;
2222
};
2323

24-
typedef struct ch32v00x_pinctrl_soc_pin pinctrl_soc_pin_t;
24+
typedef struct qingke_v4_pinctrl_soc_pin pinctrl_soc_pin_t;
2525

2626
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
2727
{ \

soc/wch/ch32v/qingke_v4c/Kconfig renamed to soc/wch/ch32v/qingke_v4/qingke_v4c/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
22
# SPDX-License-Identifier: Apache-2.0
33

4-
config SOC_SERIES_QINGKE_V4C
4+
config SOC_CH32V208
55
select RISCV_ISA_RV32I
66
select RISCV_ISA_EXT_M
77
select RISCV_ISA_EXT_A

soc/wch/ch32v/qingke_v4c/Kconfig.soc.ch32v208 renamed to soc/wch/ch32v/qingke_v4/qingke_v4c/Kconfig.soc.ch32v208

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
config SOC_CH32V208
55
bool
6-
select SOC_SERIES_QINGKE_V4C
6+
select SOC_SERIES_QINGKE_V4
77

88
config SOC
99
default "ch32v208" if SOC_CH32V208
File renamed without changes.

soc/wch/ch32v/qingke_v4c/pinctrl_soc.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)