Skip to content

Commit ed97af9

Browse files
jimmyzhekartben
authored andcommitted
drivers: interrupt_controller: intc_clic: add CLIC SMCLICCONFIG extension
Add support for CLIC SMCLICCONFIG extension, allowing user to configure the number of available interrupt level bits at runtime. Signed-off-by: Jimmy Zheng <[email protected]>
1 parent 8dca182 commit ed97af9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/interrupt_controller/Kconfig.clic

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ config NUCLEI_ECLIC
1616
depends on DT_HAS_NUCLEI_ECLIC_ENABLED
1717
select CLIC
1818
select CLIC_SMCLICSHV_EXT if RISCV_VECTORED_MODE
19+
select CLIC_SMCLICCONFIG_EXT
1920
help
2021
Interrupt controller for Nuclei SoC core.
2122

@@ -36,6 +37,12 @@ config CLIC_SMCLICSHV_EXT
3637
to select the behavior for each interrupt. The CLIC driver needs to
3738
implement the riscv_clic_irq_vector_set() function.
3839

40+
config CLIC_SMCLICCONFIG_EXT
41+
bool
42+
help
43+
Enables the SMCLICCONFIG extension, allowing configuration of CLIC
44+
parameters such as the number of interrupt level bits.
45+
3946
config LEGACY_CLIC
4047
bool "Use the legacy clic specification"
4148
depends on RISCV_HAS_CLIC

drivers/interrupt_controller/intc_clic.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,17 @@ static int clic_init(const struct device *dev)
222222
if (data->nlbits > data->intctlbits) {
223223
data->nlbits = data->intctlbits;
224224
}
225+
} else {
226+
/* Configure the interrupt level threshold by CSR mintthresh. */
227+
csr_write(CSR_MINTTHRESH, 0x0);
228+
}
225229

230+
if (IS_ENABLED(CONFIG_CLIC_SMCLICCONFIG_EXT)) {
226231
/* Configure the number of bits assigned to interrupt levels. */
227232
union CLICCFG cliccfg = {.qw = read_clic32(dev, CLIC_CFG)};
228233

229234
cliccfg.w.nlbits = data->nlbits;
230235
write_clic32(dev, CLIC_CFG, cliccfg.qw);
231-
} else {
232-
/* Configure the interrupt level threshold by CSR mintthresh. */
233-
csr_write(CSR_MINTTHRESH, 0x0);
234236
}
235237

236238
/* Reset all interrupt control register */

0 commit comments

Comments
 (0)