Skip to content

Commit ed69f88

Browse files
committed
drivers: can: mcan: set TX/RX FIFO sizes based on CAN mode
Set the MCAN TX/RX FIFO sizes based on CAN_FD_MODE. This allows more efficient use of MRAM if CAN_FD_MODE is disabled. Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
1 parent b333d1f commit ed69f88

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/can/can_mcan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,7 @@ int can_mcan_configure_mram(const struct device *dev, uintptr_t mrba, uintptr_t
13771377
return err;
13781378
}
13791379

1380+
#ifdef CONFIG_CAN_FD_MODE
13801381
/* 64 byte Tx Buffer data fields size */
13811382
reg = CAN_MCAN_TXESC_TBDS;
13821383
err = can_mcan_write_reg(dev, CAN_MCAN_TXESC, reg);
@@ -1390,6 +1391,7 @@ int can_mcan_configure_mram(const struct device *dev, uintptr_t mrba, uintptr_t
13901391
if (err != 0) {
13911392
return err;
13921393
}
1394+
#endif /* CONFIG_CAN_FD_MODE */
13931395

13941396
return 0;
13951397
}

drivers/can/can_mcan.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,13 @@ struct can_mcan_rx_fifo_hdr {
937937
struct can_mcan_rx_fifo {
938938
struct can_mcan_rx_fifo_hdr hdr;
939939
union {
940+
#ifdef CONFIG_CAN_FD_MODE
940941
uint8_t data[64];
941942
uint32_t data_32[16];
943+
#else
944+
uint8_t data[8];
945+
uint32_t data_32[2];
946+
#endif
942947
};
943948
} __packed __aligned(4);
944949

@@ -978,8 +983,13 @@ struct can_mcan_tx_buffer_hdr {
978983
struct can_mcan_tx_buffer {
979984
struct can_mcan_tx_buffer_hdr hdr;
980985
union {
986+
#ifdef CONFIG_CAN_FD_MODE
981987
uint8_t data[64];
982988
uint32_t data_32[16];
989+
#else
990+
uint8_t data[8];
991+
uint32_t data_32[2];
992+
#endif
983993
};
984994
} __packed __aligned(4);
985995

0 commit comments

Comments
 (0)