summaryrefslogtreecommitdiffstats
path: root/Documentation/networking
diff options
context:
space:
mode:
authorOliver Hartkopp <socketcan@hartkopp.net>2015-09-18 05:10:15 -0400
committerJonathan Corbet <corbet@lwn.net>2015-09-18 12:02:59 -0400
commitac78a15de46489343790585d28395a7921697349 (patch)
tree70933c1016d1b7c141a69692a45d0a85167da74f /Documentation/networking
parent4d73270192ec8238135d9fb65b49f6f42f50818d (diff)
can: Add documentation for CAN FD driver configuration
With Linux 3.15 the infrastructure for CAN FD hardware drivers had been introduced into the kernel. Now the M_CAN driver and the peak_usb driver support CAN FD. Update the documentation to show the latest CAN related configuration options of 'ip' from iproute2 and describe the CAN FD specific options to set the data bitrate and protocol version (ISO/non-ISO). Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/networking')
-rw-r--r--Documentation/networking/can.txt97
1 files changed, 77 insertions, 20 deletions
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt
index fd1a1aad49a9..4636b94518da 100644
--- a/Documentation/networking/can.txt
+++ b/Documentation/networking/can.txt
@@ -1018,25 +1018,34 @@ solution for a couple of reasons:
1018 1018
1019 $ ip link set can0 type can help 1019 $ ip link set can0 type can help
1020 Usage: ip link set DEVICE type can 1020 Usage: ip link set DEVICE type can
1021 [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] | 1021 [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
1022 [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1 1022 [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1
1023 phase-seg2 PHASE-SEG2 [ sjw SJW ] ] 1023 phase-seg2 PHASE-SEG2 [ sjw SJW ] ]
1024 1024
1025 [ loopback { on | off } ] 1025 [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |
1026 [ listen-only { on | off } ] 1026 [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1
1027 [ triple-sampling { on | off } ] 1027 dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ]
1028 1028
1029 [ restart-ms TIME-MS ] 1029 [ loopback { on | off } ]
1030 [ restart ] 1030 [ listen-only { on | off } ]
1031 1031 [ triple-sampling { on | off } ]
1032 Where: BITRATE := { 1..1000000 } 1032 [ one-shot { on | off } ]
1033 SAMPLE-POINT := { 0.000..0.999 } 1033 [ berr-reporting { on | off } ]
1034 TQ := { NUMBER } 1034 [ fd { on | off } ]
1035 PROP-SEG := { 1..8 } 1035 [ fd-non-iso { on | off } ]
1036 PHASE-SEG1 := { 1..8 } 1036 [ presume-ack { on | off } ]
1037 PHASE-SEG2 := { 1..8 } 1037
1038 SJW := { 1..4 } 1038 [ restart-ms TIME-MS ]
1039 RESTART-MS := { 0 | NUMBER } 1039 [ restart ]
1040
1041 Where: BITRATE := { 1..1000000 }
1042 SAMPLE-POINT := { 0.000..0.999 }
1043 TQ := { NUMBER }
1044 PROP-SEG := { 1..8 }
1045 PHASE-SEG1 := { 1..8 }
1046 PHASE-SEG2 := { 1..8 }
1047 SJW := { 1..4 }
1048 RESTART-MS := { 0 | NUMBER }
1040 1049
1041 - Display CAN device details and statistics: 1050 - Display CAN device details and statistics:
1042 1051
@@ -1178,7 +1187,55 @@ solution for a couple of reasons:
1178 The CAN device MTU can be retrieved e.g. with a SIOCGIFMTU ioctl() syscall. 1187 The CAN device MTU can be retrieved e.g. with a SIOCGIFMTU ioctl() syscall.
1179 N.B. CAN FD capable devices can also handle and send legacy CAN frames. 1188 N.B. CAN FD capable devices can also handle and send legacy CAN frames.
1180 1189
1181 FIXME: Add details about the CAN FD controller configuration when available. 1190 When configuring CAN FD capable CAN controllers an additional 'data' bitrate
1191 has to be set. This bitrate for the data phase of the CAN FD frame has to be
1192 at least the bitrate which was configured for the arbitration phase. This
1193 second bitrate is specified analogue to the first bitrate but the bitrate
1194 setting keywords for the 'data' bitrate start with 'd' e.g. dbitrate,
1195 dsample-point, dsjw or dtq and similar settings. When a data bitrate is set
1196 within the configuration process the controller option "fd on" can be
1197 specified to enable the CAN FD mode in the CAN controller. This controller
1198 option also switches the device MTU to 72 (CANFD_MTU).
1199
1200 The first CAN FD specification presented as whitepaper at the International
1201 CAN Conference 2012 needed to be improved for data integrity reasons.
1202 Therefore two CAN FD implementations have to be distinguished today:
1203
1204 - ISO compliant: The ISO 11898-1:2015 CAN FD implementation (default)
1205 - non-ISO compliant: The CAN FD implementation following the 2012 whitepaper
1206
1207 Finally there are three types of CAN FD controllers:
1208
1209 1. ISO compliant (fixed)
1210 2. non-ISO compliant (fixed, like the M_CAN IP core v3.0.1 in m_can.c)
1211 3. ISO/non-ISO CAN FD controllers (switchable, like the PEAK PCAN-USB FD)
1212
1213 The current ISO/non-ISO mode is announced by the CAN controller driver via
1214 netlink and displayed by the 'ip' tool (controller option FD-NON-ISO).
1215 The ISO/non-ISO-mode can be altered by setting 'fd-non-iso {on|off}' for
1216 switchable CAN FD controllers only.
1217
1218 Example configuring 500 kbit/s arbitration bitrate and 4 Mbit/s data bitrate:
1219
1220 $ ip link set can0 up type can bitrate 500000 sample-point 0.75 \
1221 dbitrate 4000000 dsample-point 0.8 fd on
1222 $ ip -details link show can0
1223 5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UNKNOWN \
1224 mode DEFAULT group default qlen 10
1225 link/can promiscuity 0
1226 can <FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
1227 bitrate 500000 sample-point 0.750
1228 tq 50 prop-seg 14 phase-seg1 15 phase-seg2 10 sjw 1
1229 pcan_usb_pro_fd: tseg1 1..64 tseg2 1..16 sjw 1..16 brp 1..1024 \
1230 brp-inc 1
1231 dbitrate 4000000 dsample-point 0.800
1232 dtq 12 dprop-seg 7 dphase-seg1 8 dphase-seg2 4 dsjw 1
1233 pcan_usb_pro_fd: dtseg1 1..16 dtseg2 1..8 dsjw 1..4 dbrp 1..1024 \
1234 dbrp-inc 1
1235 clock 80000000
1236
1237 Example when 'fd-non-iso on' is added on this switchable CAN FD adapter:
1238 can <FD,FD-NON-ISO> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
1182 1239
1183 6.7 Supported CAN hardware 1240 6.7 Supported CAN hardware
1184 1241