@@ -30,7 +30,7 @@ static ALWAYS_INLINE void dw_ictl_dispatch_child_isrs(uint32_t intr_status,
30
30
while (intr_status ) {
31
31
intr_bitpos = find_lsb_set (intr_status ) - 1 ;
32
32
intr_status &= ~(1 << intr_bitpos );
33
- intr_offset = isr_base_offset + intr_bitpos ;
33
+ intr_offset = isr_base_offset + intr_bitpos - CONFIG_GEN_IRQ_START_VECTOR ;
34
34
_sw_isr_table [intr_offset ].isr (
35
35
_sw_isr_table [intr_offset ].arg );
36
36
}
@@ -46,6 +46,8 @@ static int dw_ictl_initialize(const struct device *dev)
46
46
regs -> irq_inten_l = 0U ;
47
47
regs -> irq_inten_h = 0U ;
48
48
49
+ config -> config_func ();
50
+
49
51
return 0 ;
50
52
}
51
53
@@ -130,34 +132,33 @@ static int dw_ictl_intr_get_line_state(const struct device *dev,
130
132
return 0 ;
131
133
}
132
134
133
- static void dw_ictl_config_irq (const struct device * dev );
134
-
135
- static const struct dw_ictl_config dw_config = {
136
- .base_addr = DT_INST_REG_ADDR (0 ),
137
- .numirqs = DT_INST_PROP (0 , num_irqs ),
138
- .isr_table_offset = CONFIG_DW_ISR_TBL_OFFSET ,
139
- .config_func = dw_ictl_config_irq ,
140
- };
141
-
142
135
static const struct irq_next_level_api dw_ictl_apis = {
143
136
.intr_enable = dw_ictl_intr_enable ,
144
137
.intr_disable = dw_ictl_intr_disable ,
145
138
.intr_get_state = dw_ictl_intr_get_state ,
146
139
.intr_get_line_state = dw_ictl_intr_get_line_state ,
147
140
};
148
141
149
- DEVICE_DT_INST_DEFINE (0 , dw_ictl_initialize , NULL ,
150
- NULL , & dw_config , PRE_KERNEL_1 ,
151
- CONFIG_DW_ICTL_INIT_PRIORITY , & dw_ictl_apis );
152
-
153
- static void dw_ictl_config_irq (const struct device * port )
154
- {
155
- IRQ_CONNECT (DT_INST_IRQN (0 ),
156
- DT_INST_IRQ (0 , priority ),
157
- dw_ictl_isr ,
158
- DEVICE_DT_INST_GET (0 ),
159
- DT_INST_IRQ (0 , sense ));
160
- }
161
-
162
- IRQ_PARENT_ENTRY_DEFINE (intc_dw , DEVICE_DT_INST_GET (0 ), DT_INST_IRQN (0 ),
163
- INTC_INST_ISR_TBL_OFFSET (0 ), DT_INST_INTC_GET_AGGREGATOR_LEVEL (0 ));
142
+ #define INTC_DW_DEVICE_INIT (inst ) \
143
+ \
144
+ static void dw_ictl_config_irq_##inst(void) \
145
+ { \
146
+ IRQ_CONNECT(DT_INST_IRQN(inst), DT_INST_IRQ(inst, priority), dw_ictl_isr, \
147
+ DEVICE_DT_INST_GET(inst), DT_INST_IRQ(inst, sense)); \
148
+ irq_enable(DT_INST_IRQN(inst)); \
149
+ } \
150
+ IRQ_PARENT_ENTRY_DEFINE(intc_dw##inst, DEVICE_DT_INST_GET(inst), DT_INST_IRQN(inst), \
151
+ INTC_INST_ISR_TBL_OFFSET(inst), \
152
+ DT_INST_INTC_GET_AGGREGATOR_LEVEL(inst)); \
153
+ \
154
+ static const struct dw_ictl_config dw_config_##inst = { \
155
+ .base_addr = DT_INST_REG_ADDR(inst), \
156
+ .numirqs = DT_INST_PROP(inst, num_irqs), \
157
+ .isr_table_offset = INTC_INST_ISR_TBL_OFFSET(inst), \
158
+ .config_func = dw_ictl_config_irq_##inst, \
159
+ }; \
160
+ \
161
+ DEVICE_DT_INST_DEFINE(inst, dw_ictl_initialize, NULL, NULL, &dw_config_##inst, \
162
+ PRE_KERNEL_1, CONFIG_DW_ICTL_INIT_PRIORITY, &dw_ictl_apis);
163
+
164
+ DT_INST_FOREACH_STATUS_OKAY (INTC_DW_DEVICE_INIT )
0 commit comments