intc: nuclei_eclic: convert SYS_INIT to DEVICE_DT_INST_DEFINE

Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-09-15 10:29:30 +00:00 committed by Carles Cufí
commit aea618ebc0

View file

@ -11,12 +11,14 @@
#include <zephyr/kernel.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/sys/util.h>
#include <zephyr/init.h>
#include <zephyr/device.h>
#include <soc.h>
#include <zephyr/sw_isr_table.h>
#include <zephyr/drivers/interrupt_controller/riscv_clic.h>
#define DT_DRV_COMPAT nuclei_eclic
union CLICCFG {
struct {
uint8_t _reserved0 : 1;
@ -159,7 +161,7 @@ void riscv_clic_irq_priority_set(uint32_t irq, uint32_t pri, uint32_t flags)
ECLIC_CTRL[irq].INTATTR.b.trg = (uint8_t)(flags & CLIC_INTATTR_TRIG_Msk);
}
static int nuclei_eclic_init(void)
static int nuclei_eclic_init(const struct device *dev)
{
/* check hardware support required interrupt levels */
__ASSERT_NO_MSG(ECLIC_INFO.b.intctlbits >= INTERRUPT_LEVEL);
@ -182,4 +184,5 @@ static int nuclei_eclic_init(void)
return 0;
}
SYS_INIT(nuclei_eclic_init, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY);
DEVICE_DT_INST_DEFINE(0, nuclei_eclic_init, NULL, NULL, NULL,
PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL);