Commit 08eeccb2 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge tag 'linux-can-next-for-6.5-20230622' of...

Merge tag 'linux-can-next-for-6.5-20230622' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2023-06-22

The first patch is by Carsten Schmidt, targets the kvaser_usb driver
and adds len8_dlc support.

Marcel Hellwig's patch for the xilinx_can driver adds support for CAN
transceivers via the PHY framework.

Frank Jungclaus contributes 6+2 patches for the esd_usb driver in
preparation for the upcoming CAN-USB/3 support.

The 2 patches by Miquel Raynal for the sja1000 driver work around
overruns stalls on the Renesas SoCs.

The next 3 patches are by me and fix the coding style in the
rx-offload helper and in the m_can and ti_hecc driver.

Vincent Mailhol contributes 3 patches to fix and update the
calculation of the length of CAN frames on the wire.

Oliver Hartkopp's patch moves the CAN_RAW_FILTER_MAX definition into
the correct header.

The remaining 14 patches are by Jimmy Assarsson, target the
kvaser_pciefd driver and bring various updates and improvements.

* tag 'linux-can-next-for-6.5-20230622' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: (33 commits)
  can: kvaser_pciefd: Use TX FIFO size read from CAN controller
  can: kvaser_pciefd: Refactor code
  can: kvaser_pciefd: Add len8_dlc support
  can: kvaser_pciefd: Use FIELD_{GET,PREP} and GENMASK where appropriate
  can: kvaser_pciefd: Sort register definitions
  can: kvaser_pciefd: Change return type for kvaser_pciefd_{receive,transmit,set_tx}_irq()
  can: kvaser_pciefd: Rename device ID defines
  can: kvaser_pciefd: Sort includes in alphabetic order
  can: kvaser_pciefd: Remove SPI flash parameter read functionality
  can: uapi: move CAN_RAW_FILTER_MAX definition to raw.h
  can: kvaser_pciefd: Define unsigned constants with type suffix 'U'
  can: kvaser_pciefd: Set hardware timestamp on transmitted packets
  can: kvaser_pciefd: Add function to set skb hwtstamps
  can: kvaser_pciefd: Remove handler for unused KVASER_PCIEFD_PACK_TYPE_EFRAME_ACK
  can: kvaser_pciefd: Remove useless write to interrupt register
  can: length: refactor frame lengths definition to add size in bits
  can: length: fix bitstuffing count
  can: length: fix description of the RRS field
  can: m_can: fix coding style
  can: ti_hecc: fix coding style
  ...
====================

Link: https://lore.kernel.org/r/20230622082658.571150-1-mkl@pengutronix.de


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 0ec92a8f 790ef390
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -153,7 +153,6 @@ config CAN_JANZ_ICAN3
config CAN_KVASER_PCIEFD
	depends on PCI
	tristate "Kvaser PCIe FD cards"
	select CRC32
	help
	  This is a driver for the Kvaser PCI Express CAN FD family.

+2 −13
Original line number Diff line number Diff line
@@ -78,18 +78,7 @@ unsigned int can_skb_get_frame_len(const struct sk_buff *skb)
	else
		len = cf->len;

	if (can_is_canfd_skb(skb)) {
		if (cf->can_id & CAN_EFF_FLAG)
			len += CANFD_FRAME_OVERHEAD_EFF;
		else
			len += CANFD_FRAME_OVERHEAD_SFF;
	} else {
		if (cf->can_id & CAN_EFF_FLAG)
			len += CAN_FRAME_OVERHEAD_EFF;
		else
			len += CAN_FRAME_OVERHEAD_SFF;
	}

	return len;
	return can_frame_bytes(can_is_canfd_skb(skb), cf->can_id & CAN_EFF_FLAG,
			       false, len);
}
EXPORT_SYMBOL_GPL(can_skb_get_frame_len);
+341 −614

File changed.

Preview size limit exceeded, changes collapsed.

+34 −6
Original line number Diff line number Diff line
@@ -387,6 +387,16 @@ static void sja1000_rx(struct net_device *dev)
	netif_rx(skb);
}

static irqreturn_t sja1000_reset_interrupt(int irq, void *dev_id)
{
	struct net_device *dev = (struct net_device *)dev_id;

	netdev_dbg(dev, "performing a soft reset upon overrun\n");
	sja1000_start(dev);

	return IRQ_HANDLED;
}

static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
{
	struct sja1000_priv *priv = netdev_priv(dev);
@@ -397,6 +407,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
	enum can_state rx_state, tx_state;
	unsigned int rxerr, txerr;
	uint8_t ecc, alc;
	int ret = 0;

	skb = alloc_can_err_skb(dev, &cf);
	if (skb == NULL)
@@ -413,6 +424,15 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
		stats->rx_over_errors++;
		stats->rx_errors++;
		sja1000_write_cmdreg(priv, CMD_CDO);	/* clear bit */

		/* Some controllers needs additional handling upon overrun
		 * condition: the controller may sometimes be totally confused
		 * and refuse any new frame while its buffer is empty. The only
		 * way to re-sync the read vs. write buffer offsets is to
		 * stop any current handling and perform a reset.
		 */
		if (priv->flags & SJA1000_QUIRK_RESET_ON_OVERRUN)
			ret = IRQ_WAKE_THREAD;
	}

	if (isrc & IRQ_EI) {
@@ -492,7 +512,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)

	netif_rx(skb);

	return 0;
	return ret;
}

irqreturn_t sja1000_interrupt(int irq, void *dev_id)
@@ -501,7 +521,8 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
	struct sja1000_priv *priv = netdev_priv(dev);
	struct net_device_stats *stats = &dev->stats;
	uint8_t isrc, status;
	int n = 0;
	irqreturn_t ret = 0;
	int n = 0, err;

	if (priv->pre_irq)
		priv->pre_irq(priv);
@@ -546,19 +567,25 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
		}
		if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) {
			/* error interrupt */
			if (sja1000_err(dev, isrc, status))
			err = sja1000_err(dev, isrc, status);
			if (err == IRQ_WAKE_THREAD)
				ret = err;
			if (err)
				break;
		}
		n++;
	}
out:
	if (!ret)
		ret = (n) ? IRQ_HANDLED : IRQ_NONE;

	if (priv->post_irq)
		priv->post_irq(priv);

	if (n >= SJA1000_MAX_IRQ)
		netdev_dbg(dev, "%d messages handled in ISR", n);

	return (n) ? IRQ_HANDLED : IRQ_NONE;
	return ret;
}
EXPORT_SYMBOL_GPL(sja1000_interrupt);

@@ -577,8 +604,9 @@ static int sja1000_open(struct net_device *dev)

	/* register interrupt handler, if not done by the device driver */
	if (!(priv->flags & SJA1000_CUSTOM_IRQ_HANDLER)) {
		err = request_irq(dev->irq, sja1000_interrupt, priv->irq_flags,
				  dev->name, (void *)dev);
		err = request_threaded_irq(dev->irq, sja1000_interrupt,
					   sja1000_reset_interrupt,
					   priv->irq_flags, dev->name, (void *)dev);
		if (err) {
			close_candev(dev);
			return -EAGAIN;
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@
 */
#define SJA1000_CUSTOM_IRQ_HANDLER	BIT(0)
#define SJA1000_QUIRK_NO_CDR_REG	BIT(1)
#define SJA1000_QUIRK_RESET_ON_OVERRUN	BIT(2)

/*
 * SJA1000 private data structure
Loading