intc: vexriscv_litex: 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. Fix an incorrectly declared compatible and adjust some DT macros as well. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
6fbe62bdb5
commit
a7e0cb0c80
1 changed files with 6 additions and 7 deletions
|
@ -4,17 +4,16 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT litex_eth0
|
||||
#define DT_DRV_COMPAT vexriscv_intc0
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/arch/cpu.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/irq.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/types.h>
|
||||
|
||||
#define IRQ_MASK DT_REG_ADDR_BY_NAME(DT_INST(0, vexriscv_intc0), irq_mask)
|
||||
#define IRQ_PENDING DT_REG_ADDR_BY_NAME(DT_INST(0, vexriscv_intc0), irq_pending)
|
||||
#define IRQ_MASK DT_INST_REG_ADDR_BY_NAME(0, irq_mask)
|
||||
#define IRQ_PENDING DT_INST_REG_ADDR_BY_NAME(0, irq_pending)
|
||||
|
||||
#define TIMER0_IRQ DT_IRQN(DT_INST(0, litex_timer0))
|
||||
#define UART0_IRQ DT_IRQN(DT_INST(0, litex_uart0))
|
||||
|
@ -120,7 +119,7 @@ int arch_irq_is_enabled(unsigned int irq)
|
|||
return vexriscv_litex_irq_getmask() & (1 << irq);
|
||||
}
|
||||
|
||||
static int vexriscv_litex_irq_init(void)
|
||||
static int vexriscv_litex_irq_init(const struct device *dev)
|
||||
{
|
||||
__asm__ volatile ("csrrs x0, mie, %0"
|
||||
:: "r"(1 << RISCV_MACHINE_EXT_IRQ));
|
||||
|
@ -131,5 +130,5 @@ static int vexriscv_litex_irq_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(vexriscv_litex_irq_init, PRE_KERNEL_2,
|
||||
CONFIG_INTC_INIT_PRIORITY);
|
||||
DEVICE_DT_INST_DEFINE(0, vexriscv_litex_irq_init, NULL, NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue