File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,19 @@ config CAN_MCHP_MSS
7
7
help
8
8
This option enables the CAN driver for Microchip's PolarFire SoC
9
9
platform.
10
+
11
+ if CAN_MCHP_MSS
12
+
13
+ config CAN_MCHP_MSS_SWAP_ENDIANNESS
14
+ bool "Force little endian on transmit and receive buffers."
15
+ default n
16
+ help
17
+ This option sets the SWAP_ENDIAN bit of CAN_CONFIG register.
18
+ By setting this bit, the values of [TX|RX]_MSGx_DATA_[LOW|HIGH]
19
+ will operate in little endian mode. For example, either field set
20
+ to 0x01020304 will result in 0x01 -> 0x02 -> 0x03 -> 0x04 being written on the bus.
21
+
22
+ Conversely, when operating in the (default) big endian mode, the inverse
23
+ sequence will be transmitted on the bus, i.e. in network order.
24
+
25
+ endif # CAN_MCHP_MSS
Original file line number Diff line number Diff line change @@ -269,6 +269,14 @@ static int mss_can_reset(const struct device *dev)
269
269
mss_can_stop_and_disable_interrupts (reg_base );
270
270
BUILD_ASSERT (MSS_CAN_TX_MSG_COUNT == MSS_CAN_RX_MSG_COUNT );
271
271
272
+ uint32_t can_config = sys_read32 (reg_base + MSS_CAN_CONFIG );
273
+ #if CONFIG_CAN_MCHP_MSS_SWAP_ENDIANNESS
274
+ can_config |= MSS_CAN_CFG_SWAP_ENDIAN ;
275
+ #else
276
+ can_config &= ~MSS_CAN_CFG_SWAP_ENDIAN ;
277
+ #endif
278
+ sys_write32 (can_config , reg_base + MSS_CAN_CONFIG );
279
+
272
280
for (uintptr_t i = 0 ; i < MSS_CAN_TX_MSG_COUNT ; ++ i ) {
273
281
/* Clear transmit buffer */
274
282
uintptr_t tx_msg_base = reg_base + MSS_CAN_TX_MSG (i );
You can’t perform that action at this time.
0 commit comments