]> git.baikalelectronics.ru Git - kernel.git/commitdiff
can: ifi: Treat CAN_CTRLMODE_FD_NON_ISO correctly
authorMarek Vasut <marex@denx.de>
Sat, 7 May 2016 22:34:14 +0000 (00:34 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 9 May 2016 09:07:28 +0000 (11:07 +0200)
The CAN_CTRLMODE_FD flag is set for both ISO and BOSCH CANFD mode,
while the CAN_CTRLMODE_FD_NON_ISO is additional flag which is only
set for CANFD-BOSCH mode. Fix the handling of the flags to reflect
this.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/ifi_canfd/ifi_canfd.c

index 30dc3b676627656f24b4c8d5d74d05d58607dd99..5bd95dd5cb88d03c9ab87712c0a11fe0ddf921de 100644 (file)
@@ -644,10 +644,11 @@ static void ifi_canfd_start(struct net_device *ndev)
        if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)
                stcmd |= IFI_CANFD_STCMD_LOOPBACK;
 
-       if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
+       if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) &&
+           !(priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO))
                stcmd |= IFI_CANFD_STCMD_ENABLE_ISO;
 
-       if (!(priv->can.ctrlmode & (CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO)))
+       if (!(priv->can.ctrlmode & CAN_CTRLMODE_FD))
                stcmd |= IFI_CANFD_STCMD_DISABLE_CANFD;
 
        priv->can.state = CAN_STATE_ERROR_ACTIVE;