Skip to content

Commit f0b0a2d

Browse files
committed
Merge tag 'linux-can-fixes-for-5.10-20201118' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2020-11-18 Jimmy Assarsson provides two patches for the kvaser_pciefd and kvaser_usb drivers, where the can_bittiming_const are fixed. The next patch is by me and fixes an erroneous flexcan_transceiver_enable() during bus-off recovery in the flexcan driver. Jarkko Nikula's patch for the m_can driver fixes the IRQ handler to only process the interrupts if the device is not suspended. * tag 'linux-can-fixes-for-5.10-20201118' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: can: m_can: process interrupt only when not runtime suspended can: flexcan: flexcan_chip_start(): fix erroneous flexcan_transceiver_enable() during bus-off recovery can: kvaser_usb: kvaser_usb_hydra: Fix KCAN bittiming limits can: kvaser_pciefd: Fix KCAN bittiming limits ==================== Link: https://lore.kernel.org/r/20201118160414.2731659-1-mkl@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 6d9c8d1 + a1f6344 commit f0b0a2d

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

drivers/net/can/flexcan.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,14 +1567,10 @@ static int flexcan_chip_start(struct net_device *dev)
15671567
priv->write(reg_ctrl2, &regs->ctrl2);
15681568
}
15691569

1570-
err = flexcan_transceiver_enable(priv);
1571-
if (err)
1572-
goto out_chip_disable;
1573-
15741570
/* synchronize with the can bus */
15751571
err = flexcan_chip_unfreeze(priv);
15761572
if (err)
1577-
goto out_transceiver_disable;
1573+
goto out_chip_disable;
15781574

15791575
priv->can.state = CAN_STATE_ERROR_ACTIVE;
15801576

@@ -1592,8 +1588,6 @@ static int flexcan_chip_start(struct net_device *dev)
15921588

15931589
return 0;
15941590

1595-
out_transceiver_disable:
1596-
flexcan_transceiver_disable(priv);
15971591
out_chip_disable:
15981592
flexcan_chip_disable(priv);
15991593
return err;
@@ -1623,7 +1617,6 @@ static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error)
16231617
priv->write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
16241618
&regs->ctrl);
16251619

1626-
flexcan_transceiver_disable(priv);
16271620
priv->can.state = CAN_STATE_STOPPED;
16281621

16291622
return 0;
@@ -1665,10 +1658,14 @@ static int flexcan_open(struct net_device *dev)
16651658
if (err)
16661659
goto out_runtime_put;
16671660

1668-
err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev);
1661+
err = flexcan_transceiver_enable(priv);
16691662
if (err)
16701663
goto out_close;
16711664

1665+
err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev);
1666+
if (err)
1667+
goto out_transceiver_disable;
1668+
16721669
if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
16731670
priv->mb_size = sizeof(struct flexcan_mb) + CANFD_MAX_DLEN;
16741671
else
@@ -1720,6 +1717,8 @@ static int flexcan_open(struct net_device *dev)
17201717
can_rx_offload_del(&priv->offload);
17211718
out_free_irq:
17221719
free_irq(dev->irq, dev);
1720+
out_transceiver_disable:
1721+
flexcan_transceiver_disable(priv);
17231722
out_close:
17241723
close_candev(dev);
17251724
out_runtime_put:
@@ -1738,6 +1737,7 @@ static int flexcan_close(struct net_device *dev)
17381737

17391738
can_rx_offload_del(&priv->offload);
17401739
free_irq(dev->irq, dev);
1740+
flexcan_transceiver_disable(priv);
17411741

17421742
close_candev(dev);
17431743
pm_runtime_put(priv->dev);

drivers/net/can/kvaser_pciefd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ struct kvaser_pciefd_tx_packet {
287287
static const struct can_bittiming_const kvaser_pciefd_bittiming_const = {
288288
.name = KVASER_PCIEFD_DRV_NAME,
289289
.tseg1_min = 1,
290-
.tseg1_max = 255,
290+
.tseg1_max = 512,
291291
.tseg2_min = 1,
292292
.tseg2_max = 32,
293293
.sjw_max = 16,
294294
.brp_min = 1,
295-
.brp_max = 4096,
295+
.brp_max = 8192,
296296
.brp_inc = 1,
297297
};
298298

drivers/net/can/m_can/m_can.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,8 @@ static irqreturn_t m_can_isr(int irq, void *dev_id)
956956
struct net_device_stats *stats = &dev->stats;
957957
u32 ir;
958958

959+
if (pm_runtime_suspended(cdev->dev))
960+
return IRQ_NONE;
959961
ir = m_can_read(cdev, M_CAN_IR);
960962
if (!ir)
961963
return IRQ_NONE;

drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static const struct can_bittiming_const kvaser_usb_hydra_kcan_bittiming_c = {
367367
.tseg2_max = 32,
368368
.sjw_max = 16,
369369
.brp_min = 1,
370-
.brp_max = 4096,
370+
.brp_max = 8192,
371371
.brp_inc = 1,
372372
};
373373

0 commit comments

Comments
 (0)