Skip to content

Commit ecc383e

Browse files
committed
Merge tag 'linux-can-next-for-6.17-20250725' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
Marc Kleine-Budde says: ==================== pull-request: can-next 2025-07-25 The first patch is by Khaled Elnaggar and converts the janz-ican3 driver's fwinfo_show() to sysfs_emit(). Vincent Mailhol contributes 3 patches that first fix a warning in the ti_hecc driver and then add missing COMPILE_TEST more compile coverage to the ti_hecc and tscan1 driver. Randy Dunlap's patch let's the tscan1 driver depend on PC104. A patch by Luis Felipe Hernandez fixes a kernel-doc error in the ctucanfd driver. Jimmy Assarsson contributes 10 patches for the kvaser_pciefd and 11 for the kvaser_usb driver. Both series simplify the identification of physical the CAN interfaces and add devlink support to get information about the running firmware. * tag 'linux-can-next-for-6.17-20250725' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: (27 commits) Documentation: devlink: add devlink documentation for the kvaser_usb driver can: kvaser_usb: Add devlink port support can: kvaser_usb: Expose device information via devlink info_get() can: kvaser_usb: Add devlink support can: kvaser_usb: Store additional device information can: kvaser_usb: Store the different firmware version components in a struct can: kvaser_usb: Move comment regarding max_tx_urbs can: kvaser_usb: Add intermediate variables can: kvaser_usb: Assign netdev.dev_port based on device channel index can: kvaser_usb: Add support for ethtool set_phys_id() can: kvaser_usb: Add support to control CAN LEDs on device Documentation: devlink: add devlink documentation for the kvaser_pciefd driver can: kvaser_pciefd: Add devlink port support can: kvaser_pciefd: Expose device firmware version via devlink info_get() can: kvaser_pciefd: Add devlink support can: kvaser_pciefd: Split driver into C-file and header-file. can: kvaser_pciefd: Store device channel index can: kvaser_pciefd: Store the different firmware version components in a struct can: kvaser_pciefd: Add intermediate variable for device struct in probe() can: kvaser_pciefd: Add support for ethtool set_phys_id() ... ==================== Link: https://patch.msgid.link/20250725161327.4165174-1-mkl@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents e9e9187 + ecd82df commit ecc383e

20 files changed

Lines changed: 655 additions & 131 deletions

Documentation/networking/devlink/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ parameters, info versions, and other features it supports.
8585
ionic
8686
ice
8787
ixgbe
88+
kvaser_pciefd
89+
kvaser_usb
8890
mlx4
8991
mlx5
9092
mlxsw
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
=============================
4+
kvaser_pciefd devlink support
5+
=============================
6+
7+
This document describes the devlink features implemented by the
8+
``kvaser_pciefd`` device driver.
9+
10+
Info versions
11+
=============
12+
13+
The ``kvaser_pciefd`` driver reports the following versions
14+
15+
.. list-table:: devlink info versions implemented
16+
:widths: 5 5 90
17+
18+
* - Name
19+
- Type
20+
- Description
21+
* - ``fw``
22+
- running
23+
- Version of the firmware running on the device. Also available
24+
through ``ethtool -i`` as ``firmware-version``.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
==========================
4+
kvaser_usb devlink support
5+
==========================
6+
7+
This document describes the devlink features implemented by the
8+
``kvaser_usb`` device driver.
9+
10+
Info versions
11+
=============
12+
13+
The ``kvaser_usb`` driver reports the following versions
14+
15+
.. list-table:: devlink info versions implemented
16+
:widths: 5 5 90
17+
18+
* - Name
19+
- Type
20+
- Description
21+
* - ``fw``
22+
- running
23+
- Version of the firmware running on the device. Also available
24+
through ``ethtool -i`` as ``firmware-version``.
25+
* - ``board.rev``
26+
- fixed
27+
- The device hardware revision.
28+
* - ``board.id``
29+
- fixed
30+
- The device EAN (product number).
31+
* - ``serial_number``
32+
- fixed
33+
- The device serial number.

drivers/net/can/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ config CAN_JANZ_ICAN3
154154
config CAN_KVASER_PCIEFD
155155
depends on PCI
156156
tristate "Kvaser PCIe FD cards"
157+
select NET_DEVLINK
157158
help
158159
This is a driver for the Kvaser PCI Express CAN FD family.
159160

@@ -201,7 +202,7 @@ config CAN_SUN4I
201202
be called sun4i_can.
202203

203204
config CAN_TI_HECC
204-
depends on ARM
205+
depends on ARM || COMPILE_TEST
205206
tristate "TI High End CAN Controller"
206207
select CAN_RX_OFFLOAD
207208
help

drivers/net/can/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ obj-$(CONFIG_CAN_FLEXCAN) += flexcan/
2525
obj-$(CONFIG_CAN_GRCAN) += grcan.o
2626
obj-$(CONFIG_CAN_IFI_CANFD) += ifi_canfd/
2727
obj-$(CONFIG_CAN_JANZ_ICAN3) += janz-ican3.o
28-
obj-$(CONFIG_CAN_KVASER_PCIEFD) += kvaser_pciefd.o
28+
obj-$(CONFIG_CAN_KVASER_PCIEFD) += kvaser_pciefd/
2929
obj-$(CONFIG_CAN_MSCAN) += mscan/
3030
obj-$(CONFIG_CAN_M_CAN) += m_can/
3131
obj-$(CONFIG_CAN_PEAK_PCIEFD) += peak_canfd/

drivers/net/can/ctucanfd/ctucanfd_base.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,12 @@ static bool ctucan_is_txt_buf_writable(struct ctucan_priv *priv, u8 buf)
506506
* @buf: TXT Buffer index to which frame is inserted (0-based)
507507
* @isfdf: True - CAN FD Frame, False - CAN 2.0 Frame
508508
*
509-
* Return: True - Frame inserted successfully
510-
* False - Frame was not inserted due to one of:
511-
* 1. TXT Buffer is not writable (it is in wrong state)
512-
* 2. Invalid TXT buffer index
513-
* 3. Invalid frame length
509+
* Return:
510+
* * True - Frame inserted successfully
511+
* * False - Frame was not inserted due to one of:
512+
* 1. TXT Buffer is not writable (it is in wrong state)
513+
* 2. Invalid TXT buffer index
514+
* 3. Invalid frame length
514515
*/
515516
static bool ctucan_insert_frame(struct ctucan_priv *priv, const struct canfd_frame *cf, u8 buf,
516517
bool isfdf)

drivers/net/can/janz-ican3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,7 @@ static ssize_t fwinfo_show(struct device *dev,
18671867
{
18681868
struct ican3_dev *mod = netdev_priv(to_net_dev(dev));
18691869

1870-
return scnprintf(buf, PAGE_SIZE, "%s\n", mod->fwinfo);
1870+
return sysfs_emit(buf, "%s\n", mod->fwinfo);
18711871
}
18721872

18731873
static DEVICE_ATTR_RW(termination);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
obj-$(CONFIG_CAN_KVASER_PCIEFD) += kvaser_pciefd.o
3+
kvaser_pciefd-y = kvaser_pciefd_core.o kvaser_pciefd_devlink.o
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
2+
/* kvaser_pciefd common definitions and declarations
3+
*
4+
* Copyright (C) 2025 KVASER AB, Sweden. All rights reserved.
5+
*/
6+
7+
#ifndef _KVASER_PCIEFD_H
8+
#define _KVASER_PCIEFD_H
9+
10+
#include <linux/can/dev.h>
11+
#include <linux/completion.h>
12+
#include <linux/pci.h>
13+
#include <linux/spinlock.h>
14+
#include <linux/timer.h>
15+
#include <linux/types.h>
16+
#include <net/devlink.h>
17+
18+
#define KVASER_PCIEFD_MAX_CAN_CHANNELS 8UL
19+
#define KVASER_PCIEFD_DMA_COUNT 2U
20+
#define KVASER_PCIEFD_DMA_SIZE (4U * 1024U)
21+
#define KVASER_PCIEFD_CAN_TX_MAX_COUNT 17U
22+
23+
struct kvaser_pciefd;
24+
25+
struct kvaser_pciefd_address_offset {
26+
u32 serdes;
27+
u32 pci_ien;
28+
u32 pci_irq;
29+
u32 sysid;
30+
u32 loopback;
31+
u32 kcan_srb_fifo;
32+
u32 kcan_srb;
33+
u32 kcan_ch0;
34+
u32 kcan_ch1;
35+
};
36+
37+
struct kvaser_pciefd_irq_mask {
38+
u32 kcan_rx0;
39+
u32 kcan_tx[KVASER_PCIEFD_MAX_CAN_CHANNELS];
40+
u32 all;
41+
};
42+
43+
struct kvaser_pciefd_dev_ops {
44+
void (*kvaser_pciefd_write_dma_map)(struct kvaser_pciefd *pcie,
45+
dma_addr_t addr, int index);
46+
};
47+
48+
struct kvaser_pciefd_driver_data {
49+
const struct kvaser_pciefd_address_offset *address_offset;
50+
const struct kvaser_pciefd_irq_mask *irq_mask;
51+
const struct kvaser_pciefd_dev_ops *ops;
52+
};
53+
54+
struct kvaser_pciefd_fw_version {
55+
u8 major;
56+
u8 minor;
57+
u16 build;
58+
};
59+
60+
struct kvaser_pciefd_can {
61+
struct can_priv can;
62+
struct devlink_port devlink_port;
63+
struct kvaser_pciefd *kv_pcie;
64+
void __iomem *reg_base;
65+
struct can_berr_counter bec;
66+
u32 ioc;
67+
u8 cmd_seq;
68+
u8 tx_max_count;
69+
u8 tx_idx;
70+
u8 ack_idx;
71+
int err_rep_cnt;
72+
unsigned int completed_tx_pkts;
73+
unsigned int completed_tx_bytes;
74+
spinlock_t lock; /* Locks sensitive registers (e.g. MODE) */
75+
struct timer_list bec_poll_timer;
76+
struct completion start_comp, flush_comp;
77+
};
78+
79+
struct kvaser_pciefd {
80+
struct pci_dev *pci;
81+
void __iomem *reg_base;
82+
struct kvaser_pciefd_can *can[KVASER_PCIEFD_MAX_CAN_CHANNELS];
83+
const struct kvaser_pciefd_driver_data *driver_data;
84+
void *dma_data[KVASER_PCIEFD_DMA_COUNT];
85+
u8 nr_channels;
86+
u32 bus_freq;
87+
u32 freq;
88+
u32 freq_to_ticks_div;
89+
struct kvaser_pciefd_fw_version fw_version;
90+
};
91+
92+
extern const struct devlink_ops kvaser_pciefd_devlink_ops;
93+
94+
int kvaser_pciefd_devlink_port_register(struct kvaser_pciefd_can *can);
95+
void kvaser_pciefd_devlink_port_unregister(struct kvaser_pciefd_can *can);
96+
#endif /* _KVASER_PCIEFD_H */

0 commit comments

Comments
 (0)