Skip to content

Commit c768144

Browse files
khoa-nguyen-18kartben
authored andcommitted
drivers: Correct value of event macro for all Renesas SoC
Since the RA2L1 uses the macro "ICU_EVENT" instead of "ELC_EVENT" (which is currently used) to input into the IELSR register, the ek_ra2l1 board cannot assign any interrupts for any driver. This commit aim to correct the Event macro to input correct value for IELSR register on all the Renesas SoC by using "BSP_PRV_IELS_ENUM" macro. Signed-off-by: Khoa Nguyen <[email protected]>
1 parent cd06e80 commit c768144

File tree

16 files changed

+112
-141
lines changed

16 files changed

+112
-141
lines changed

drivers/adc/adc_renesas_ra.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -319,11 +319,12 @@ static int adc_ra_init(const struct device *dev)
319319
return 0;
320320
}
321321

322+
#define EVENT_ADC_SCAN_END(idx) BSP_PRV_IELS_ENUM(CONCAT(EVENT_ADC, idx, _SCAN_END))
323+
322324
#define IRQ_CONFIGURE_FUNC(idx) \
323325
static void adc_ra_configure_func_##idx(void) \
324326
{ \
325-
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(idx, scanend, irq)] = \
326-
ELC_EVENT_ADC##idx##_SCAN_END; \
327+
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(idx, scanend, irq)] = EVENT_ADC_SCAN_END(idx); \
327328
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(idx, scanend, irq), \
328329
DT_INST_IRQ_BY_NAME(idx, scanend, priority), adc_ra_isr, \
329330
DEVICE_DT_INST_GET(idx), 0); \

drivers/can/can_renesas_ra.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,8 @@ static DEVICE_API(can, can_renesas_ra_driver_api) = {
10111011
};
10121012

10131013
#define CAN_RENESAS_RA_GLOBAL_IRQ_INIT() \
1014-
R_ICU->IELSR_b[VECTOR_NUMBER_CAN_GLERR].IELS = ELC_EVENT_CAN_GLERR; \
1015-
R_ICU->IELSR_b[VECTOR_NUMBER_CAN_RXF].IELS = ELC_EVENT_CAN_RXF; \
1014+
R_ICU->IELSR_b[VECTOR_NUMBER_CAN_GLERR].IELS = BSP_PRV_IELS_ENUM(EVENT_CAN_GLERR); \
1015+
R_ICU->IELSR_b[VECTOR_NUMBER_CAN_RXF].IELS = BSP_PRV_IELS_ENUM(EVENT_CAN_RXF); \
10161016
IRQ_CONNECT(VECTOR_NUMBER_CAN_GLERR, \
10171017
DT_IRQ_BY_NAME(DT_INST(0, renesas_ra_canfd_global), glerr, priority), \
10181018
canfd_error_isr, NULL, 0); \
@@ -1074,22 +1074,18 @@ DEVICE_DT_DEFINE(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), can_ren
10741074
NULL, NULL, &g_can_renesas_ra_global_cfg, PRE_KERNEL_2, CONFIG_CAN_INIT_PRIORITY,
10751075
NULL)
10761076

1077-
#define _ELC_EVENT_CAN_COMFRX(channel) ELC_EVENT_CAN##channel##_COMFRX
1078-
#define _ELC_EVENT_CAN_TX(channel) ELC_EVENT_CAN##channel##_TX
1079-
#define _ELC_EVENT_CAN_CHERR(channel) ELC_EVENT_CAN##channel##_CHERR
1080-
1081-
#define ELC_EVENT_CAN_COMFRX(channel) _ELC_EVENT_CAN_COMFRX(channel)
1082-
#define ELC_EVENT_CAN_TX(channel) _ELC_EVENT_CAN_TX(channel)
1083-
#define ELC_EVENT_CAN_CHERR(channel) _ELC_EVENT_CAN_CHERR(channel)
1077+
#define EVENT_CAN_COMFRX(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_CAN, channel, _COMFRX))
1078+
#define EVENT_CAN_TX(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_CAN, channel, _TX))
1079+
#define EVENT_CAN_CHERR(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_CAN, channel, _CHERR))
10841080

10851081
#define CAN_RENESAS_RA_CHANNEL_IRQ_INIT(index) \
10861082
{ \
10871083
R_ICU->IELSR_b[DT_INST_IRQ_BY_NAME(index, rx, irq)].IELS = \
1088-
ELC_EVENT_CAN_COMFRX(DT_INST_PROP(index, channel)); \
1084+
EVENT_CAN_COMFRX(DT_INST_PROP(index, channel)); \
10891085
R_ICU->IELSR_b[DT_INST_IRQ_BY_NAME(index, tx, irq)].IELS = \
1090-
ELC_EVENT_CAN_TX(DT_INST_PROP(index, channel)); \
1086+
EVENT_CAN_TX(DT_INST_PROP(index, channel)); \
10911087
R_ICU->IELSR_b[DT_INST_IRQ_BY_NAME(index, err, irq)].IELS = \
1092-
ELC_EVENT_CAN_CHERR(DT_INST_PROP(index, channel)); \
1088+
EVENT_CAN_CHERR(DT_INST_PROP(index, channel)); \
10931089
\
10941090
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, rx, irq), \
10951091
DT_INST_IRQ_BY_NAME(index, rx, priority), canfd_common_fifo_rx_isr, \

drivers/counter/counter_renesas_ra_agt.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -535,11 +535,8 @@ static DEVICE_API(counter, ra_agt_driver_api) = {
535535

536536
#define TIMER(idx) DT_INST_PARENT(idx)
537537

538-
#define _ELC_EVENT_AGT_INT(channel) ELC_EVENT_AGT##channel##_INT
539-
#define _ELC_EVENT_AGT_COMPARE_A(channel) ELC_EVENT_AGT##channel##_COMPARE_A
540-
541-
#define ELC_EVENT_AGT_INT(channel) _ELC_EVENT_AGT_INT(channel)
542-
#define ELC_EVENT_AGT_COMPARE_A(channel) _ELC_EVENT_AGT_COMPARE_A(channel)
538+
#define EVENT_AGT_INT(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_AGT, channel, _INT))
539+
#define EVENT_AGT_COMPARE_A(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_AGT, channel, _COMPARE_A))
543540

544541
#define AGT_DEVICE_INIT_RA(n) \
545542
static const struct counter_ra_agt_config ra_agt_config_##n = { \
@@ -570,14 +567,14 @@ static DEVICE_API(counter, ra_agt_driver_api) = {
570567
static int counter_ra_agt_##n##_init(const struct device *dev) \
571568
{ \
572569
R_ICU->IELSR[DT_IRQ_BY_NAME(TIMER(n), agti, irq)] = \
573-
ELC_EVENT_AGT_INT(DT_PROP(TIMER(n), channel)); \
570+
EVENT_AGT_INT(DT_PROP(TIMER(n), channel)); \
574571
IRQ_CONNECT(DT_IRQ_BY_NAME(TIMER(n), agti, irq), \
575572
DT_IRQ_BY_NAME(TIMER(n), agti, priority), counter_ra_agt_agti_isr, \
576573
DEVICE_DT_INST_GET(n), 0); \
577574
irq_enable(DT_IRQ_BY_NAME(TIMER(n), agti, irq)); \
578575
\
579576
R_ICU->IELSR[DT_IRQ_BY_NAME(TIMER(n), agtcmai, irq)] = \
580-
ELC_EVENT_AGT_COMPARE_A(DT_PROP(TIMER(n), channel)); \
577+
EVENT_AGT_COMPARE_A(DT_PROP(TIMER(n), channel)); \
581578
IRQ_CONNECT(DT_IRQ_BY_NAME(TIMER(n), agtcmai, irq), \
582579
DT_IRQ_BY_NAME(TIMER(n), agtcmai, priority), \
583580
counter_ra_agt_agtcmai_isr, DEVICE_DT_INST_GET(n), 0); \

drivers/display/display_renesas_ra.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -275,7 +275,8 @@ static int display_init(const struct device *dev)
275275
#define IRQ_CONFIGURE_FUNC(id) \
276276
static void glcdc_renesas_ra_configure_func_##id(void) \
277277
{ \
278-
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(id, line, irq)] = ELC_EVENT_GLCDC_LINE_DETECT; \
278+
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(id, line, irq)] = \
279+
BSP_PRV_IELS_ENUM(EVENT_GLCDC_LINE_DETECT); \
279280
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(id, line, irq), \
280281
DT_INST_IRQ_BY_NAME(id, line, priority), renesas_ra_glcdc_isr, \
281282
DEVICE_DT_INST_GET(id), 0); \

drivers/ethernet/eth_renesas_ra.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -370,7 +370,7 @@ static void renesas_ra_eth_thread(void *p1, void *p2, void *p3)
370370
}
371371
}
372372

373-
#define ELC_EVENT_EDMAC_EINT(channel) ELC_EVENT_EDMAC##channel##_EINT
373+
#define EVENT_EDMAC_EINT(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_EDMAC, channel, _EINT))
374374

375375
/* Bindings to the platform */
376376
int renesas_ra_eth_init(const struct device *dev)
@@ -391,7 +391,7 @@ int renesas_ra_eth_init(const struct device *dev)
391391
return -EINVAL;
392392
}
393393

394-
R_ICU->IELSR[DT_INST_IRQN(0)] = ELC_EVENT_EDMAC_EINT(0);
394+
R_ICU->IELSR[DT_INST_IRQN(0)] = EVENT_EDMAC_EINT(0);
395395

396396
IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), renesas_ra_eth_isr,
397397
DEVICE_DT_INST_GET(0), 0);

drivers/flash/flash_hp_ra.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -378,8 +378,10 @@ static void flash_controller_ra_irq_config_func(const struct device *dev)
378378
{
379379
ARG_UNUSED(dev);
380380

381-
R_ICU->IELSR[DT_IRQ_BY_NAME(DT_DRV_INST(0), frdyi, irq)] = ELC_EVENT_FCU_FRDYI;
382-
R_ICU->IELSR[DT_IRQ_BY_NAME(DT_DRV_INST(0), fiferr, irq)] = ELC_EVENT_FCU_FIFERR;
381+
R_ICU->IELSR[DT_IRQ_BY_NAME(DT_DRV_INST(0), frdyi, irq)] =
382+
BSP_PRV_IELS_ENUM(EVENT_FCU_FRDYI);
383+
R_ICU->IELSR[DT_IRQ_BY_NAME(DT_DRV_INST(0), fiferr, irq)] =
384+
BSP_PRV_IELS_ENUM(EVENT_FCU_FIFERR);
383385

384386
IRQ_CONNECT(DT_IRQ_BY_NAME(DT_DRV_INST(0), frdyi, irq),
385387
DT_IRQ_BY_NAME(DT_DRV_INST(0), frdyi, priority), fcu_frdyi_isr,

drivers/i2c/i2c_renesas_ra_iic.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -479,15 +479,10 @@ static DEVICE_API(i2c, i2c_ra_iic_driver_api) = {
479479
.transfer = i2c_ra_iic_transfer,
480480
};
481481

482-
#define _ELC_EVENT_IIC_RXI(channel) ELC_EVENT_IIC##channel##_RXI
483-
#define _ELC_EVENT_IIC_TXI(channel) ELC_EVENT_IIC##channel##_TXI
484-
#define _ELC_EVENT_IIC_TEI(channel) ELC_EVENT_IIC##channel##_TEI
485-
#define _ELC_EVENT_IIC_ERI(channel) ELC_EVENT_IIC##channel##_ERI
486-
487-
#define ELC_EVENT_IIC_RXI(channel) _ELC_EVENT_IIC_RXI(channel)
488-
#define ELC_EVENT_IIC_TXI(channel) _ELC_EVENT_IIC_TXI(channel)
489-
#define ELC_EVENT_IIC_TEI(channel) _ELC_EVENT_IIC_TEI(channel)
490-
#define ELC_EVENT_IIC_ERI(channel) _ELC_EVENT_IIC_ERI(channel)
482+
#define EVENT_IIC_RXI(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_IIC, channel, _RXI))
483+
#define EVENT_IIC_TXI(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_IIC, channel, _TXI))
484+
#define EVENT_IIC_TEI(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_IIC, channel, _TEI))
485+
#define EVENT_IIC_ERI(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_IIC, channel, _ERI))
491486

492487
#define I2C_RA_IIC_INIT(index) \
493488
\
@@ -496,13 +491,13 @@ static DEVICE_API(i2c, i2c_ra_iic_driver_api) = {
496491
static void i2c_ra_iic_irq_config_func##index(const struct device *dev) \
497492
{ \
498493
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(index, rxi, irq)] = \
499-
ELC_EVENT_IIC_RXI(DT_INST_PROP(index, channel)); \
494+
EVENT_IIC_RXI(DT_INST_PROP(index, channel)); \
500495
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(index, txi, irq)] = \
501-
ELC_EVENT_IIC_TXI(DT_INST_PROP(index, channel)); \
496+
EVENT_IIC_TXI(DT_INST_PROP(index, channel)); \
502497
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(index, tei, irq)] = \
503-
ELC_EVENT_IIC_TEI(DT_INST_PROP(index, channel)); \
498+
EVENT_IIC_TEI(DT_INST_PROP(index, channel)); \
504499
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(index, eri, irq)] = \
505-
ELC_EVENT_IIC_ERI(DT_INST_PROP(index, channel)); \
500+
EVENT_IIC_ERI(DT_INST_PROP(index, channel)); \
506501
\
507502
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, rxi, irq), \
508503
DT_INST_IRQ_BY_NAME(index, rxi, priority), iic_master_rxi_isr, \

drivers/mipi_dsi/dsi_renesas_ra.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -211,12 +211,14 @@ static int mipi_dsi_renesas_ra_init(const struct device *dev)
211211
#define IRQ_CONFIGURE_FUNC(id) \
212212
static void mipi_dsi_ra_configure_func_##id(void) \
213213
{ \
214-
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(id, sq0, irq)] = ELC_EVENT_MIPIDSI_SEQ0; \
214+
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(id, sq0, irq)] = \
215+
BSP_PRV_IELS_ENUM(EVENT_MIPIDSI_SEQ0); \
215216
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(id, sq0, irq), \
216217
DT_INST_IRQ_BY_NAME(id, sq0, priority), mipi_dsi_seq0, \
217218
DEVICE_DT_INST_GET(id), 0); \
218219
irq_enable(DT_INST_IRQ_BY_NAME(id, sq0, irq)); \
219-
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(id, ferr, irq)] = ELC_EVENT_MIPIDSI_FERR; \
220+
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(id, ferr, irq)] = \
221+
BSP_PRV_IELS_ENUM(EVENT_MIPIDSI_FERR); \
220222
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(id, ferr, irq), \
221223
DT_INST_IRQ_BY_NAME(id, ferr, priority), mipi_dsi_ferr, \
222224
DEVICE_DT_INST_GET(id), 0); \

drivers/misc/renesas_ra_external_interrupt/renesas_ra_external_interrupt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -152,7 +152,7 @@ static int gpio_ra_interrupt_init(const struct device *dev)
152152
static int gpio_ra_irq_init##index(const struct device *dev) \
153153
{ \
154154
R_ICU->IELSR[DT_INST_IRQ(index, irq)] = \
155-
UTIL_CAT(ELC_EVENT_ICU_IRQ, DT_INST_PROP(index, channel)); \
155+
BSP_PRV_IELS_ENUM(UTIL_CAT(EVENT_ICU_IRQ, DT_INST_PROP(index, channel))); \
156156
IRQ_CONNECT(DT_INST_IRQ(index, irq), DT_INST_IRQ(index, priority), gpio_ra_isr, \
157157
DEVICE_DT_INST_GET(index), 0); \
158158
return gpio_ra_interrupt_init(dev); \

drivers/pwm/pwm_renesas_ra.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Renesas Electronics Corporation
2+
* Copyright (c) 2024-2025 Renesas Electronics Corporation
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -485,11 +485,10 @@ static int pwm_renesas_ra_init(const struct device *dev)
485485
return 0;
486486
}
487487

488-
#define _ELC_EVENT_GPT_CAPTURE_COMPARE_A(channel) ELC_EVENT_GPT##channel##_CAPTURE_COMPARE_A
489-
#define _ELC_EVENT_GPT_COUNTER_OVERFLOW(channel) ELC_EVENT_GPT##channel##_COUNTER_OVERFLOW
490-
491-
#define ELC_EVENT_GPT_CAPTURE_COMPARE_A(channel) _ELC_EVENT_GPT_CAPTURE_COMPARE_A(channel)
492-
#define ELC_EVENT_GPT_COUNTER_OVERFLOW(channel) _ELC_EVENT_GPT_COUNTER_OVERFLOW(channel)
488+
#define EVENT_GPT_CAPTURE_COMPARE_A(channel) \
489+
BSP_PRV_IELS_ENUM(CONCAT(EVENT_GPT, channel, _CAPTURE_COMPARE_A))
490+
#define EVENT_GPT_COUNTER_OVERFLOW(channel) \
491+
BSP_PRV_IELS_ENUM(CONCAT(EVENT_GPT, channel, _COUNTER_OVERFLOW))
493492

494493
#ifdef CONFIG_PWM_CAPTURE
495494
#define PWM_RA_IRQ_CONFIG_INIT(index) \
@@ -546,8 +545,8 @@ static int pwm_renesas_ra_init(const struct device *dev)
546545
.cycle_end_irq = DT_INST_IRQ_BY_NAME(index, overflow, irq), \
547546
}, \
548547
.extend_cfg = g_timer1_extend_##index, \
549-
.capture_a_event = ELC_EVENT_GPT_CAPTURE_COMPARE_A(DT_INST_PROP(index, channel)), \
550-
.overflow_event = ELC_EVENT_GPT_COUNTER_OVERFLOW(DT_INST_PROP(index, channel)), \
548+
.capture_a_event = EVENT_GPT_CAPTURE_COMPARE_A(DT_INST_PROP(index, channel)), \
549+
.overflow_event = EVENT_GPT_COUNTER_OVERFLOW(DT_INST_PROP(index, channel)), \
551550
}; \
552551
static const struct pwm_renesas_ra_config pwm_renesas_ra_config_##index = { \
553552
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \

0 commit comments

Comments
 (0)