Browse Source

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 <jimmyzhe@andestech.com>
pull/88165/head
Jimmy Zheng 5 months ago committed by Benjamin Cabé
parent
commit
ed97af9309
  1. 7
      drivers/interrupt_controller/Kconfig.clic
  2. 8
      drivers/interrupt_controller/intc_clic.c

7
drivers/interrupt_controller/Kconfig.clic

@ -16,6 +16,7 @@ config NUCLEI_ECLIC @@ -16,6 +16,7 @@ config NUCLEI_ECLIC
depends on DT_HAS_NUCLEI_ECLIC_ENABLED
select CLIC
select CLIC_SMCLICSHV_EXT if RISCV_VECTORED_MODE
select CLIC_SMCLICCONFIG_EXT
help
Interrupt controller for Nuclei SoC core.
@ -36,6 +37,12 @@ config CLIC_SMCLICSHV_EXT @@ -36,6 +37,12 @@ config CLIC_SMCLICSHV_EXT
to select the behavior for each interrupt. The CLIC driver needs to
implement the riscv_clic_irq_vector_set() function.
config CLIC_SMCLICCONFIG_EXT
bool
help
Enables the SMCLICCONFIG extension, allowing configuration of CLIC
parameters such as the number of interrupt level bits.
config LEGACY_CLIC
bool "Use the legacy clic specification"
depends on RISCV_HAS_CLIC

8
drivers/interrupt_controller/intc_clic.c

@ -222,15 +222,17 @@ static int clic_init(const struct device *dev) @@ -222,15 +222,17 @@ static int clic_init(const struct device *dev)
if (data->nlbits > data->intctlbits) {
data->nlbits = data->intctlbits;
}
} else {
/* Configure the interrupt level threshold by CSR mintthresh. */
csr_write(CSR_MINTTHRESH, 0x0);
}
if (IS_ENABLED(CONFIG_CLIC_SMCLICCONFIG_EXT)) {
/* Configure the number of bits assigned to interrupt levels. */
union CLICCFG cliccfg = {.qw = read_clic32(dev, CLIC_CFG)};
cliccfg.w.nlbits = data->nlbits;
write_clic32(dev, CLIC_CFG, cliccfg.qw);
} else {
/* Configure the interrupt level threshold by CSR mintthresh. */
csr_write(CSR_MINTTHRESH, 0x0);
}
/* Reset all interrupt control register */

Loading…
Cancel
Save