Skip to contentSkip to conversation

pull-request: can 2017-11-10

PATCH New Marc Kleine-Budde 2 participants 6 messages Nov 10, 2017 – Nov 11, 2017

Subsystems (5)
lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#0 lore raw

Hello David,

this is a pull request for net/master.

The first patch by Richard Schütz for the c_can driver removes the false indication to support triple sampling for d_can. Gerhard Bertelsmann's patch for the sun4i driver improves the RX overrun handling. The patch by Stephane Grosjean for the peak_canfd driver adds the PCI ids for various new PCIe/M2 interfaces. Marek Vasut's patch for the ifi driver fix transmitter delay calculation.

regards,
Marc

---

The following changes since commit 1cb483a5cc84b497afb51a6c5dfb5a38a0b67086:

rds: ib: Fix NULL pointer dereference in debug code (2017-11-10 14:54:47 +0900)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.14-20171110

for you to fetch changes up to 4f7116757b4bd99e4ef2636c7d957a6d63035d11:

can: ifi: Fix transmitter delay calculation (2017-11-10 11:35:09 +0100)

----------------------------------------------------------------
linux-can-fixes-for-4.14-20171110

----------------------------------------------------------------
Gerhard Bertelsmann (1):
can: sun4i: handle overrun in RX FIFO

Marek Vasut (1):
can: ifi: Fix transmitter delay calculation

Richard Schütz (1):
can: c_can: don't indicate triple sampling support for D_CAN

Stephane Grosjean (1):
can: peak: Add support for new PCIe/M2 CAN FD interfaces

 drivers/net/can/c_can/c_can_pci.c             |  1 -
 drivers/net/can/c_can/c_can_platform.c        |  1 -
 drivers/net/can/ifi_canfd/ifi_canfd.c         |  6 +++---
 drivers/net/can/peak_canfd/peak_pciefd_main.c | 14 ++++++++++++--
 drivers/net/can/sun4i_can.c                   | 12 ++++++++++--
 5 files changed, 25 insertions(+), 9 deletions(-)
author maintainer
#1 lore raw

PATCH 1/4 can: c_can: don't indicate triple sampling support for D_CAN

From: Richard Schütz <[email protected]>

The D_CAN controller doesn't provide a triple sampling mode, so don't set the CAN_CTRLMODE_3_SAMPLES flag in ctrlmode_supported. Currently enabling triple sampling is a no-op.

---
 drivers/net/can/c_can/c_can_pci.c      | 1 -
 drivers/net/can/c_can/c_can_platform.c | 1 -
 2 files changed, 2 deletions(-)
drivers/net/can/c_can/c_can_pci.c +0 -1
index cf7c18947189..d065c0e2d18e 100644
@@ -178,7 +178,6 @@ static int c_can_pci_probe(struct pci_dev *pdev,
 		break;
 	case BOSCH_D_CAN:
 		priv->regs = reg_map_d_can;
-		priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
 		break;
 	default:
 		ret = -EINVAL;
drivers/net/can/c_can/c_can_platform.c +0 -1
index 46a746ee80bb..b5145a7f874c 100644
@@ -320,7 +320,6 @@ static int c_can_plat_probe(struct platform_device *pdev)
 		break;
 	case BOSCH_D_CAN:
 		priv->regs = reg_map_d_can;
-		priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
 		priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
 		priv->write_reg = c_can_plat_write_reg_aligned_to_16bit;
 		priv->read_reg32 = d_can_plat_read_reg32;
Signature · 1 line
2.15.0
author maintainer
#2 lore raw

PATCH 2/4 can: sun4i: handle overrun in RX FIFO

In reply to Marc Kleine-Budde

From: Gerhard Bertelsmann <[email protected]>

SUN4Is CAN IP has a 64 byte deep FIFO buffer. If the buffer is not drained fast enough (overrun) it's getting mangled. Already received frames are dropped - the data can't be restored.

---
 drivers/net/can/sun4i_can.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/can/sun4i_can.c +10 -2
index b0c80859f746..1ac2090a1721 100644
@@ -539,6 +539,13 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
 		}
 		stats->rx_over_errors++;
 		stats->rx_errors++;
+
+		/* reset the CAN IP by entering reset mode
+		 * ignoring timeout error
+		 */
+		set_reset_mode(dev);
+		set_normal_mode(dev);
+
 		/* clear bit */
 		sun4i_can_write_cmdreg(priv, SUN4I_CMD_CLEAR_OR_FLAG);
 	}
@@ -653,8 +660,9 @@ static irqreturn_t sun4i_can_interrupt(int irq, void *dev_id)
 			netif_wake_queue(dev);
 			can_led_event(dev, CAN_LED_EVENT_TX);
 		}
-		if (isrc & SUN4I_INT_RBUF_VLD) {
-			/* receive interrupt */
+		if ((isrc & SUN4I_INT_RBUF_VLD) &&
+		    !(isrc & SUN4I_INT_DATA_OR)) {
+			/* receive interrupt - don't read if overrun occurred */
 			while (status & SUN4I_STA_RBUF_RDY) {
 				/* RX buffer is not empty */
 				sun4i_can_rx(dev);
Signature · 1 line
2.15.0
author maintainer
#3 lore raw

PATCH 3/4 can: peak: Add support for new PCIe/M2 CAN FD interfaces

In reply to Marc Kleine-Budde

From: Stephane Grosjean <[email protected]>

This adds support for the following PEAK-System CAN FD interfaces:

PCAN-cPCIe FD CAN FD Interface for cPCI Serial (2 or 4 channels)
PCAN-PCIe/104-Express CAN FD Interface for PCIe/104-Express (1, 2 or 4 ch.)

PCAN-miniPCIe FD      CAN FD Interface for PCIe Mini (1, 2 or 4 channels)
PCAN-PCIe FD OEM      CAN FD Interface for PCIe OEM version (1, 2 or 4 ch.)
PCAN-M.2              CAN FD Interface for M.2 (1 or 2 channels)

Like the PCAN-PCIe FD interface, all of these boards run the same IP Core that is able to handle CAN FD (see also http://www.peak-system.com).

---
 drivers/net/can/peak_canfd/peak_pciefd_main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/can/peak_canfd/peak_pciefd_main.c +12 -2
index 51c2d182a33a..b4efd711f824 100644
@@ -29,14 +29,19 @@
 #include "peak_canfd_user.h"
 
 MODULE_AUTHOR("Stephane Grosjean <[email protected]>");
-MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe FD family cards");
-MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe FD CAN cards");
+MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe/M.2 FD family cards");
+MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe/M.2 FD CAN cards");
 MODULE_LICENSE("GPL v2");
 
 #define PCIEFD_DRV_NAME		"peak_pciefd"
 
 #define PEAK_PCI_VENDOR_ID	0x001c	/* The PCI device and vendor IDs */
 #define PEAK_PCIEFD_ID		0x0013	/* for PCIe slot cards */
+#define PCAN_CPCIEFD_ID		0x0014	/* for Compact-PCI Serial slot cards */
+#define PCAN_PCIE104FD_ID	0x0017	/* for PCIe-104 Express slot cards */
+#define PCAN_MINIPCIEFD_ID      0x0018	/* for mini-PCIe slot cards */
+#define PCAN_PCIEFD_OEM_ID      0x0019	/* for PCIe slot OEM cards */
+#define PCAN_M2_ID		0x001a	/* for M2 slot cards */
 
 /* PEAK PCIe board access description */
 #define PCIEFD_BAR0_SIZE		(64 * 1024)
@@ -203,6 +208,11 @@ struct pciefd_board {
 /* supported device ids. */
 static const struct pci_device_id peak_pciefd_tbl[] = {
 	{PEAK_PCI_VENDOR_ID, PEAK_PCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
+	{PEAK_PCI_VENDOR_ID, PCAN_CPCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
+	{PEAK_PCI_VENDOR_ID, PCAN_PCIE104FD_ID, PCI_ANY_ID, PCI_ANY_ID,},
+	{PEAK_PCI_VENDOR_ID, PCAN_MINIPCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
+	{PEAK_PCI_VENDOR_ID, PCAN_PCIEFD_OEM_ID, PCI_ANY_ID, PCI_ANY_ID,},
+	{PEAK_PCI_VENDOR_ID, PCAN_M2_ID, PCI_ANY_ID, PCI_ANY_ID,},
 	{0,}
 };
 
Signature · 1 line
2.15.0
author maintainer
#4 lore raw

PATCH 4/4 can: ifi: Fix transmitter delay calculation

In reply to Marc Kleine-Budde

From: Marek Vasut <[email protected]>

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.

---
 drivers/net/can/ifi_canfd/ifi_canfd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/ifi_canfd/ifi_canfd.c +3 -3
index 4d1fe8d95042..2772d05ff11c 100644
@@ -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,
Signature · 1 line
2.15.0
maintainer
#5 lore raw
In reply to Marc Kleine-Budde

From: Marc Kleine-Budde <[email protected]>
Date: Fri, 10 Nov 2017 14:07:26 +0100

Quoted 8 lines

this is a pull request for net/master.

The first patch by Richard Schütz for the c_can driver removes the false indication to support triple sampling for d_can. Gerhard Bertelsmann's patch for the sun4i driver improves the RX overrun handling. The patch by Stephane Grosjean for the peak_canfd driver adds the PCI ids for various new PCIe/M2 interfaces. Marek Vasut's patch for the ifi driver fix transmitter delay calculation.

Pulled, thanks Marc.