drivers: can: mcux: Fix can_detach
The detach function didn't call FLEXCAN_TransferAbortReceive. The state of the mailbox after detaching was still kFLEXCAN_StateRxData and therefore a new filter couldn't be attached. This PR calls FLEXCAN_TransferAbortReceive and releases the mailbox. Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
parent
41c36b7cd6
commit
4c8901869c
1 changed files with 6 additions and 0 deletions
|
@ -296,17 +296,23 @@ static void mcux_flexcan_detach(struct device *dev, int filter_id)
|
|||
struct mcux_flexcan_data *data = dev->driver_data;
|
||||
|
||||
if (filter_id >= MCUX_FLEXCAN_MAX_RX) {
|
||||
LOG_ERR("Detach: Filter id >= MAX_RX (%d >= %d)", filter_id,
|
||||
MCUX_FLEXCAN_MAX_RX);
|
||||
return;
|
||||
}
|
||||
|
||||
k_mutex_lock(&data->rx_mutex, K_FOREVER);
|
||||
|
||||
if (atomic_test_and_clear_bit(data->rx_allocs, filter_id)) {
|
||||
FLEXCAN_TransferAbortReceive(config->base, &data->handle,
|
||||
ALLOC_IDX_TO_RXMB_IDX(filter_id));
|
||||
FLEXCAN_SetRxMbConfig(config->base,
|
||||
ALLOC_IDX_TO_RXMB_IDX(filter_id), NULL,
|
||||
false);
|
||||
data->rx_cbs[filter_id].function = NULL;
|
||||
data->rx_cbs[filter_id].arg = NULL;
|
||||
} else {
|
||||
LOG_WRN("Filter ID %d already detached", filter_id);
|
||||
}
|
||||
|
||||
k_mutex_unlock(&data->rx_mutex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue