summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoakim Zhang <qiangqing.zhang@nxp.com>2020-03-30 09:59:26 +0800
committerJoakim Zhang <qiangqing.zhang@nxp.com>2020-04-01 09:54:24 +0800
commit63138e7e44462229ddcaee0428be19e11c9827ea (patch)
treef14a42afcaab4362f35c8dcc8ada34eec1c512c7 /drivers
parent029bf5a02bcb0cc7a46b3c2f1ce2798da6dcfaf5 (diff)
MLK-23582 can: flexcan: fix TDC feature
We enable TDC feature in flexcan_set_bittiming when loopback off, but disable it by mistake after calling flexcan_set_bittiming. Acked-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/can/flexcan.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 72b2fde881ae..89c61d3dd95f 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1274,6 +1274,8 @@ static void flexcan_set_bittiming(struct net_device *dev)
/* for the TDC to work reliably, the offset has to use optimal settings */
reg_fdctrl |= FLEXCAN_FDCTRL_TDCOFF(((dbt->phase_seg1 - 1) + dbt->prop_seg + 2) *
((dbt->brp -1) + 1));
+ } else {
+ reg_fdctrl &= ~FLEXCAN_FDCTRL_TDCEN;
}
priv->write(reg_fdctrl, &regs->fdctrl);
@@ -1501,7 +1503,6 @@ static int flexcan_chip_start(struct net_device *dev)
/* FDCTRL */
if (priv->can.ctrlmode_supported & CAN_CTRLMODE_FD) {
reg_fdctrl = priv->read(&regs->fdctrl) & ~FLEXCAN_FDCTRL_FDRATE;
- reg_fdctrl &= ~FLEXCAN_FDCTRL_TDCEN;
reg_fdctrl &= ~(FLEXCAN_FDCTRL_MBDSR1(0x3) | FLEXCAN_FDCTRL_MBDSR0(0x3));
reg_mcr = priv->read(&regs->mcr) & ~FLEXCAN_MCR_FDEN;
reg_ctrl2 = priv->read(&regs->ctrl2) & ~FLEXCAN_CTRL2_ISOCANFDEN;