can: ifi: Fix transmitter delay calculation
authorMarek Vasut <marex@denx.de>
Fri, 10 Nov 2017 10:22:39 +0000 (11:22 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 10 Nov 2017 10:35:09 +0000 (11:35 +0100)
The CANFD transmitter delay calculation formula was updated in the
latest software drop from IFI and improves the behavior of the IFI
CANFD core during bitrate switching. Use the new formula to improve
stability of the CANFD operation.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Markus Marb <markus@marb.org>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/ifi_canfd/ifi_canfd.c

index 4d1fe8d9504234f436a0b9dd739b41089f563225..2772d05ff11caafbdf074aebccd32b415feae0c4 100644 (file)
@@ -670,9 +670,9 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev)
               priv->base + IFI_CANFD_FTIME);
 
        /* Configure transmitter delay */
-       tdc = (dbt->brp * (dbt->phase_seg1 + 1)) & IFI_CANFD_TDELAY_MASK;
-       writel(IFI_CANFD_TDELAY_EN | IFI_CANFD_TDELAY_ABS | tdc,
-              priv->base + IFI_CANFD_TDELAY);
+       tdc = dbt->brp * (dbt->prop_seg + dbt->phase_seg1);
+       tdc &= IFI_CANFD_TDELAY_MASK;
+       writel(IFI_CANFD_TDELAY_EN | tdc, priv->base + IFI_CANFD_TDELAY);
 }
 
 static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id,