diff options
author | Oliver Hartkopp <socketcan@hartkopp.net> | 2020-11-11 10:59:23 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-11-20 12:05:14 +0100 |
commit | 4c01fc87675e6974d42383eba9a043123d8e13c3 (patch) | |
tree | 5e720f890a9f4fcbde754ba967facc101ba02857 /drivers/net/can/usb/peak_usb/pcan_usb.c | |
parent | e8e73562ce0b24d691ad35df3de34b324248458f (diff) |
can: drivers: add len8_dlc support for various CAN adapters
Support the Classical CAN raw DLC functionality to send and receive DLC values
from 9 .. 15 on various Classical CAN capable CAN network drivers:
- sja1000
- gs_usb
- pcan_usb
- pcan_usb_fd
- usb_8dev
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20201111095923.2535-1-socketcan@hartkopp.net
[mkl: usb_8dev: changed indention]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/usb/peak_usb/pcan_usb.c')
-rw-r--r-- | drivers/net/can/usb/peak_usb/pcan_usb.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index ec34f87cc02c..e6c1e5d33924 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c @@ -734,7 +734,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) cf->can_id = le16_to_cpu(tmp16) >> 5; } - cf->len = can_cc_dlc2len(rec_len); + can_frame_set_cc_len(cf, rec_len, mc->pdev->dev.can.ctrlmode); /* Only first packet timestamp is a word */ if (pcan_usb_decode_ts(mc, !mc->rec_ts_idx)) @@ -838,7 +838,8 @@ static int pcan_usb_encode_msg(struct peak_usb_device *dev, struct sk_buff *skb, pc = obuf + PCAN_USB_MSG_HEADER_LEN; /* status/len byte */ - *pc = cf->len; + *pc = can_get_cc_dlc(cf, dev->can.ctrlmode); + if (cf->can_id & CAN_RTR_FLAG) *pc |= PCAN_USB_STATUSLEN_RTR; @@ -992,7 +993,8 @@ const struct peak_usb_adapter pcan_usb = { .device_id = PCAN_USB_PRODUCT_ID, .ctrl_count = 1, .ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY | - CAN_CTRLMODE_BERR_REPORTING, + CAN_CTRLMODE_BERR_REPORTING | + CAN_CTRLMODE_CC_LEN8_DLC, .clock = { .freq = PCAN_USB_CRYSTAL_HZ / 2 , }, |