Commit 36f6b72c authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge tag 'linux-can-fixes-for-6.11-20240912' of...

Merge tag 'linux-can-fixes-for-6.11-20240912' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2024-09-12

Kuniyuki Iwashima's patch fixes an incomplete bug fix in the CAN BCM
protocol, which was introduced during v6.11.

A patch by Stefan Mätje removes the unsupported CAN_CTRLMODE_3_SAMPLES
mode for CAN-USB/3-FD devices in the esd_usb driver.

The next patch is by Martin Jocic and enables 64-bit DMA addressing
for the kvaser_pciefd driver.

The last two patches both affect the m_can driver. Jake Hamby's patch
activates NAPI before interrupts are activated, a patch by me moves
the stopping of the clock after the device has been shut down.

* tag 'linux-can-fixes-for-6.11-20240912' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
  can: m_can: m_can_close(): stop clocks after device has been shut down
  can: m_can: enable NAPI before enabling interrupts
  can: kvaser_pciefd: Enable 64-bit DMA addressing
  can: esd_usb: Remove CAN_CTRLMODE_3_SAMPLES for CAN-USB/3-FD
  can: bcm: Clear bo->bcm_proc_read after remove_proc_entry().
====================

Link: https://patch.msgid.link/20240912075804.2825408-1-mkl@pengutronix.de


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 04ccecfa 717338e2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1104,6 +1104,9 @@ static int kvaser_pciefd_setup_dma(struct kvaser_pciefd *pcie)

	/* Disable the DMA */
	iowrite32(0, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CTRL_REG);

	dma_set_mask_and_coherent(&pcie->pci->dev, DMA_BIT_MASK(64));

	for (i = 0; i < KVASER_PCIEFD_DMA_COUNT; i++) {
		pcie->dma_data[i] = dmam_alloc_coherent(&pcie->pci->dev,
							KVASER_PCIEFD_DMA_SIZE,
+7 −7
Original line number Diff line number Diff line
@@ -1763,11 +1763,7 @@ static int m_can_close(struct net_device *dev)

	netif_stop_queue(dev);

	if (!cdev->is_peripheral)
		napi_disable(&cdev->napi);

	m_can_stop(dev);
	m_can_clk_stop(cdev);
	free_irq(dev->irq, dev);

	m_can_clean(dev);
@@ -1776,10 +1772,13 @@ static int m_can_close(struct net_device *dev)
		destroy_workqueue(cdev->tx_wq);
		cdev->tx_wq = NULL;
		can_rx_offload_disable(&cdev->offload);
	} else {
		napi_disable(&cdev->napi);
	}

	close_candev(dev);

	m_can_clk_stop(cdev);
	phy_power_off(cdev->transceiver);

	return 0;
@@ -2030,6 +2029,8 @@ static int m_can_open(struct net_device *dev)

	if (cdev->is_peripheral)
		can_rx_offload_enable(&cdev->offload);
	else
		napi_enable(&cdev->napi);

	/* register interrupt handler */
	if (cdev->is_peripheral) {
@@ -2063,9 +2064,6 @@ static int m_can_open(struct net_device *dev)
	if (err)
		goto exit_start_fail;

	if (!cdev->is_peripheral)
		napi_enable(&cdev->napi);

	netif_start_queue(dev);

	return 0;
@@ -2079,6 +2077,8 @@ static int m_can_open(struct net_device *dev)
out_wq_fail:
	if (cdev->is_peripheral)
		can_rx_offload_disable(&cdev->offload);
	else
		napi_disable(&cdev->napi);
	close_candev(dev);
exit_disable_clks:
	m_can_clk_stop(cdev);
+1 −5
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * CAN driver for esd electronics gmbh CAN-USB/2, CAN-USB/3 and CAN-USB/Micro
 *
 * Copyright (C) 2010-2012 esd electronic system design gmbh, Matthias Fuchs <socketcan@esd.eu>
 * Copyright (C) 2022-2023 esd electronics gmbh, Frank Jungclaus <frank.jungclaus@esd.eu>
 * Copyright (C) 2022-2024 esd electronics gmbh, Frank Jungclaus <frank.jungclaus@esd.eu>
 */

#include <linux/can.h>
@@ -1116,9 +1116,6 @@ static int esd_usb_3_set_bittiming(struct net_device *netdev)
	if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
		flags |= ESD_USB_3_BAUDRATE_FLAG_LOM;

	if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
		flags |= ESD_USB_3_BAUDRATE_FLAG_TRS;

	baud_x->nom.brp = cpu_to_le16(nom_bt->brp & (nom_btc->brp_max - 1));
	baud_x->nom.sjw = cpu_to_le16(nom_bt->sjw & (nom_btc->sjw_max - 1));
	baud_x->nom.tseg1 = cpu_to_le16((nom_bt->prop_seg + nom_bt->phase_seg1)
@@ -1219,7 +1216,6 @@ static int esd_usb_probe_one_net(struct usb_interface *intf, int index)
	switch (le16_to_cpu(dev->udev->descriptor.idProduct)) {
	case ESD_USB_CANUSB3_PRODUCT_ID:
		priv->can.clock.freq = ESD_USB_3_CAN_CLOCK;
		priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
		priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD;
		priv->can.bittiming_const = &esd_usb_3_nom_bittiming_const;
		priv->can.data_bittiming_const = &esd_usb_3_data_bittiming_const;
+3 −1
Original line number Diff line number Diff line
@@ -1471,8 +1471,10 @@ static void bcm_notify(struct bcm_sock *bo, unsigned long msg,
		/* remove device reference, if this is our bound device */
		if (bo->bound && bo->ifindex == dev->ifindex) {
#if IS_ENABLED(CONFIG_PROC_FS)
			if (sock_net(sk)->can.bcmproc_dir && bo->bcm_proc_read)
			if (sock_net(sk)->can.bcmproc_dir && bo->bcm_proc_read) {
				remove_proc_entry(bo->procname, sock_net(sk)->can.bcmproc_dir);
				bo->bcm_proc_read = NULL;
			}
#endif
			bo->bound   = 0;
			bo->ifindex = 0;