drivers: can: mcan: fix IRQ acknowledge
Change the Bosch M_CAN ISRs to only acknowledge the IRQs handled in the given loop iteration (and not all IRQs supported by the given ISR) and move IRQ acknowledge to the front of the ISRs. Fixes: #58631 Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
44e691e20e
commit
bb513c974b
1 changed files with 10 additions and 10 deletions
|
@ -540,6 +540,11 @@ void can_mcan_line_0_isr(const struct device *dev)
|
|||
}
|
||||
|
||||
while ((ir & events) != 0U) {
|
||||
err = can_mcan_write_reg(dev, CAN_MCAN_IR, ir & events);
|
||||
if (err != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ir & (CAN_MCAN_IR_BO | CAN_MCAN_IR_EP | CAN_MCAN_IR_EW)) != 0U) {
|
||||
can_mcan_state_change_handler(dev);
|
||||
}
|
||||
|
@ -562,11 +567,6 @@ void can_mcan_line_0_isr(const struct device *dev)
|
|||
LOG_ERR("Message RAM access failure");
|
||||
}
|
||||
|
||||
err = can_mcan_write_reg(dev, CAN_MCAN_IR, events);
|
||||
if (err != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = can_mcan_read_reg(dev, CAN_MCAN_IR, &ir);
|
||||
if (err != 0) {
|
||||
return;
|
||||
|
@ -721,6 +721,11 @@ void can_mcan_line_1_isr(const struct device *dev)
|
|||
}
|
||||
|
||||
while ((ir & events) != 0U) {
|
||||
err = can_mcan_write_reg(dev, CAN_MCAN_IR, events & ir);
|
||||
if (err != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ir & CAN_MCAN_IR_RF0N) != 0U) {
|
||||
LOG_DBG("RX FIFO0 INT");
|
||||
can_mcan_get_message(dev, config->mram_offsets[CAN_MCAN_MRAM_CFG_RX_FIFO0],
|
||||
|
@ -741,11 +746,6 @@ void can_mcan_line_1_isr(const struct device *dev)
|
|||
LOG_ERR("Message lost on FIFO1");
|
||||
}
|
||||
|
||||
err = can_mcan_write_reg(dev, CAN_MCAN_IR, events);
|
||||
if (err != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = can_mcan_read_reg(dev, CAN_MCAN_IR, &ir);
|
||||
if (err != 0) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue