Commit 9c8dddab authored by David S. Miller's avatar David S. Miller
Browse files


Marc Kleine-Budde says:

====================
this is a pull request of 29 patches for net-next/master.

The first patch is by Daniel S. Trevitz and adds documentation for
switchable termination resistors.

Zhang Changzhong's patch fixes a debug output in the j13939 stack.

Oliver Hartkopp finally removes the pch_can driver, which is
superseded by the generic c_can driver.

Gustavo A. R. Silva replaces a zero-length array with
DECLARE_FLEX_ARRAY() in the ucan driver.

Kees Cook's patch removes a no longer needed silencing of
"-Warray-bounds" warnings for the kvaser_usb driver.

The next 2 patches target the m_can driver. The first is by me cleans
up the LEC error handling, the second is by Vivek Yadav and extends
the LEC error handling to the data phase of CAN-FD frames.

The next 9 patches all target the gs_usb driver. The first 5 patches
are by me and improve the Kconfig prompt and help text, set
netdev->dev_id to distinguish multi CAN channel devices, allow
loopback and listen only at the same time, and clean up the
gs_can_open() function a bit. The remaining 4 patches are by Jeroen
Hofstee and add support for 2 new features: Bus Error Reporting and
Get State.

Jimmy Assarsson and Anssi Hannula contribute 10 patches for the
kvaser_usb driver. They first add Listen Only and Bus Error Reporting
support, handle CMD_ERROR_EVENT errors, improve CAN state handling,
restart events, and configuration of the bit timing parameters.

Another patch by me which fixes the indention in the m_can driver.

A patch by Dongliang Mu cleans up the ucan_disconnect() function in
the ucan driver.

The last patch by Biju Das is for the rcan_canfd driver and cleans up
the reset handling.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d0217284 68399ff5
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -1148,6 +1148,39 @@ tuning on deep embedded systems'. The author is running a MPC603e
load without any problems ...


Switchable Termination Resistors
--------------------------------

CAN bus requires a specific impedance across the differential pair,
typically provided by two 120Ohm resistors on the farthest nodes of
the bus. Some CAN controllers support activating / deactivating a
termination resistor(s) to provide the correct impedance.

Query the available resistances::

    $ ip -details link show can0
    ...
    termination 120 [ 0, 120 ]

Activate the terminating resistor::

    $ ip link set dev can0 type can termination 120

Deactivate the terminating resistor::

    $ ip link set dev can0 type can termination 0

To enable termination resistor support to a can-controller, either
implement in the controller's struct can-priv::

    termination_const
    termination_const_cnt
    do_set_termination

or add gpio control with the device tree entries from
Documentation/devicetree/bindings/net/can/can-controller.yaml


The Virtual CAN Driver (vcan)
-----------------------------

+0 −8
Original line number Diff line number Diff line
@@ -198,14 +198,6 @@ config CAN_XILINXCAN
	  Xilinx CAN driver. This driver supports both soft AXI CAN IP and
	  Zynq CANPS IP.

config PCH_CAN
	tristate "Intel EG20T PCH CAN controller"
	depends on PCI && (X86_32 || COMPILE_TEST)
	help
	  This driver is for PCH CAN of Topcliff (Intel EG20T PCH) which
	  is an IOH for x86 embedded processor (Intel Atom E6xx series).
	  This driver can access CAN bus.

source "drivers/net/can/c_can/Kconfig"
source "drivers/net/can/cc770/Kconfig"
source "drivers/net/can/ctucanfd/Kconfig"
+0 −1
Original line number Diff line number Diff line
@@ -30,6 +30,5 @@ obj-$(CONFIG_CAN_SJA1000) += sja1000/
obj-$(CONFIG_CAN_SUN4I)		+= sun4i_can.o
obj-$(CONFIG_CAN_TI_HECC)	+= ti_hecc.o
obj-$(CONFIG_CAN_XILINXCAN)	+= xilinx_can.o
obj-$(CONFIG_PCH_CAN)		+= pch_can.o

subdir-ccflags-$(CONFIG_CAN_DEBUG_DEVICES) += -DDEBUG
+2 −1
Original line number Diff line number Diff line
@@ -20,5 +20,6 @@ config CAN_C_CAN_PCI
	depends on PCI
	help
	  This driver adds support for the C_CAN/D_CAN chips connected
	  to the PCI bus.
	  to the PCI bus. E.g. for the C_CAN controller IP inside the
	  Intel Atom E6xx series IOH (aka EG20T 'PCH CAN').
endif
+18 −8
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ enum m_can_reg {
#define PSR_EW		BIT(6)
#define PSR_EP		BIT(5)
#define PSR_LEC_MASK	GENMASK(2, 0)
#define PSR_DLEC_MASK	GENMASK(10, 8)

/* Interrupt Register (IR) */
#define IR_ALL_INT	0xffffffff
@@ -816,11 +817,9 @@ static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus)
		netdev_err(dev, "Message RAM access failure occurred\n");
}

static inline bool is_lec_err(u32 psr)
static inline bool is_lec_err(u8 lec)
{
	psr &= LEC_UNUSED;

	return psr && (psr != LEC_UNUSED);
	return lec != LEC_NO_ERROR && lec != LEC_NO_CHANGE;
}

static inline bool m_can_is_protocol_err(u32 irqstatus)
@@ -875,9 +874,20 @@ static int m_can_handle_bus_errors(struct net_device *dev, u32 irqstatus,
		work_done += m_can_handle_lost_msg(dev);

	/* handle lec errors on the bus */
	if ((cdev->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) &&
	    is_lec_err(psr))
		work_done += m_can_handle_lec_err(dev, psr & LEC_UNUSED);
	if (cdev->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) {
		u8 lec = FIELD_GET(PSR_LEC_MASK, psr);
		u8 dlec = FIELD_GET(PSR_DLEC_MASK, psr);

		if (is_lec_err(lec)) {
			netdev_dbg(dev, "Arbitration phase error detected\n");
			work_done += m_can_handle_lec_err(dev, lec);
		}
		
		if (is_lec_err(dlec)) {
			netdev_dbg(dev, "Data phase error detected\n");
			work_done += m_can_handle_lec_err(dev, dlec);
		}
	}

	/* handle protocol errors in arbitration phase */
	if ((cdev->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) &&
Loading