Commit a48e789d authored by David S. Miller's avatar David S. Miller

Merge tag 'linux-can-next-for-5.20-20220703' of...

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

Marc Kleine-Budde says:

====================
pull-request: can-next 2022-07-03

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

The first 2 patches are by Max Staudt and add the can327 serial CAN
driver along with a new line discipline ID.

The next patch is by me an fixes a typo in the ctucanfd driver.

The last 12 patches are by Dario Binacchi and integrate slcan CAN
serial driver better into the existing CAN driver API.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c67289e0 0ebd5529
This diff is collapsed.
......@@ -10,6 +10,7 @@ Contents:
.. toctree::
:maxdepth: 2
can327
ctu/ctucanfd-driver
freescale/flexcan
......
......@@ -7320,6 +7320,13 @@ L: netdev@vger.kernel.org
S: Maintained
F: drivers/net/ethernet/ibm/ehea/
ELM327 CAN NETWORK DRIVER
M: Max Staudt <max@enpas.org>
L: linux-can@vger.kernel.org
S: Maintained
F: Documentation/networking/device_drivers/can/can327.rst
F: drivers/net/can/can327.c
EM28XX VIDEO4LINUX DRIVER
M: Mauro Carvalho Chehab <mchehab@kernel.org>
L: linux-media@vger.kernel.org
......
......@@ -49,26 +49,6 @@ config CAN_VXCAN
This driver can also be built as a module. If so, the module
will be called vxcan.
config CAN_SLCAN
tristate "Serial / USB serial CAN Adaptors (slcan)"
depends on TTY
help
CAN driver for several 'low cost' CAN interfaces that are attached
via serial lines or via USB-to-serial adapters using the LAWICEL
ASCII protocol. The driver implements the tty linediscipline N_SLCAN.
As only the sending and receiving of CAN frames is implemented, this
driver should work with the (serial/USB) CAN hardware from:
www.canusb.com / www.can232.com / www.mictronics.de / www.canhack.de
Userspace tools to attach the SLCAN line discipline (slcan_attach,
slcand) can be found in the can-utils at the linux-can project, see
https://github.com/linux-can/can-utils for details.
The slcan driver supports up to 10 CAN netdevices by default which
can be changed by the 'maxdev=xx' module option. This driver can
also be built as a module. If so, the module will be called slcan.
config CAN_NETLINK
bool "CAN device drivers with Netlink support"
default y
......@@ -113,6 +93,24 @@ config CAN_AT91
This is a driver for the SoC CAN controller in Atmel's AT91SAM9263
and AT91SAM9X5 processors.
config CAN_CAN327
tristate "Serial / USB serial ELM327 based OBD-II Interfaces (can327)"
depends on TTY
select CAN_RX_OFFLOAD
help
CAN driver for several 'low cost' OBD-II interfaces based on the
ELM327 OBD-II interpreter chip.
This is a best effort driver - the ELM327 interface was never
designed to be used as a standalone CAN interface. However, it can
still be used for simple request-response protocols (such as OBD II),
and to monitor broadcast messages on a bus (such as in a vehicle).
Please refer to the documentation for information on how to use it:
Documentation/networking/device_drivers/can/can327.rst
If this driver is built as a module, it will be called can327.
config CAN_FLEXCAN
tristate "Support for Freescale FLEXCAN based chips"
depends on OF || COLDFIRE || COMPILE_TEST
......@@ -154,6 +152,26 @@ config CAN_KVASER_PCIEFD
Kvaser Mini PCI Express HS v2
Kvaser Mini PCI Express 2xHS v2
config CAN_SLCAN
tristate "Serial / USB serial CAN Adaptors (slcan)"
depends on TTY
help
CAN driver for several 'low cost' CAN interfaces that are attached
via serial lines or via USB-to-serial adapters using the LAWICEL
ASCII protocol. The driver implements the tty linediscipline N_SLCAN.
As only the sending and receiving of CAN frames is implemented, this
driver should work with the (serial/USB) CAN hardware from:
www.canusb.com / www.can232.com / www.mictronics.de / www.canhack.de
Userspace tools to attach the SLCAN line discipline (slcan_attach,
slcand) can be found in the can-utils at the linux-can project, see
https://github.com/linux-can/can-utils for details.
The slcan driver supports up to 10 CAN netdevices by default which
can be changed by the 'maxdev=xx' module option. This driver can
also be built as a module. If so, the module will be called slcan.
config CAN_SUN4I
tristate "Allwinner A10 CAN controller"
depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST
......
......@@ -5,7 +5,7 @@
obj-$(CONFIG_CAN_VCAN) += vcan.o
obj-$(CONFIG_CAN_VXCAN) += vxcan.o
obj-$(CONFIG_CAN_SLCAN) += slcan.o
obj-$(CONFIG_CAN_SLCAN) += slcan/
obj-y += dev/
obj-y += rcar/
......@@ -14,6 +14,7 @@ obj-y += usb/
obj-y += softing/
obj-$(CONFIG_CAN_AT91) += at91_can.o
obj-$(CONFIG_CAN_CAN327) += can327.o
obj-$(CONFIG_CAN_CC770) += cc770/
obj-$(CONFIG_CAN_C_CAN) += c_can/
obj-$(CONFIG_CAN_CTUCANFD) += ctucanfd/
......
This diff is collapsed.
......@@ -1087,7 +1087,7 @@ static void ctucan_tx_interrupt(struct net_device *ndev)
/**
* ctucan_interrupt() - CAN Isr
* @irq: irq number
* @dev_id: device id poniter
* @dev_id: device id pointer
*
* This is the CTU CAN FD ISR. It checks for the type of interrupt
* and invokes the corresponding ISR.
......
......@@ -511,7 +511,8 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
if (priv->do_get_state)
priv->do_get_state(dev, &state);
if ((priv->bittiming.bitrate &&
if ((priv->bittiming.bitrate != CAN_BITRATE_UNSET &&
priv->bittiming.bitrate != CAN_BITRATE_UNKNOWN &&
nla_put(skb, IFLA_CAN_BITTIMING,
sizeof(priv->bittiming), &priv->bittiming)) ||
......
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_CAN_SLCAN) += slcan.o
slcan-objs :=
slcan-objs += slcan-core.o
slcan-objs += slcan-ethtool.o
// SPDX-License-Identifier: GPL-2.0+
/* Copyright (c) 2022 Amarula Solutions, Dario Binacchi <dario.binacchi@amarulasolutions.com>
*
*/
#include <linux/can/dev.h>
#include <linux/ethtool.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/platform_device.h>
#include "slcan.h"
static const char slcan_priv_flags_strings[][ETH_GSTRING_LEN] = {
#define SLCAN_PRIV_FLAGS_ERR_RST_ON_OPEN BIT(0)
"err-rst-on-open",
};
static void slcan_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
{
switch (stringset) {
case ETH_SS_PRIV_FLAGS:
memcpy(data, slcan_priv_flags_strings,
sizeof(slcan_priv_flags_strings));
}
}
static u32 slcan_get_priv_flags(struct net_device *ndev)
{
u32 flags = 0;
if (slcan_err_rst_on_open(ndev))
flags |= SLCAN_PRIV_FLAGS_ERR_RST_ON_OPEN;
return flags;
}
static int slcan_set_priv_flags(struct net_device *ndev, u32 flags)
{
bool err_rst_op_open = !!(flags & SLCAN_PRIV_FLAGS_ERR_RST_ON_OPEN);
return slcan_enable_err_rst_on_open(ndev, err_rst_op_open);
}
static int slcan_get_sset_count(struct net_device *netdev, int sset)
{
switch (sset) {
case ETH_SS_PRIV_FLAGS:
return ARRAY_SIZE(slcan_priv_flags_strings);
default:
return -EOPNOTSUPP;
}
}
static const struct ethtool_ops slcan_ethtool_ops = {
.get_strings = slcan_get_strings,
.get_priv_flags = slcan_get_priv_flags,
.set_priv_flags = slcan_set_priv_flags,
.get_sset_count = slcan_get_sset_count,
};
void slcan_set_ethtool_ops(struct net_device *netdev)
{
netdev->ethtool_ops = &slcan_ethtool_ops;
}
/* SPDX-License-Identifier: GPL-2.0
* slcan.h - serial line CAN interface driver
*
* Copyright (C) Laurence Culhane <loz@holmes.demon.co.uk>
* Copyright (C) Fred N. van Kempen <waltje@uwalt.nl.mugnet.org>
* Copyright (C) Oliver Hartkopp <socketcan@hartkopp.net>
* Copyright (C) 2022 Amarula Solutions, Dario Binacchi <dario.binacchi@amarulasolutions.com>
*
*/
#ifndef _SLCAN_H
#define _SLCAN_H
bool slcan_err_rst_on_open(struct net_device *ndev);
int slcan_enable_err_rst_on_open(struct net_device *ndev, bool on);
void slcan_set_ethtool_ops(struct net_device *ndev);
#endif /* _SLCAN_H */
......@@ -11,6 +11,8 @@
#define CAN_SYNC_SEG 1
#define CAN_BITRATE_UNSET 0
#define CAN_BITRATE_UNKNOWN (-1U)
#define CAN_CTRLMODE_TDC_MASK \
(CAN_CTRLMODE_TDC_AUTO | CAN_CTRLMODE_TDC_MANUAL)
......
......@@ -38,8 +38,9 @@
#define N_NULL 27 /* Null ldisc used for error handling */
#define N_MCTP 28 /* MCTP-over-serial */
#define N_DEVELOPMENT 29 /* Manual out-of-tree testing */
#define N_CAN327 30 /* ELM327 based OBD-II interfaces */
/* Always the newest line discipline + 1 */
#define NR_LDISCS 30
#define NR_LDISCS 31
#endif /* _UAPI_LINUX_TTY_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment