MLK-15046-6 can: flexcan: make MB mode store Remote frames
authorDong Aisheng <aisheng.dong@nxp.com>
Wed, 7 Jun 2017 03:19:27 +0000 (11:19 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:28:09 +0000 (15:28 -0500)
In MB transfer mode, the Remote Response Frame is generated by
default which will not store Remote Frames. That will cause MB
can't resceive Remote Frames. Let's make the Remote Request
Frame stored, then we can receive the Remote Frames and deliver
to userspaces.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
drivers/net/can/flexcan.c

index 6a377ee..d84e6ce 100644 (file)
@@ -1134,11 +1134,17 @@ static int flexcan_chip_start(struct net_device *dev)
        flexcan_mb_write(priv, FLEXCAN_TX_BUF_ID, FLEXCAN_MB_CTRL,
                         FLEXCAN_MB_CODE_TX_INACTIVE);
 
-       if (priv->mb_mode)
+       if (priv->mb_mode) {
                /* mark RX mailbox as INACTIVE */
                flexcan_mb_write(priv, FLEXCAN_RX_BUF_ID, FLEXCAN_MB_CTRL,
                                 FLEXCAN_MB_CODE_RX_EMPTY);
 
+               /* store Remote Request Frame */
+               reg_ctrl2 = flexcan_read(priv, FLEXCAN_CTRL2);
+               reg_ctrl2 |= FLEXCAN_CTRL2_RRS;
+               flexcan_write(priv, FLEXCAN_CTRL2, reg_ctrl2);
+       }
+
        /* acceptance mask/acceptance code (accept everything) */
        flexcan_write(priv, FLEXCAN_RXGMASK, 0x0);
        flexcan_write(priv, FLEXCAN_RX14MASK, 0x0);