Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Marc Kleine-Budde says:

====================
pull-request: can-next 2024-06-21

The first 2 patches are by Andy Shevchenko, one cleans up the includes
in the mcp251x driver, the other one updates the sja100 plx_pci driver
to make use of predefines PCI subvendor ID.

Mans Rullgard's patch cleans up the Kconfig help text of for the slcan
driver.

Oliver Hartkopp provides a patch to update the documentation, which
removes the ISO 15675-2 specification version where possible.

The next 2 patches are by Harini T and update the documentation of the
xilinx_can driver.

Francesco Valla provides documentation for the ISO 15765-2 protocol.

A patch by Dr. David Alan Gilbert removes an unused struct from the
mscan driver.

12 patches are by Martin Jocic. The first three add support for 3 new
devices to the kvaser_usb driver. The remaining 9 first clean up the
kvaser_pciefd driver, and then add support for MSI.

Krzysztof Kozlowski contributes 3 patches simplifies the CAN SPI
drivers by making use of spi_get_device_match_data().

The last patch is by Martin Hundebøll, which reworks the m_can driver
to not enable the CAN transceiver during probe.

* tag 'linux-can-next-for-6.11-20240621' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: (24 commits)
can: m_can: don't enable transceiver when probing
can: mcp251xfd: simplify with spi_get_device_match_data()
can: mcp251x: simplify with spi_get_device_match_data()
can: hi311x: simplify with spi_get_device_match_data()
can: kvaser_pciefd: Add MSI interrupts
can: kvaser_pciefd: Move reset of DMA RX buffers to the end of the ISR
can: kvaser_pciefd: Change name of return code variable
can: kvaser_pciefd: Rename board_irq to pci_irq
can: kvaser_pciefd: Add unlikely
can: kvaser_pciefd: Add inline
can: kvaser_pciefd: Remove unnecessary comment
can: kvaser_pciefd: Skip redundant NULL pointer check in ISR
can: kvaser_pciefd: Group #defines together
can: kvaser_usb: Add support for Kvaser Mini PCIe 1xCAN
can: kvaser_usb: Add support for Kvaser USBcan Pro 5xCAN
can: kvaser_usb: Add support for Vining 800
can: mscan: remove unused struct 'mscan_state'
Documentation: networking: document ISO 15765-2
can: xilinx_can: Document driver description to list all supported IPs
can: isotp: remove ISO 15675-2 specification version where possible
...
====================

Link: https://patch.msgid.link/20240621080201.305471-1-mkl@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+612 -172
+1 -1
Documentation/devicetree/bindings/net/can/xilinx,can.yaml
··· 5 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 7 title: 8 - Xilinx Axi CAN/Zynq CANPS controller 8 + Xilinx CAN and CANFD controller 9 9 10 10 maintainers: 11 11 - Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
+1
Documentation/networking/index.rst
··· 19 19 caif/index 20 20 ethtool-netlink 21 21 ieee802154 22 + iso15765-2 22 23 j1939 23 24 kapi 24 25 msg_zerocopy
+386
Documentation/networking/iso15765-2.rst
··· 1 + .. SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) 2 + 3 + ==================== 4 + ISO 15765-2 (ISO-TP) 5 + ==================== 6 + 7 + Overview 8 + ======== 9 + 10 + ISO 15765-2, also known as ISO-TP, is a transport protocol specifically defined 11 + for diagnostic communication on CAN. It is widely used in the automotive 12 + industry, for example as the transport protocol for UDSonCAN (ISO 14229-3) or 13 + emission-related diagnostic services (ISO 15031-5). 14 + 15 + ISO-TP can be used both on CAN CC (aka Classical CAN) and CAN FD (CAN with 16 + Flexible Datarate) based networks. It is also designed to be compatible with a 17 + CAN network using SAE J1939 as data link layer (however, this is not a 18 + requirement). 19 + 20 + Specifications used 21 + ------------------- 22 + 23 + * ISO 15765-2:2024 : Road vehicles - Diagnostic communication over Controller 24 + Area Network (DoCAN). Part 2: Transport protocol and network layer services. 25 + 26 + Addressing 27 + ---------- 28 + 29 + In its simplest form, ISO-TP is based on two kinds of addressing modes for the 30 + nodes connected to the same network: 31 + 32 + * physical addressing is implemented by two node-specific addresses and is used 33 + in 1-to-1 communication. 34 + 35 + * functional addressing is implemented by one node-specific address and is used 36 + in 1-to-N communication. 37 + 38 + Three different addressing formats can be employed: 39 + 40 + * "normal" : each address is represented simply by a CAN ID. 41 + 42 + * "extended": each address is represented by a CAN ID plus the first byte of 43 + the CAN payload; both the CAN ID and the byte inside the payload shall be 44 + different between two addresses. 45 + 46 + * "mixed": each address is represented by a CAN ID plus the first byte of 47 + the CAN payload; the CAN ID is different between two addresses, but the 48 + additional byte is the same. 49 + 50 + Transport protocol and associated frame types 51 + --------------------------------------------- 52 + 53 + When transmitting data using the ISO-TP protocol, the payload can either fit 54 + inside one single CAN message or not, also considering the overhead the protocol 55 + is generating and the optional extended addressing. In the first case, the data 56 + is transmitted at once using a so-called Single Frame (SF). In the second case, 57 + ISO-TP defines a multi-frame protocol, in which the sender provides (through a 58 + First Frame - FF) the PDU length which is to be transmitted and also asks for a 59 + Flow Control (FC) frame, which provides the maximum supported size of a macro 60 + data block (``blocksize``) and the minimum time between the single CAN messages 61 + composing such block (``stmin``). Once this information has been received, the 62 + sender starts to send frames containing fragments of the data payload (called 63 + Consecutive Frames - CF), stopping after every ``blocksize``-sized block to wait 64 + confirmation from the receiver which should then send another Flow Control 65 + frame to inform the sender about its availability to receive more data. 66 + 67 + How to Use ISO-TP 68 + ================= 69 + 70 + As with others CAN protocols, the ISO-TP stack support is built into the 71 + Linux network subsystem for the CAN bus, aka. Linux-CAN or SocketCAN, and 72 + thus follows the same socket API. 73 + 74 + Creation and basic usage of an ISO-TP socket 75 + -------------------------------------------- 76 + 77 + To use the ISO-TP stack, ``#include <linux/can/isotp.h>`` shall be used. A 78 + socket can then be created using the ``PF_CAN`` protocol family, the 79 + ``SOCK_DGRAM`` type (as the underlying protocol is datagram-based by design) 80 + and the ``CAN_ISOTP`` protocol: 81 + 82 + .. code-block:: C 83 + 84 + s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP); 85 + 86 + After the socket has been successfully created, ``bind(2)`` shall be called to 87 + bind the socket to the desired CAN interface; to do so: 88 + 89 + * a TX CAN ID shall be specified as part of the sockaddr supplied to the call 90 + itself. 91 + 92 + * a RX CAN ID shall also be specified, unless broadcast flags have been set 93 + through socket option (explained below). 94 + 95 + Once bound to an interface, the socket can be read from and written to using 96 + the usual ``read(2)`` and ``write(2)`` system calls, as well as ``send(2)``, 97 + ``sendmsg(2)``, ``recv(2)`` and ``recvmsg(2)``. 98 + Unlike the CAN_RAW socket API, only the ISO-TP data field (the actual payload) 99 + is sent and received by the userspace application using these calls. The address 100 + information and the protocol information are automatically filled by the ISO-TP 101 + stack using the configuration supplied during socket creation. In the same way, 102 + the stack will use the transport mechanism when required (i.e., when the size 103 + of the data payload exceeds the MTU of the underlying CAN bus). 104 + 105 + The sockaddr structure used for SocketCAN has extensions for use with ISO-TP, 106 + as specified below: 107 + 108 + .. code-block:: C 109 + 110 + struct sockaddr_can { 111 + sa_family_t can_family; 112 + int can_ifindex; 113 + union { 114 + struct { canid_t rx_id, tx_id; } tp; 115 + ... 116 + } can_addr; 117 + } 118 + 119 + * ``can_family`` and ``can_ifindex`` serve the same purpose as for other 120 + SocketCAN sockets. 121 + 122 + * ``can_addr.tp.rx_id`` specifies the receive (RX) CAN ID and will be used as 123 + a RX filter. 124 + 125 + * ``can_addr.tp.tx_id`` specifies the transmit (TX) CAN ID 126 + 127 + ISO-TP socket options 128 + --------------------- 129 + 130 + When creating an ISO-TP socket, reasonable defaults are set. Some options can 131 + be modified with ``setsockopt(2)`` and/or read back with ``getsockopt(2)``. 132 + 133 + General options 134 + ~~~~~~~~~~~~~~~ 135 + 136 + General socket options can be passed using the ``CAN_ISOTP_OPTS`` optname: 137 + 138 + .. code-block:: C 139 + 140 + struct can_isotp_options opts; 141 + ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts)) 142 + 143 + where the ``can_isotp_options`` structure has the following contents: 144 + 145 + .. code-block:: C 146 + 147 + struct can_isotp_options { 148 + u32 flags; 149 + u32 frame_txtime; 150 + u8 ext_address; 151 + u8 txpad_content; 152 + u8 rxpad_content; 153 + u8 rx_ext_address; 154 + }; 155 + 156 + * ``flags``: modifiers to be applied to the default behaviour of the ISO-TP 157 + stack. Following flags are available: 158 + 159 + * ``CAN_ISOTP_LISTEN_MODE``: listen only (do not send FC frames); normally 160 + used as a testing feature. 161 + 162 + * ``CAN_ISOTP_EXTEND_ADDR``: use the byte specified in ``ext_address`` as an 163 + additional address component. This enables the "mixed" addressing format if 164 + used alone, or the "extended" addressing format if used in conjunction with 165 + ``CAN_ISOTP_RX_EXT_ADDR``. 166 + 167 + * ``CAN_ISOTP_TX_PADDING``: enable padding for transmitted frames, using 168 + ``txpad_content`` as value for the padding bytes. 169 + 170 + * ``CAN_ISOTP_RX_PADDING``: enable padding for the received frames, using 171 + ``rxpad_content`` as value for the padding bytes. 172 + 173 + * ``CAN_ISOTP_CHK_PAD_LEN``: check for correct padding length on the received 174 + frames. 175 + 176 + * ``CAN_ISOTP_CHK_PAD_DATA``: check padding bytes on the received frames 177 + against ``rxpad_content``; if ``CAN_ISOTP_RX_PADDING`` is not specified, 178 + this flag is ignored. 179 + 180 + * ``CAN_ISOTP_HALF_DUPLEX``: force ISO-TP socket in half duplex mode 181 + (that is, transport mechanism can only be incoming or outgoing at the same 182 + time, not both). 183 + 184 + * ``CAN_ISOTP_FORCE_TXSTMIN``: ignore stmin from received FC; normally 185 + used as a testing feature. 186 + 187 + * ``CAN_ISOTP_FORCE_RXSTMIN``: ignore CFs depending on rx stmin; normally 188 + used as a testing feature. 189 + 190 + * ``CAN_ISOTP_RX_EXT_ADDR``: use ``rx_ext_address`` instead of ``ext_address`` 191 + as extended addressing byte on the reception path. If used in conjunction 192 + with ``CAN_ISOTP_EXTEND_ADDR``, this flag effectively enables the "extended" 193 + addressing format. 194 + 195 + * ``CAN_ISOTP_WAIT_TX_DONE``: wait until the frame is sent before returning 196 + from ``write(2)`` and ``send(2)`` calls (i.e., blocking write operations). 197 + 198 + * ``CAN_ISOTP_SF_BROADCAST``: use 1-to-N functional addressing (cannot be 199 + specified alongside ``CAN_ISOTP_CF_BROADCAST``). 200 + 201 + * ``CAN_ISOTP_CF_BROADCAST``: use 1-to-N transmission without flow control 202 + (cannot be specified alongside ``CAN_ISOTP_SF_BROADCAST``). 203 + NOTE: this is not covered by the ISO 15765-2 standard. 204 + 205 + * ``CAN_ISOTP_DYN_FC_PARMS``: enable dynamic update of flow control 206 + parameters. 207 + 208 + * ``frame_txtime``: frame transmission time (defined as N_As/N_Ar inside the 209 + ISO standard); if ``0``, the default (or the last set value) is used. 210 + To set the transmission time to ``0``, the ``CAN_ISOTP_FRAME_TXTIME_ZERO`` 211 + macro (equal to 0xFFFFFFFF) shall be used. 212 + 213 + * ``ext_address``: extended addressing byte, used if the 214 + ``CAN_ISOTP_EXTEND_ADDR`` flag is specified. 215 + 216 + * ``txpad_content``: byte used as padding value for transmitted frames. 217 + 218 + * ``rxpad_content``: byte used as padding value for received frames. 219 + 220 + * ``rx_ext_address``: extended addressing byte for the reception path, used if 221 + the ``CAN_ISOTP_RX_EXT_ADDR`` flag is specified. 222 + 223 + Flow Control options 224 + ~~~~~~~~~~~~~~~~~~~~ 225 + 226 + Flow Control (FC) options can be passed using the ``CAN_ISOTP_RECV_FC`` optname 227 + to provide the communication parameters for receiving ISO-TP PDUs. 228 + 229 + .. code-block:: C 230 + 231 + struct can_isotp_fc_options fc_opts; 232 + ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_RECV_FC, &fc_opts, sizeof(fc_opts)); 233 + 234 + where the ``can_isotp_fc_options`` structure has the following contents: 235 + 236 + .. code-block:: C 237 + 238 + struct can_isotp_options { 239 + u8 bs; 240 + u8 stmin; 241 + u8 wftmax; 242 + }; 243 + 244 + * ``bs``: blocksize provided in flow control frames. 245 + 246 + * ``stmin``: minimum separation time provided in flow control frames; can 247 + have the following values (others are reserved): 248 + 249 + * 0x00 - 0x7F : 0 - 127 ms 250 + 251 + * 0xF1 - 0xF9 : 100 us - 900 us 252 + 253 + * ``wftmax``: maximum number of wait frames provided in flow control frames. 254 + 255 + Link Layer options 256 + ~~~~~~~~~~~~~~~~~~ 257 + 258 + Link Layer (LL) options can be passed using the ``CAN_ISOTP_LL_OPTS`` optname: 259 + 260 + .. code-block:: C 261 + 262 + struct can_isotp_ll_options ll_opts; 263 + ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_LL_OPTS, &ll_opts, sizeof(ll_opts)); 264 + 265 + where the ``can_isotp_ll_options`` structure has the following contents: 266 + 267 + .. code-block:: C 268 + 269 + struct can_isotp_ll_options { 270 + u8 mtu; 271 + u8 tx_dl; 272 + u8 tx_flags; 273 + }; 274 + 275 + * ``mtu``: generated and accepted CAN frame type, can be equal to ``CAN_MTU`` 276 + for classical CAN frames or ``CANFD_MTU`` for CAN FD frames. 277 + 278 + * ``tx_dl``: maximum payload length for transmitted frames, can have one value 279 + among: 8, 12, 16, 20, 24, 32, 48, 64. Values above 8 only apply to CAN FD 280 + traffic (i.e.: ``mtu = CANFD_MTU``). 281 + 282 + * ``tx_flags``: flags set into ``struct canfd_frame.flags`` at frame creation. 283 + Only applies to CAN FD traffic (i.e.: ``mtu = CANFD_MTU``). 284 + 285 + Transmission stmin 286 + ~~~~~~~~~~~~~~~~~~ 287 + 288 + The transmission minimum separation time (stmin) can be forced using the 289 + ``CAN_ISOTP_TX_STMIN`` optname and providing an stmin value in microseconds as 290 + a 32bit unsigned integer; this will overwrite the value sent by the receiver in 291 + flow control frames: 292 + 293 + .. code-block:: C 294 + 295 + uint32_t stmin; 296 + ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_TX_STMIN, &stmin, sizeof(stmin)); 297 + 298 + Reception stmin 299 + ~~~~~~~~~~~~~~~ 300 + 301 + The reception minimum separation time (stmin) can be forced using the 302 + ``CAN_ISOTP_RX_STMIN`` optname and providing an stmin value in microseconds as 303 + a 32bit unsigned integer; received Consecutive Frames (CF) which timestamps 304 + differ less than this value will be ignored: 305 + 306 + .. code-block:: C 307 + 308 + uint32_t stmin; 309 + ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_RX_STMIN, &stmin, sizeof(stmin)); 310 + 311 + Multi-frame transport support 312 + ----------------------------- 313 + 314 + The ISO-TP stack contained inside the Linux kernel supports the multi-frame 315 + transport mechanism defined by the standard, with the following constraints: 316 + 317 + * the maximum size of a PDU is defined by a module parameter, with an hard 318 + limit imposed at build time. 319 + 320 + * when a transmission is in progress, subsequent calls to ``write(2)`` will 321 + block, while calls to ``send(2)`` will either block or fail depending on the 322 + presence of the ``MSG_DONTWAIT`` flag. 323 + 324 + * no support is present for sending "wait frames": whether a PDU can be fully 325 + received or not is decided when the First Frame is received. 326 + 327 + Errors 328 + ------ 329 + 330 + Following errors are reported to userspace: 331 + 332 + RX path errors 333 + ~~~~~~~~~~~~~~ 334 + 335 + ============ =============================================================== 336 + -ETIMEDOUT timeout of data reception 337 + -EILSEQ sequence number mismatch during a multi-frame reception 338 + -EBADMSG data reception with wrong padding 339 + ============ =============================================================== 340 + 341 + TX path errors 342 + ~~~~~~~~~~~~~~ 343 + 344 + ========== ================================================================= 345 + -ECOMM flow control reception timeout 346 + -EMSGSIZE flow control reception overflow 347 + -EBADMSG flow control reception with wrong layout/padding 348 + ========== ================================================================= 349 + 350 + Examples 351 + ======== 352 + 353 + Basic node example 354 + ------------------ 355 + 356 + Following example implements a node using "normal" physical addressing, with 357 + RX ID equal to 0x18DAF142 and a TX ID equal to 0x18DA42F1. All options are left 358 + to their default. 359 + 360 + .. code-block:: C 361 + 362 + int s; 363 + struct sockaddr_can addr; 364 + int ret; 365 + 366 + s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP); 367 + if (s < 0) 368 + exit(1); 369 + 370 + addr.can_family = AF_CAN; 371 + addr.can_ifindex = if_nametoindex("can0"); 372 + addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG; 373 + addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG; 374 + 375 + ret = bind(s, (struct sockaddr *)&addr, sizeof(addr)); 376 + if (ret < 0) 377 + exit(1); 378 + 379 + /* Data can now be received using read(s, ...) and sent using write(s, ...) */ 380 + 381 + Additional examples 382 + ------------------- 383 + 384 + More complete (and complex) examples can be found inside the ``isotp*`` userland 385 + tools, distributed as part of the ``can-utils`` utilities at: 386 + https://github.com/linux-can/can-utils
+1
MAINTAINERS
··· 4842 4842 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git 4843 4843 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git 4844 4844 F: Documentation/networking/can.rst 4845 + F: Documentation/networking/iso15765-2.rst 4845 4846 F: include/linux/can/can-ml.h 4846 4847 F: include/linux/can/core.h 4847 4848 F: include/linux/can/skb.h
+2 -3
drivers/net/can/Kconfig
··· 187 187 slcand) can be found in the can-utils at the linux-can project, see 188 188 https://github.com/linux-can/can-utils for details. 189 189 190 - The slcan driver supports up to 10 CAN netdevices by default which 191 - can be changed by the 'maxdev=xx' module option. This driver can 192 - also be built as a module. If so, the module will be called slcan. 190 + This driver can also be built as a module. If so, the module 191 + will be called slcan. 193 192 194 193 config CAN_SUN4I 195 194 tristate "Allwinner A10 CAN controller"
+76 -61
drivers/net/can/kvaser_pciefd.c
··· 29 29 #define KVASER_PCIEFD_CAN_TX_MAX_COUNT 17U 30 30 #define KVASER_PCIEFD_MAX_CAN_CHANNELS 8UL 31 31 #define KVASER_PCIEFD_DMA_COUNT 2U 32 - 33 32 #define KVASER_PCIEFD_DMA_SIZE (4U * 1024U) 34 33 35 34 #define KVASER_PCIEFD_VENDOR 0x1a07 35 + 36 36 /* Altera based devices */ 37 37 #define KVASER_PCIEFD_4HS_DEVICE_ID 0x000d 38 38 #define KVASER_PCIEFD_2HS_V2_DEVICE_ID 0x000e ··· 550 550 spin_unlock_irqrestore(&can->lock, irq); 551 551 } 552 552 553 - static void kvaser_pciefd_set_tx_irq(struct kvaser_pciefd_can *can) 553 + static inline void kvaser_pciefd_set_tx_irq(struct kvaser_pciefd_can *can) 554 554 { 555 555 u32 msk; 556 556 ··· 711 711 712 712 static int kvaser_pciefd_open(struct net_device *netdev) 713 713 { 714 - int err; 714 + int ret; 715 715 struct kvaser_pciefd_can *can = netdev_priv(netdev); 716 716 717 - err = open_candev(netdev); 718 - if (err) 719 - return err; 717 + ret = open_candev(netdev); 718 + if (ret) 719 + return ret; 720 720 721 - err = kvaser_pciefd_bus_on(can); 722 - if (err) { 721 + ret = kvaser_pciefd_bus_on(can); 722 + if (ret) { 723 723 close_candev(netdev); 724 - return err; 724 + return ret; 725 725 } 726 726 727 727 return 0; ··· 1032 1032 int i; 1033 1033 1034 1034 for (i = 0; i < pcie->nr_channels; i++) { 1035 - int err = register_candev(pcie->can[i]->can.dev); 1035 + int ret = register_candev(pcie->can[i]->can.dev); 1036 1036 1037 - if (err) { 1037 + if (ret) { 1038 1038 int j; 1039 1039 1040 1040 /* Unregister all successfully registered devices. */ 1041 1041 for (j = 0; j < i; j++) 1042 1042 unregister_candev(pcie->can[j]->can.dev); 1043 - return err; 1043 + return ret; 1044 1044 } 1045 1045 } 1046 1046 ··· 1619 1619 /* Position does not point to the end of the package, 1620 1620 * corrupted packet size? 1621 1621 */ 1622 - if ((*start_pos + size) != pos) 1622 + if (unlikely((*start_pos + size) != pos)) 1623 1623 return -EIO; 1624 1624 1625 1625 /* Point to the next packet header, if any */ ··· 1640 1640 return res; 1641 1641 } 1642 1642 1643 - static void kvaser_pciefd_receive_irq(struct kvaser_pciefd *pcie) 1643 + static u32 kvaser_pciefd_receive_irq(struct kvaser_pciefd *pcie) 1644 1644 { 1645 1645 u32 irq = ioread32(KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IRQ_REG); 1646 1646 1647 - if (irq & KVASER_PCIEFD_SRB_IRQ_DPD0) { 1647 + if (irq & KVASER_PCIEFD_SRB_IRQ_DPD0) 1648 1648 kvaser_pciefd_read_buffer(pcie, 0); 1649 - /* Reset DMA buffer 0 */ 1650 - iowrite32(KVASER_PCIEFD_SRB_CMD_RDB0, 1651 - KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG); 1652 - } 1653 1649 1654 - if (irq & KVASER_PCIEFD_SRB_IRQ_DPD1) { 1650 + if (irq & KVASER_PCIEFD_SRB_IRQ_DPD1) 1655 1651 kvaser_pciefd_read_buffer(pcie, 1); 1656 - /* Reset DMA buffer 1 */ 1657 - iowrite32(KVASER_PCIEFD_SRB_CMD_RDB1, 1658 - KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG); 1659 - } 1660 1652 1661 - if (irq & KVASER_PCIEFD_SRB_IRQ_DOF0 || 1662 - irq & KVASER_PCIEFD_SRB_IRQ_DOF1 || 1663 - irq & KVASER_PCIEFD_SRB_IRQ_DUF0 || 1664 - irq & KVASER_PCIEFD_SRB_IRQ_DUF1) 1653 + if (unlikely(irq & KVASER_PCIEFD_SRB_IRQ_DOF0 || 1654 + irq & KVASER_PCIEFD_SRB_IRQ_DOF1 || 1655 + irq & KVASER_PCIEFD_SRB_IRQ_DUF0 || 1656 + irq & KVASER_PCIEFD_SRB_IRQ_DUF1)) 1665 1657 dev_err(&pcie->pci->dev, "DMA IRQ error 0x%08X\n", irq); 1666 1658 1667 1659 iowrite32(irq, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IRQ_REG); 1660 + return irq; 1668 1661 } 1669 1662 1670 1663 static void kvaser_pciefd_transmit_irq(struct kvaser_pciefd_can *can) ··· 1684 1691 { 1685 1692 struct kvaser_pciefd *pcie = (struct kvaser_pciefd *)dev; 1686 1693 const struct kvaser_pciefd_irq_mask *irq_mask = pcie->driver_data->irq_mask; 1687 - u32 board_irq = ioread32(KVASER_PCIEFD_PCI_IRQ_ADDR(pcie)); 1694 + u32 pci_irq = ioread32(KVASER_PCIEFD_PCI_IRQ_ADDR(pcie)); 1695 + u32 srb_irq = 0; 1688 1696 int i; 1689 1697 1690 - if (!(board_irq & irq_mask->all)) 1698 + if (!(pci_irq & irq_mask->all)) 1691 1699 return IRQ_NONE; 1692 1700 1693 - if (board_irq & irq_mask->kcan_rx0) 1694 - kvaser_pciefd_receive_irq(pcie); 1701 + if (pci_irq & irq_mask->kcan_rx0) 1702 + srb_irq = kvaser_pciefd_receive_irq(pcie); 1695 1703 1696 1704 for (i = 0; i < pcie->nr_channels; i++) { 1697 - if (!pcie->can[i]) { 1698 - dev_err(&pcie->pci->dev, 1699 - "IRQ mask points to unallocated controller\n"); 1700 - break; 1701 - } 1702 - 1703 - /* Check that mask matches channel (i) IRQ mask */ 1704 - if (board_irq & irq_mask->kcan_tx[i]) 1705 + if (pci_irq & irq_mask->kcan_tx[i]) 1705 1706 kvaser_pciefd_transmit_irq(pcie->can[i]); 1707 + } 1708 + 1709 + if (srb_irq & KVASER_PCIEFD_SRB_IRQ_DPD0) { 1710 + /* Reset DMA buffer 0, may trigger new interrupt */ 1711 + iowrite32(KVASER_PCIEFD_SRB_CMD_RDB0, 1712 + KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG); 1713 + } 1714 + 1715 + if (srb_irq & KVASER_PCIEFD_SRB_IRQ_DPD1) { 1716 + /* Reset DMA buffer 1, may trigger new interrupt */ 1717 + iowrite32(KVASER_PCIEFD_SRB_CMD_RDB1, 1718 + KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG); 1706 1719 } 1707 1720 1708 1721 return IRQ_HANDLED; ··· 1732 1733 static int kvaser_pciefd_probe(struct pci_dev *pdev, 1733 1734 const struct pci_device_id *id) 1734 1735 { 1735 - int err; 1736 + int ret; 1736 1737 struct kvaser_pciefd *pcie; 1737 1738 const struct kvaser_pciefd_irq_mask *irq_mask; 1738 1739 void __iomem *irq_en_base; ··· 1746 1747 pcie->driver_data = (const struct kvaser_pciefd_driver_data *)id->driver_data; 1747 1748 irq_mask = pcie->driver_data->irq_mask; 1748 1749 1749 - err = pci_enable_device(pdev); 1750 - if (err) 1751 - return err; 1750 + ret = pci_enable_device(pdev); 1751 + if (ret) 1752 + return ret; 1752 1753 1753 - err = pci_request_regions(pdev, KVASER_PCIEFD_DRV_NAME); 1754 - if (err) 1754 + ret = pci_request_regions(pdev, KVASER_PCIEFD_DRV_NAME); 1755 + if (ret) 1755 1756 goto err_disable_pci; 1756 1757 1757 1758 pcie->reg_base = pci_iomap(pdev, 0, 0); 1758 1759 if (!pcie->reg_base) { 1759 - err = -ENOMEM; 1760 + ret = -ENOMEM; 1760 1761 goto err_release_regions; 1761 1762 } 1762 1763 1763 - err = kvaser_pciefd_setup_board(pcie); 1764 - if (err) 1764 + ret = kvaser_pciefd_setup_board(pcie); 1765 + if (ret) 1765 1766 goto err_pci_iounmap; 1766 1767 1767 - err = kvaser_pciefd_setup_dma(pcie); 1768 - if (err) 1768 + ret = kvaser_pciefd_setup_dma(pcie); 1769 + if (ret) 1769 1770 goto err_pci_iounmap; 1770 1771 1771 1772 pci_set_master(pdev); 1772 1773 1773 - err = kvaser_pciefd_setup_can_ctrls(pcie); 1774 - if (err) 1774 + ret = kvaser_pciefd_setup_can_ctrls(pcie); 1775 + if (ret) 1775 1776 goto err_teardown_can_ctrls; 1776 1777 1777 - err = request_irq(pcie->pci->irq, kvaser_pciefd_irq_handler, 1778 + ret = pci_alloc_irq_vectors(pcie->pci, 1, 1, PCI_IRQ_INTX | PCI_IRQ_MSI); 1779 + if (ret < 0) { 1780 + dev_err(&pcie->pci->dev, "Failed to allocate IRQ vectors.\n"); 1781 + goto err_teardown_can_ctrls; 1782 + } 1783 + 1784 + ret = pci_irq_vector(pcie->pci, 0); 1785 + if (ret < 0) 1786 + goto err_pci_free_irq_vectors; 1787 + 1788 + pcie->pci->irq = ret; 1789 + 1790 + ret = request_irq(pcie->pci->irq, kvaser_pciefd_irq_handler, 1778 1791 IRQF_SHARED, KVASER_PCIEFD_DRV_NAME, pcie); 1779 - if (err) 1780 - goto err_teardown_can_ctrls; 1781 - 1792 + if (ret) { 1793 + dev_err(&pcie->pci->dev, "Failed to request IRQ %d\n", pcie->pci->irq); 1794 + goto err_pci_free_irq_vectors; 1795 + } 1782 1796 iowrite32(KVASER_PCIEFD_SRB_IRQ_DPD0 | KVASER_PCIEFD_SRB_IRQ_DPD1, 1783 1797 KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IRQ_REG); 1784 1798 ··· 1809 1797 iowrite32(KVASER_PCIEFD_SRB_CMD_RDB1, 1810 1798 KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG); 1811 1799 1812 - err = kvaser_pciefd_reg_candev(pcie); 1813 - if (err) 1800 + ret = kvaser_pciefd_reg_candev(pcie); 1801 + if (ret) 1814 1802 goto err_free_irq; 1815 1803 1816 1804 return 0; ··· 1819 1807 /* Disable PCI interrupts */ 1820 1808 iowrite32(0, irq_en_base); 1821 1809 free_irq(pcie->pci->irq, pcie); 1810 + 1811 + err_pci_free_irq_vectors: 1812 + pci_free_irq_vectors(pcie->pci); 1822 1813 1823 1814 err_teardown_can_ctrls: 1824 1815 kvaser_pciefd_teardown_can_ctrls(pcie); ··· 1837 1822 err_disable_pci: 1838 1823 pci_disable_device(pdev); 1839 1824 1840 - return err; 1825 + return ret; 1841 1826 } 1842 1827 1843 1828 static void kvaser_pciefd_remove_all_ctrls(struct kvaser_pciefd *pcie) ··· 1868 1853 iowrite32(0, KVASER_PCIEFD_PCI_IEN_ADDR(pcie)); 1869 1854 1870 1855 free_irq(pcie->pci->irq, pcie); 1871 - 1856 + pci_free_irq_vectors(pcie->pci); 1872 1857 pci_iounmap(pdev, pcie->reg_base); 1873 1858 pci_release_regions(pdev); 1874 1859 pci_disable_device(pdev);
+104 -61
drivers/net/can/m_can/m_can.c
··· 379 379 return cdev->ops->read_fifo(cdev, addr_offset, val, 1); 380 380 } 381 381 382 - static void m_can_config_endisable(struct m_can_classdev *cdev, bool enable) 382 + static int m_can_cccr_update_bits(struct m_can_classdev *cdev, u32 mask, u32 val) 383 383 { 384 - u32 cccr = m_can_read(cdev, M_CAN_CCCR); 385 - u32 timeout = 10; 386 - u32 val = 0; 384 + u32 val_before = m_can_read(cdev, M_CAN_CCCR); 385 + u32 val_after = (val_before & ~mask) | val; 386 + size_t tries = 10; 387 387 388 - /* Clear the Clock stop request if it was set */ 389 - if (cccr & CCCR_CSR) 390 - cccr &= ~CCCR_CSR; 391 - 392 - if (enable) { 393 - /* enable m_can configuration */ 394 - m_can_write(cdev, M_CAN_CCCR, cccr | CCCR_INIT); 395 - udelay(5); 396 - /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ 397 - m_can_write(cdev, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); 398 - } else { 399 - m_can_write(cdev, M_CAN_CCCR, cccr & ~(CCCR_INIT | CCCR_CCE)); 388 + if (!(mask & CCCR_INIT) && !(val_before & CCCR_INIT)) { 389 + dev_err(cdev->dev, 390 + "refusing to configure device when in normal mode\n"); 391 + return -EBUSY; 400 392 } 401 393 402 - /* there's a delay for module initialization */ 403 - if (enable) 404 - val = CCCR_INIT | CCCR_CCE; 394 + /* The chip should be in standby mode when changing the CCCR register, 395 + * and some chips set the CSR and CSA bits when in standby. Furthermore, 396 + * the CSR and CSA bits should be written as zeros, even when they read 397 + * ones. 398 + */ 399 + val_after &= ~(CCCR_CSR | CCCR_CSA); 405 400 406 - while ((m_can_read(cdev, M_CAN_CCCR) & (CCCR_INIT | CCCR_CCE)) != val) { 407 - if (timeout == 0) { 408 - netdev_warn(cdev->net, "Failed to init module\n"); 409 - return; 410 - } 411 - timeout--; 412 - udelay(1); 401 + while (tries--) { 402 + u32 val_read; 403 + 404 + /* Write the desired value in each try, as setting some bits in 405 + * the CCCR register require other bits to be set first. E.g. 406 + * setting the NISO bit requires setting the CCE bit first. 407 + */ 408 + m_can_write(cdev, M_CAN_CCCR, val_after); 409 + 410 + val_read = m_can_read(cdev, M_CAN_CCCR) & ~(CCCR_CSR | CCCR_CSA); 411 + 412 + if (val_read == val_after) 413 + return 0; 414 + 415 + usleep_range(1, 5); 413 416 } 417 + 418 + return -ETIMEDOUT; 419 + } 420 + 421 + static int m_can_config_enable(struct m_can_classdev *cdev) 422 + { 423 + int err; 424 + 425 + /* CCCR_INIT must be set in order to set CCCR_CCE, but access to 426 + * configuration registers should only be enabled when in standby mode, 427 + * where CCCR_INIT is always set. 428 + */ 429 + err = m_can_cccr_update_bits(cdev, CCCR_CCE, CCCR_CCE); 430 + if (err) 431 + netdev_err(cdev->net, "failed to enable configuration mode\n"); 432 + 433 + return err; 434 + } 435 + 436 + static int m_can_config_disable(struct m_can_classdev *cdev) 437 + { 438 + int err; 439 + 440 + /* Only clear CCCR_CCE, since CCCR_INIT cannot be cleared while in 441 + * standby mode 442 + */ 443 + err = m_can_cccr_update_bits(cdev, CCCR_CCE, 0); 444 + if (err) 445 + netdev_err(cdev->net, "failed to disable configuration registers\n"); 446 + 447 + return err; 414 448 } 415 449 416 450 static void m_can_interrupt_enable(struct m_can_classdev *cdev, u32 interrupts) ··· 1437 1403 interrupts &= ~(IR_ARA | IR_ELO | IR_DRX | IR_TEFF | IR_TFE | IR_TCF | 1438 1404 IR_HPM | IR_RF1F | IR_RF1W | IR_RF1N | IR_RF0F); 1439 1405 1440 - m_can_config_endisable(cdev, true); 1406 + err = m_can_config_enable(cdev); 1407 + if (err) 1408 + return err; 1441 1409 1442 1410 /* RX Buffer/FIFO Element Size 64 bytes data field */ 1443 1411 m_can_write(cdev, M_CAN_RXESC, ··· 1557 1521 FIELD_PREP(TSCC_TCP_MASK, 0xf) | 1558 1522 FIELD_PREP(TSCC_TSS_MASK, TSCC_TSS_INTERNAL)); 1559 1523 1560 - m_can_config_endisable(cdev, false); 1524 + err = m_can_config_disable(cdev); 1525 + if (err) 1526 + return err; 1561 1527 1562 1528 if (cdev->ops->init) 1563 1529 cdev->ops->init(cdev); ··· 1588 1550 cdev->tx_fifo_putidx = FIELD_GET(TXFQS_TFQPI_MASK, 1589 1551 m_can_read(cdev, M_CAN_TXFQS)); 1590 1552 1591 - return 0; 1553 + ret = m_can_cccr_update_bits(cdev, CCCR_INIT, 0); 1554 + if (ret) 1555 + netdev_err(dev, "failed to enter normal mode\n"); 1556 + 1557 + return ret; 1592 1558 } 1593 1559 1594 1560 static int m_can_set_mode(struct net_device *dev, enum can_mode mode) ··· 1641 1599 } 1642 1600 1643 1601 /* Selectable Non ISO support only in version 3.2.x 1644 - * This function checks if the bit is writable. 1602 + * Return 1 if the bit is writable, 0 if it is not, or negative on error. 1645 1603 */ 1646 - static bool m_can_niso_supported(struct m_can_classdev *cdev) 1604 + static int m_can_niso_supported(struct m_can_classdev *cdev) 1647 1605 { 1648 - u32 cccr_reg, cccr_poll = 0; 1649 - int niso_timeout = -ETIMEDOUT; 1650 - int i; 1606 + int ret, niso; 1651 1607 1652 - m_can_config_endisable(cdev, true); 1653 - cccr_reg = m_can_read(cdev, M_CAN_CCCR); 1654 - cccr_reg |= CCCR_NISO; 1655 - m_can_write(cdev, M_CAN_CCCR, cccr_reg); 1608 + ret = m_can_config_enable(cdev); 1609 + if (ret) 1610 + return ret; 1656 1611 1657 - for (i = 0; i <= 10; i++) { 1658 - cccr_poll = m_can_read(cdev, M_CAN_CCCR); 1659 - if (cccr_poll == cccr_reg) { 1660 - niso_timeout = 0; 1661 - break; 1662 - } 1612 + /* First try to set the NISO bit. */ 1613 + niso = m_can_cccr_update_bits(cdev, CCCR_NISO, CCCR_NISO); 1663 1614 1664 - usleep_range(1, 5); 1615 + /* Then clear the it again. */ 1616 + ret = m_can_cccr_update_bits(cdev, CCCR_NISO, 0); 1617 + if (ret) { 1618 + dev_err(cdev->dev, "failed to revert the NON-ISO bit in CCCR\n"); 1619 + return ret; 1665 1620 } 1666 1621 1667 - /* Clear NISO */ 1668 - cccr_reg &= ~(CCCR_NISO); 1669 - m_can_write(cdev, M_CAN_CCCR, cccr_reg); 1622 + ret = m_can_config_disable(cdev); 1623 + if (ret) 1624 + return ret; 1670 1625 1671 - m_can_config_endisable(cdev, false); 1672 - 1673 - /* return false if time out (-ETIMEDOUT), else return true */ 1674 - return !niso_timeout; 1626 + return niso == 0; 1675 1627 } 1676 1628 1677 1629 static int m_can_dev_setup(struct m_can_classdev *cdev) 1678 1630 { 1679 1631 struct net_device *dev = cdev->net; 1680 - int m_can_version, err; 1632 + int m_can_version, err, niso; 1681 1633 1682 1634 m_can_version = m_can_check_core_release(cdev); 1683 1635 /* return if unsupported version */ ··· 1720 1684 cdev->can.bittiming_const = &m_can_bittiming_const_31X; 1721 1685 cdev->can.data_bittiming_const = &m_can_data_bittiming_const_31X; 1722 1686 1723 - cdev->can.ctrlmode_supported |= 1724 - (m_can_niso_supported(cdev) ? 1725 - CAN_CTRLMODE_FD_NON_ISO : 0); 1687 + niso = m_can_niso_supported(cdev); 1688 + if (niso < 0) 1689 + return niso; 1690 + if (niso) 1691 + cdev->can.ctrlmode_supported |= CAN_CTRLMODE_FD_NON_ISO; 1726 1692 break; 1727 1693 default: 1728 1694 dev_err(cdev->dev, "Unsupported version number: %2d", ··· 1732 1694 return -EINVAL; 1733 1695 } 1734 1696 1735 - if (cdev->ops->init) 1736 - cdev->ops->init(cdev); 1737 - 1738 - return 0; 1697 + /* Forcing standby mode should be redundant, as the chip should be in 1698 + * standby after a reset. Write the INIT bit anyways, should the chip 1699 + * be configured by previous stage. 1700 + */ 1701 + return m_can_cccr_update_bits(cdev, CCCR_INIT, CCCR_INIT); 1739 1702 } 1740 1703 1741 1704 static void m_can_stop(struct net_device *dev) 1742 1705 { 1743 1706 struct m_can_classdev *cdev = netdev_priv(dev); 1707 + int ret; 1744 1708 1745 1709 /* disable all interrupts */ 1746 1710 m_can_disable_all_interrupts(cdev); 1747 1711 1748 1712 /* Set init mode to disengage from the network */ 1749 - m_can_config_endisable(cdev, true); 1713 + ret = m_can_cccr_update_bits(cdev, CCCR_INIT, CCCR_INIT); 1714 + if (ret) 1715 + netdev_err(dev, "failed to enter standby mode: %pe\n", 1716 + ERR_PTR(ret)); 1750 1717 1751 1718 /* set the state as STOPPED */ 1752 1719 cdev->can.state = CAN_STATE_STOPPED;
+10 -3
drivers/net/can/m_can/tcan4x5x-core.c
··· 453 453 goto out_power; 454 454 } 455 455 456 - ret = tcan4x5x_init(mcan_class); 456 + tcan4x5x_check_wake(priv); 457 + 458 + ret = tcan4x5x_write_tcan_reg(mcan_class, TCAN4X5X_INT_EN, 0); 457 459 if (ret) { 458 - dev_err(&spi->dev, "tcan initialization failed %pe\n", 459 - ERR_PTR(ret)); 460 + dev_err(&spi->dev, "Disabling interrupts failed %pe\n", ERR_PTR(ret)); 461 + goto out_power; 462 + } 463 + 464 + ret = tcan4x5x_clear_interrupts(mcan_class); 465 + if (ret) { 466 + dev_err(&spi->dev, "Clearing interrupts failed %pe\n", ERR_PTR(ret)); 460 467 goto out_power; 461 468 } 462 469
-6
drivers/net/can/mscan/mscan.c
··· 34 34 .brp_inc = 1, 35 35 }; 36 36 37 - struct mscan_state { 38 - u8 mode; 39 - u8 canrier; 40 - u8 cantier; 41 - }; 42 - 43 37 static enum can_state state_map[] = { 44 38 CAN_STATE_ERROR_ACTIVE, 45 39 CAN_STATE_ERROR_WARNING,
+1 -2
drivers/net/can/sja1000/plx_pci.c
··· 122 122 #define TEWS_PCI_VENDOR_ID 0x1498 123 123 #define TEWS_PCI_DEVICE_ID_TMPC810 0x032A 124 124 125 - #define CTI_PCI_VENDOR_ID 0x12c4 126 125 #define CTI_PCI_DEVICE_ID_CRG001 0x0900 127 126 128 127 #define MOXA_PCI_VENDOR_ID 0x1393 ··· 357 358 { 358 359 /* Connect Tech Inc. CANpro/104-Plus Opto (CRG001) card */ 359 360 PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030, 360 - CTI_PCI_VENDOR_ID, CTI_PCI_DEVICE_ID_CRG001, 361 + PCI_SUBVENDOR_ID_CONNECT_TECH, CTI_PCI_DEVICE_ID_CRG001, 361 362 0, 0, 362 363 (kernel_ulong_t)&plx_pci_card_info_cti 363 364 },
+1 -6
drivers/net/can/spi/hi311x.c
··· 830 830 struct device *dev = &spi->dev; 831 831 struct net_device *net; 832 832 struct hi3110_priv *priv; 833 - const void *match; 834 833 struct clk *clk; 835 834 u32 freq; 836 835 int ret; ··· 873 874 CAN_CTRLMODE_LISTENONLY | 874 875 CAN_CTRLMODE_BERR_REPORTING; 875 876 876 - match = device_get_match_data(dev); 877 - if (match) 878 - priv->model = (enum hi3110_model)(uintptr_t)match; 879 - else 880 - priv->model = spi_get_device_id(spi)->driver_data; 877 + priv->model = (enum hi3110_model)(uintptr_t)spi_get_device_match_data(spi); 881 878 priv->net = net; 882 879 priv->clk = clk; 883 880
+3 -8
drivers/net/can/spi/mcp251x.c
··· 28 28 #include <linux/device.h> 29 29 #include <linux/ethtool.h> 30 30 #include <linux/freezer.h> 31 - #include <linux/gpio.h> 32 31 #include <linux/gpio/driver.h> 33 32 #include <linux/interrupt.h> 34 33 #include <linux/io.h> ··· 481 482 unsigned int offset) 482 483 { 483 484 if (mcp251x_gpio_is_input(offset)) 484 - return GPIOF_DIR_IN; 485 + return GPIO_LINE_DIRECTION_IN; 485 486 486 - return GPIOF_DIR_OUT; 487 + return GPIO_LINE_DIRECTION_OUT; 487 488 } 488 489 489 490 static int mcp251x_gpio_get(struct gpio_chip *chip, unsigned int offset) ··· 1300 1301 1301 1302 static int mcp251x_can_probe(struct spi_device *spi) 1302 1303 { 1303 - const void *match = device_get_match_data(&spi->dev); 1304 1304 struct net_device *net; 1305 1305 struct mcp251x_priv *priv; 1306 1306 struct clk *clk; ··· 1337 1339 priv->can.clock.freq = freq / 2; 1338 1340 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | 1339 1341 CAN_CTRLMODE_LOOPBACK | CAN_CTRLMODE_LISTENONLY; 1340 - if (match) 1341 - priv->model = (enum mcp251x_model)(uintptr_t)match; 1342 - else 1343 - priv->model = spi_get_device_id(spi)->driver_data; 1342 + priv->model = (enum mcp251x_model)(uintptr_t)spi_get_device_match_data(spi); 1344 1343 priv->net = net; 1345 1344 priv->clk = clk; 1346 1345
+1 -8
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
··· 1989 1989 1990 1990 static int mcp251xfd_probe(struct spi_device *spi) 1991 1991 { 1992 - const void *match; 1993 1992 struct net_device *ndev; 1994 1993 struct mcp251xfd_priv *priv; 1995 1994 struct gpio_desc *rx_int; ··· 2080 2081 priv->pll_enable = pll_enable; 2081 2082 priv->reg_vdd = reg_vdd; 2082 2083 priv->reg_xceiver = reg_xceiver; 2083 - 2084 - match = device_get_match_data(&spi->dev); 2085 - if (match) 2086 - priv->devtype_data = *(struct mcp251xfd_devtype_data *)match; 2087 - else 2088 - priv->devtype_data = *(struct mcp251xfd_devtype_data *) 2089 - spi_get_device_id(spi)->driver_data; 2084 + priv->devtype_data = *(struct mcp251xfd_devtype_data *)spi_get_device_match_data(spi); 2090 2085 2091 2086 /* Errata Reference: 2092 2087 * mcp2517fd: DS80000792C 5., mcp2518fd: DS80000789C 4.
+3
drivers/net/can/usb/Kconfig
··· 91 91 - Kvaser Leaf Light R v2 92 92 - Kvaser Mini PCI Express HS 93 93 - Kvaser Mini PCI Express 2xHS 94 + - Kvaser Mini PCIe 1xCAN 94 95 - Kvaser USBcan Light 2xHS 95 96 - Kvaser USBcan II HS/HS 96 97 - Kvaser USBcan II HS/LS ··· 112 111 - Kvaser USBcan Light 4xHS 113 112 - Kvaser USBcan Pro 2xHS v2 114 113 - Kvaser USBcan Pro 4xHS 114 + - Kvaser USBcan Pro 5xCAN 115 115 - Kvaser USBcan Pro 5xHS 116 116 - Kvaser U100 117 117 - Kvaser U100P 118 118 - Kvaser U100S 119 119 - ATI Memorator Pro 2xHS v2 120 120 - ATI USBcan Pro 2xHS v2 121 + - Vining 800 121 122 122 123 If unsure, say N. 123 124
+9
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
··· 89 89 #define USB_HYBRID_CANLIN_PRODUCT_ID 0x0115 90 90 #define USB_HYBRID_PRO_CANLIN_PRODUCT_ID 0x0116 91 91 #define USB_LEAF_V3_PRODUCT_ID 0x0117 92 + #define USB_VINING_800_PRODUCT_ID 0x0119 93 + #define USB_USBCAN_PRO_5XCAN_PRODUCT_ID 0x011A 94 + #define USB_MINI_PCIE_1XCAN_PRODUCT_ID 0x011B 92 95 93 96 static const struct kvaser_usb_driver_info kvaser_usb_driver_info_hydra = { 94 97 .quirks = KVASER_USB_QUIRK_HAS_HARDWARE_TIMESTAMP, ··· 240 237 { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_PRO_CANLIN_PRODUCT_ID), 241 238 .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, 242 239 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_V3_PRODUCT_ID), 240 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, 241 + { USB_DEVICE(KVASER_VENDOR_ID, USB_VINING_800_PRODUCT_ID), 242 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, 243 + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_5XCAN_PRODUCT_ID), 244 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, 245 + { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_1XCAN_PRODUCT_ID), 243 246 .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, 244 247 { } 245 248 };
+1 -1
drivers/net/can/xilinx_can.c
··· 6 6 * Copyright (C) 2017 - 2018 Sandvik Mining and Construction Oy 7 7 * 8 8 * Description: 9 - * This driver is developed for Axi CAN IP and for Zynq CANPS Controller. 9 + * This driver is developed for AXI CAN IP, AXI CANFD IP, CANPS and CANFD PS Controller. 10 10 */ 11 11 12 12 #include <linux/bitfield.h>
+1 -1
include/uapi/linux/can/isotp.h
··· 2 2 /* 3 3 * linux/can/isotp.h 4 4 * 5 - * Definitions for isotp CAN sockets (ISO 15765-2:2016) 5 + * Definitions for ISO 15765-2 CAN transport protocol sockets 6 6 * 7 7 * Copyright (c) 2020 Volkswagen Group Electronic Research 8 8 * All rights reserved.
+5 -6
net/can/Kconfig
··· 56 56 source "net/can/j1939/Kconfig" 57 57 58 58 config CAN_ISOTP 59 - tristate "ISO 15765-2:2016 CAN transport protocol" 59 + tristate "ISO 15765-2 CAN transport protocol" 60 60 help 61 61 CAN Transport Protocols offer support for segmented Point-to-Point 62 62 communication between CAN nodes via two defined CAN Identifiers. 63 + This protocol driver implements segmented data transfers for CAN CC 64 + (aka Classical CAN, CAN 2.0B) and CAN FD frame types which were 65 + introduced with ISO 15765-2:2016. 63 66 As CAN frames can only transport a small amount of data bytes 64 - (max. 8 bytes for 'classic' CAN and max. 64 bytes for CAN FD) this 67 + (max. 8 bytes for CAN CC and max. 64 bytes for CAN FD) this 65 68 segmentation is needed to transport longer Protocol Data Units (PDU) 66 69 as needed e.g. for vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN 67 70 traffic. 68 - This protocol driver implements data transfers according to 69 - ISO 15765-2:2016 for 'classic' CAN and CAN FD frame types. 70 - If you want to perform automotive vehicle diagnostic services (UDS), 71 - say 'y'. 72 71 73 72 endif
+6 -5
net/can/isotp.c
··· 72 72 #include <net/sock.h> 73 73 #include <net/net_namespace.h> 74 74 75 - MODULE_DESCRIPTION("PF_CAN isotp 15765-2:2016 protocol"); 75 + MODULE_DESCRIPTION("PF_CAN ISO 15765-2 transport protocol"); 76 76 MODULE_LICENSE("Dual BSD/GPL"); 77 77 MODULE_AUTHOR("Oliver Hartkopp <socketcan@hartkopp.net>"); 78 78 MODULE_ALIAS("can-proto-6"); ··· 83 83 (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG) : \ 84 84 (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG)) 85 85 86 - /* ISO 15765-2:2016 supports more than 4095 byte per ISO PDU as the FF_DL can 87 - * take full 32 bit values (4 Gbyte). We would need some good concept to handle 88 - * this between user space and kernel space. For now set the static buffer to 89 - * something about 8 kbyte to be able to test this new functionality. 86 + /* Since ISO 15765-2:2016 the CAN isotp protocol supports more than 4095 87 + * byte per ISO PDU as the FF_DL can take full 32 bit values (4 Gbyte). 88 + * We would need some good concept to handle this between user space and 89 + * kernel space. For now set the static buffer to something about 8 kbyte 90 + * to be able to test this new functionality. 90 91 */ 91 92 #define DEFAULT_MAX_PDU_SIZE 8300 92 93