2023-05-04 15:47:23

by Frank Jungclaus

[permalink] [raw]
Subject: [PATCH 0/2] can: esd_usb: Add support for esd CAN-USB/3 (CAN FD)

Add support for the newly available esd CAN-USB/3.

The USB protocol for the CAN-USB/3 is similar to the protocol used for
the CAN-USB/2 and the CAN-USB/Micro, so most of the code can be shared
for all three platforms. Most work simply arises from the fact, that
the CAN-USB/3 is capable of handling CAN FD frames.

The main job is to
* also probe for an esd CAN-USB/3
* extend USB structures for CAN FD data
* allow esd_usb_rx_can_msg() and esd_usb_start_xmit() to handle
CAN FD frames
* spend structures and functionality for setting a CAN FD
bittiming

Frank Jungclaus (2):
can: esd_usb: Apply some small changes before adding esd CAN-USB/3
support
can: esd_usb: Add support for esd CAN-USB/3

drivers/net/can/usb/esd_usb.c | 286 +++++++++++++++++++++++++++++-----
1 file changed, 251 insertions(+), 35 deletions(-)


base-commit: 14575e3b5f3ece74e9143d7f7f195f3e5ff085f5
--
2.25.1


2023-05-04 15:49:53

by Frank Jungclaus

[permalink] [raw]
Subject: [PATCH 1/2] can: esd_usb: Apply some small changes before adding esd CAN-USB/3 support

* Add current year to copyright notice
* For reasons of orthogonality rename all occurrences of ESD_RTR to
ESD_DLC_RTR

Signed-off-by: Frank Jungclaus <[email protected]>
---
drivers/net/can/usb/esd_usb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
index d33bac3a6c10..e24fa48b9b42 100644
--- a/drivers/net/can/usb/esd_usb.c
+++ b/drivers/net/can/usb/esd_usb.c
@@ -3,7 +3,7 @@
* CAN driver for esd electronics gmbh CAN-USB/2 and CAN-USB/Micro
*
* Copyright (C) 2010-2012 esd electronic system design gmbh, Matthias Fuchs <[email protected]>
- * Copyright (C) 2022 esd electronics gmbh, Frank Jungclaus <[email protected]>
+ * Copyright (C) 2022-2023 esd electronics gmbh, Frank Jungclaus <[email protected]>
*/
#include <linux/ethtool.h>
#include <linux/signal.h>
@@ -42,7 +42,7 @@ MODULE_LICENSE("GPL v2");
#define CMD_IDADD 6 /* also used for IDADD_REPLY */

/* esd CAN message flags - dlc field */
-#define ESD_RTR 0x10
+#define ESD_DLC_RTR 0x10

/* esd CAN message flags - id field */
#define ESD_EXTID 0x20000000
@@ -347,13 +347,13 @@ static void esd_usb_rx_can_msg(struct esd_usb_net_priv *priv,
}

cf->can_id = id & ESD_IDMASK;
- can_frame_set_cc_len(cf, msg->rx.dlc & ~ESD_RTR,
+ can_frame_set_cc_len(cf, msg->rx.dlc & ~ESD_DLC_RTR,
priv->can.ctrlmode);

if (id & ESD_EXTID)
cf->can_id |= CAN_EFF_FLAG;

- if (msg->rx.dlc & ESD_RTR) {
+ if (msg->rx.dlc & ESD_DLC_RTR) {
cf->can_id |= CAN_RTR_FLAG;
} else {
for (i = 0; i < cf->len; i++)
@@ -772,7 +772,7 @@ static netdev_tx_t esd_usb_start_xmit(struct sk_buff *skb,
msg->tx.id = cpu_to_le32(cf->can_id & CAN_ERR_MASK);

if (cf->can_id & CAN_RTR_FLAG)
- msg->tx.dlc |= ESD_RTR;
+ msg->tx.dlc |= ESD_DLC_RTR;

if (cf->can_id & CAN_EFF_FLAG)
msg->tx.id |= cpu_to_le32(ESD_EXTID);
--
2.25.1