Skip to content

Commit 7821454

Browse files
haduongquanghenrikbrixandersen
authored andcommitted
drivers: nxp_s32_canxl: support rxfifo on new SoC version s32ze
The received messages are put into the FIFO one by one in the order, the hardware will return the queue index for current message. So use the index instead of reading always from 0. Signed-off-by: Ha Duong Quang <[email protected]>
1 parent 4c16ec1 commit 7821454

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

doc/releases/release-notes-4.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ Boards & SoC Support
7979

8080
* Made these changes in other SoC series:
8181

82+
* NXP S32Z270: Added support for the new silicon cut version 2.0. Note that the previous
83+
versions (1.0 and 1.1) are no longer supported.
84+
8285
* Added support for these boards:
8386

8487
* Made these board changes:

drivers/can/can_nxp_s32_canxl.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void can_nxp_s32_config_rx_fifo_filter(const struct device *dev, int filt
167167
}
168168

169169
/* Get the RxFiFO filter matched with the received RxFIFO message queue */
170-
static inline int can_nxp_s32_get_rx_fifo_filter(struct can_nxp_s32_data *data)
170+
static inline int can_nxp_s32_get_rx_fifo_filter(struct can_nxp_s32_data *data, uint8_t queue_idx)
171171
{
172172
int alloc = -ENOSPC;
173173
uint32_t mask;
@@ -179,8 +179,8 @@ static inline int can_nxp_s32_get_rx_fifo_filter(struct can_nxp_s32_data *data)
179179
continue;
180180
}
181181

182-
if ((data->rx_fifo[0].Header.Id & mask) ==
183-
(data->rx_fifo_filter[filter_id].idAddrFilterH & mask)) {
182+
if ((data->rx_fifo[queue_idx].Header.Id & mask) ==
183+
(data->rx_fifo_filter[filter_id].idAddrFilterH & mask)) {
184184
alloc = filter_id;
185185
break;
186186
}
@@ -888,12 +888,17 @@ static void can_nxp_s32_ctrl_callback(const struct device *dev,
888888
}
889889
#ifdef CONFIG_CAN_NXP_S32_RX_FIFO
890890
} else if (eventType == CANEXCEL_EVENT_RXFIFO_COMPLETE) {
891-
alloc = can_nxp_s32_get_rx_fifo_filter(data);
891+
uint8_t queue_idx = ((config->base_rx_fifo_ctrl->RXFCSTA &
892+
CANXL_RXFIFO_CONTROL_RXFCSTA_HWPOINTER_MASK) >>
893+
CANXL_RXFIFO_CONTROL_RXFCSTA_HWPOINTER_SHIFT) -
894+
1;
895+
896+
alloc = can_nxp_s32_get_rx_fifo_filter(data, queue_idx);
892897

893898
if (alloc != -ENOSPC) {
894899
rx_func = data->rx_cbs[alloc].function;
895900
if (atomic_test_bit(data->rx_allocs, alloc)) {
896-
nxp_s32_msg_data_to_zcan_frame(data->rx_fifo[0], &frame);
901+
nxp_s32_msg_data_to_zcan_frame(data->rx_fifo[queue_idx], &frame);
897902

898903
LOG_DBG("%s: Received %d bytes Rx FiFo %d, "
899904
"Rx Id: 0x%x, "

0 commit comments

Comments
 (0)