drivers: can: mcux: flexcan: fix handling of failed RX MB reads
Fix handling of failed NXP FlexCAN RX mailbox reads. Instead of re-enabling
the RX MB in the ISR, we need to handle a failed RX MB read (e.g. due to a
busy MB bit).
@@ -731,8 +731,6 @@ static inline void mcux_flexcan_transfer_rx_idle(const struct device *dev,
function(dev, &frame, arg);
/* Setup RX message buffer to receive next message */
- FLEXCAN_SetRxMbConfig(config->base, mb,
- &data->rx_cbs[alloc].mb_config, true);
xfer.frame = &data->rx_cbs[alloc].frame;
xfer.mbIdx = mb;
status = FLEXCAN_TransferReceiveNonBlocking(config->base,
@@ -775,6 +773,9 @@ static FLEXCAN_CALLBACK(mcux_flexcan_transfer_callback)
break;
case kStatus_FLEXCAN_RxOverflow:
__fallthrough;
+ case kStatus_Fail:
+ /* If reading an RX MB failed mark it as idle to be reprocessed. */
+ __fallthrough;
case kStatus_FLEXCAN_RxIdle:
mcux_flexcan_transfer_rx_idle(data->dev, mb);
break;
