File tree Expand file tree Collapse file tree 9 files changed +51
-5
lines changed
drivers/interrupt_controller Expand file tree Collapse file tree 9 files changed +51
-5
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,6 @@ int arch_irq_is_enabled(unsigned int irq)
34
34
35
35
static int pfic_init (void )
36
36
{
37
- /* `wfi` is called with interrupts disabled. Configure the PFIC to wake up on any event,
38
- * including any interrupt.
39
- */
40
- PFIC -> SCTLR = SEVONPEND | WFITOWFE ;
41
37
return 0 ;
42
38
}
43
39
Original file line number Diff line number Diff line change 1
1
# Copyright (c) 2024 Michael Hope
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
4
+ add_subdirectory (common )
4
5
add_subdirectory (${SOC_SERIES} )
5
6
6
7
set (SOC_LINKER_SCRIPT ${ZEPHYR_BASE} /include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "" )
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2025 Michael Hope <michaelh@juju.nz>
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ #include <zephyr/irq.h>
7
+ #include <zephyr/tracing/tracing.h>
8
+
9
+ void arch_cpu_idle (void )
10
+ {
11
+ /*
12
+ * The RISC-V Machine-Level ISA section 3.3.3 says that `wfi` will complete even if
13
+ * interrupts are masked, but the QingKe V2A does not do this. Work-around by enabling
14
+ * interrupts first.
15
+ */
16
+ sys_trace_idle ();
17
+ irq_unlock (MSTATUS_IEN );
18
+ __asm__ volatile ("wfi" );
19
+ sys_trace_idle_exit ();
20
+ }
21
+
22
+ void arch_cpu_atomic_idle (unsigned int key )
23
+ {
24
+ sys_trace_idle ();
25
+ irq_unlock (key );
26
+ __asm__ volatile ("wfi" );
27
+ sys_trace_idle_exit ();
28
+ }
Original file line number Diff line number Diff line change @@ -6,3 +6,6 @@ config SOC_SERIES_QINGKE_V2A
6
6
select RISCV_ISA_EXT_ZICSR
7
7
select RISCV_ISA_EXT_ZIFENCEI
8
8
select RISCV_ISA_EXT_C
9
+ select RISCV_ALWAYS_SWITCH_THROUGH_ECALL
10
+ select ARCH_HAS_CUSTOM_CPU_IDLE
11
+ select ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
Original file line number Diff line number Diff line change @@ -8,3 +8,6 @@ config SOC_SERIES_QINGKE_V4B
8
8
select RISCV_ISA_EXT_C
9
9
select RISCV_ISA_EXT_ZICSR
10
10
select RISCV_ISA_EXT_ZIFENCEI
11
+ select RISCV_ALWAYS_SWITCH_THROUGH_ECALL
12
+ select ARCH_HAS_CUSTOM_CPU_IDLE
13
+ select ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
Original file line number Diff line number Diff line change @@ -8,3 +8,6 @@ config SOC_SERIES_QINGKE_V4C
8
8
select RISCV_ISA_EXT_C
9
9
select RISCV_ISA_EXT_ZICSR
10
10
select RISCV_ISA_EXT_ZIFENCEI
11
+ select RISCV_ALWAYS_SWITCH_THROUGH_ECALL
12
+ select ARCH_HAS_CUSTOM_CPU_IDLE
13
+ select ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
Original file line number Diff line number Diff line change @@ -9,3 +9,6 @@ config SOC_SERIES_QINGKE_V4F
9
9
select RISCV_ISA_EXT_F
10
10
select RISCV_ISA_EXT_ZICSR
11
11
select RISCV_ISA_EXT_ZIFENCEI
12
+ select RISCV_ALWAYS_SWITCH_THROUGH_ECALL
13
+ select ARCH_HAS_CUSTOM_CPU_IDLE
14
+ select ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
9
9
config CLOCK_CONTROL
10
10
default y
11
11
12
+ config ISR_TABLES_LOCAL_DECLARATION_SUPPORTED
13
+ default n
14
+
12
15
rsource "Kconfig.defconfig.*"
13
16
14
17
endif # SOC_SERIES_QINGKE_V4F
Original file line number Diff line number Diff line change @@ -22,11 +22,17 @@ SECTION_FUNC(vectors, ivt)
22
22
lui x5, 0x8000
23
23
jr 0x8(x5)
24
24
j __start
25
+ _irq_vector_table:
25
26
.rept CONFIG_VECTOR_TABLE_SIZE
26
27
.word _isr_wrapper
27
28
.endr
28
29
29
30
SECTION_FUNC (vectors, __start)
30
- li a0, 0xf
31
+ li a0 , 0x1f
32
+ csrw 0xbc0, a0
33
+ li a0 , 0x1e
34
+ csrw 0x804, a0
35
+ la t0, _irq_vector_table /* Load address of interrupt vector table */
36
+ ori t0, t0, 0x03
31
37
csrw mtvec, a0
32
38
j __initialize
You can’t perform that action at this time.
0 commit comments