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:
Henrik Brix Andersen 2023-06-01 11:15:08 +02:00 committed by Anas Nashif
commit bb513c974b

View file

@ -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;