Skip to content

Commit 5b19fcd

Browse files
raffi-gcarlescufi
authored andcommitted
riscv: irq: Add trigger_irq function for clic
In a clic the mip register does not exist and software irq are triggered in the clicintip register. Signed-off-by: Greter Raffael <[email protected]>
1 parent 899ee68 commit 5b19fcd

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

drivers/interrupt_controller/intc_nuclei_eclic.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ void riscv_clic_irq_priority_set(uint32_t irq, uint32_t pri, uint32_t flags)
171171
ECLIC_CTRL[irq].INTATTR = intattr;
172172
}
173173

174+
/**
175+
* @brief Set pending bit of an interrupt
176+
*/
177+
void riscv_clic_irq_set_pending(uint32_t irq)
178+
{
179+
ECLIC_CTRL[irq].INTIP.b.IP = 1;
180+
}
181+
174182
static int nuclei_eclic_init(const struct device *dev)
175183
{
176184
/* check hardware support required interrupt levels */

subsys/testsuite/include/zephyr/interrupt_util.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ static inline void trigger_irq(int irq)
166166
}
167167

168168
#elif defined(CONFIG_RISCV)
169+
#if defined(CONFIG_NUCLEI_ECLIC)
170+
void riscv_clic_irq_set_pending(uint32_t irq);
171+
static inline void trigger_irq(int irq)
172+
{
173+
riscv_clic_irq_set_pending(irq);
174+
}
175+
#else
169176
static inline void trigger_irq(int irq)
170177
{
171178
uint32_t mip;
@@ -174,7 +181,7 @@ static inline void trigger_irq(int irq)
174181
: "=r" (mip)
175182
: "r" (1 << irq));
176183
}
177-
184+
#endif
178185
#elif defined(CONFIG_XTENSA)
179186
static inline void trigger_irq(int irq)
180187
{

0 commit comments

Comments
 (0)