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

Configure Feed

Select the types of activity you want to include in your feed.

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

Marc Kleine-Budde says:

====================
pull-request: can-next 2024-08-30

The first patch is by Duy Nguyen and document the R-Car V4M support in
the rcar-canfd DT bindings.

Frank Li's patch converts the microchip,mcp251x.txt DT bindings
documentation to yaml.

A patch by Zhang Changzhong update a comment in the j1939 CAN
networking stack.

Stefan Mätje's patch updates the CAN configuration netlink code, so
that the bit timing calculation doesn't work on stale
can_priv::ctrlmode data.

Martin Jocic contributes a patch for the kvaser_pciefd driver to
convert some ifdefs into if (IS_ENABLED()).

The last patch is by Yan Zhen and simplifies the probe() function of
the kvaser USB driver by using dev_err_probe().

* tag 'linux-can-next-for-6.12-20240830' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next:
can: kvaser_usb: Simplify with dev_err_probe()
can: kvaser_pciefd: Use IS_ENABLED() instead of #ifdef
can: netlink: avoid call to do_set_data_bittiming callback with stale can_priv::ctrlmode
can: j1939: use correct function name in comment
dt-bindings: can: convert microchip,mcp251x.txt to yaml
dt-bindings: can: renesas,rcar-canfd: Document R-Car V4M support
====================

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

+170 -130
+70
Documentation/devicetree/bindings/net/can/microchip,mcp2510.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/can/microchip,mcp2510.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Microchip MCP251X stand-alone CAN controller 8 + 9 + maintainers: 10 + - Marc Kleine-Budde <mkl@pengutronix.de> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - microchip,mcp2510 16 + - microchip,mcp2515 17 + - microchip,mcp25625 18 + 19 + reg: 20 + maxItems: 1 21 + 22 + clocks: 23 + maxItems: 1 24 + 25 + interrupts: 26 + maxItems: 1 27 + 28 + vdd-supply: 29 + description: Regulator that powers the CAN controller. 30 + 31 + xceiver-supply: 32 + description: Regulator that powers the CAN transceiver. 33 + 34 + gpio-controller: true 35 + 36 + "#gpio-cells": 37 + const: 2 38 + 39 + required: 40 + - compatible 41 + - reg 42 + - clocks 43 + - interrupts 44 + 45 + allOf: 46 + - $ref: /schemas/spi/spi-peripheral-props.yaml# 47 + 48 + unevaluatedProperties: false 49 + 50 + examples: 51 + - | 52 + #include <dt-bindings/interrupt-controller/irq.h> 53 + 54 + spi { 55 + #address-cells = <1>; 56 + #size-cells = <0>; 57 + 58 + can@1 { 59 + compatible = "microchip,mcp2515"; 60 + reg = <1>; 61 + clocks = <&clk24m>; 62 + interrupt-parent = <&gpio4>; 63 + interrupts = <13 IRQ_TYPE_LEVEL_LOW>; 64 + vdd-supply = <&reg5v0>; 65 + xceiver-supply = <&reg5v0>; 66 + gpio-controller; 67 + #gpio-cells = <2>; 68 + }; 69 + }; 70 +
-30
Documentation/devicetree/bindings/net/can/microchip,mcp251x.txt
··· 1 - * Microchip MCP251X stand-alone CAN controller device tree bindings 2 - 3 - Required properties: 4 - - compatible: Should be one of the following: 5 - - "microchip,mcp2510" for MCP2510. 6 - - "microchip,mcp2515" for MCP2515. 7 - - "microchip,mcp25625" for MCP25625. 8 - - reg: SPI chip select. 9 - - clocks: The clock feeding the CAN controller. 10 - - interrupts: Should contain IRQ line for the CAN controller. 11 - 12 - Optional properties: 13 - - vdd-supply: Regulator that powers the CAN controller. 14 - - xceiver-supply: Regulator that powers the CAN transceiver. 15 - - gpio-controller: Indicates this device is a GPIO controller. 16 - - #gpio-cells: Should be two. The first cell is the pin number and 17 - the second cell is used to specify the gpio polarity. 18 - 19 - Example: 20 - can0: can@1 { 21 - compatible = "microchip,mcp2515"; 22 - reg = <1>; 23 - clocks = <&clk24m>; 24 - interrupt-parent = <&gpio4>; 25 - interrupts = <13 IRQ_TYPE_LEVEL_LOW>; 26 - vdd-supply = <&reg5v0>; 27 - xceiver-supply = <&reg5v0>; 28 - gpio-controller; 29 - #gpio-cells = <2>; 30 - };
+16 -6
Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
··· 32 32 - enum: 33 33 - renesas,r8a779a0-canfd # R-Car V3U 34 34 - renesas,r8a779g0-canfd # R-Car V4H 35 + - renesas,r8a779h0-canfd # R-Car V4M 35 36 - const: renesas,rcar-gen4-canfd # R-Car Gen4 36 37 37 38 - items: ··· 164 163 maxItems: 1 165 164 166 165 - if: 167 - not: 168 - properties: 169 - compatible: 170 - contains: 171 - const: renesas,rcar-gen4-canfd 166 + properties: 167 + compatible: 168 + contains: 169 + const: renesas,r8a779h0-canfd 172 170 then: 173 171 patternProperties: 174 - "^channel[2-7]$": false 172 + "^channel[5-7]$": false 173 + else: 174 + if: 175 + not: 176 + properties: 177 + compatible: 178 + contains: 179 + const: renesas,rcar-gen4-canfd 180 + then: 181 + patternProperties: 182 + "^channel[2-7]$": false 175 183 176 184 unevaluatedProperties: false 177 185
+51 -51
drivers/net/can/dev/netlink.c
··· 65 65 if (!data) 66 66 return 0; 67 67 68 - if (data[IFLA_CAN_BITTIMING]) { 69 - struct can_bittiming bt; 70 - 71 - memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); 72 - err = can_validate_bittiming(&bt, extack); 73 - if (err) 74 - return err; 75 - } 76 - 77 68 if (data[IFLA_CAN_CTRLMODE]) { 78 69 struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); 79 70 u32 tdc_flags = cm->flags & CAN_CTRLMODE_TDC_MASK; ··· 103 112 if (!tb_tdc[IFLA_CAN_TDC_TDCO]) 104 113 return -EOPNOTSUPP; 105 114 } 115 + } 116 + 117 + if (data[IFLA_CAN_BITTIMING]) { 118 + struct can_bittiming bt; 119 + 120 + memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); 121 + err = can_validate_bittiming(&bt, extack); 122 + if (err) 123 + return err; 106 124 } 107 125 108 126 if (is_can_fd) { ··· 195 195 /* We need synchronization with dev->stop() */ 196 196 ASSERT_RTNL(); 197 197 198 - if (data[IFLA_CAN_BITTIMING]) { 199 - struct can_bittiming bt; 200 - 201 - /* Do not allow changing bittiming while running */ 202 - if (dev->flags & IFF_UP) 203 - return -EBUSY; 204 - 205 - /* Calculate bittiming parameters based on 206 - * bittiming_const if set, otherwise pass bitrate 207 - * directly via do_set_bitrate(). Bail out if neither 208 - * is given. 209 - */ 210 - if (!priv->bittiming_const && !priv->do_set_bittiming && 211 - !priv->bitrate_const) 212 - return -EOPNOTSUPP; 213 - 214 - memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); 215 - err = can_get_bittiming(dev, &bt, 216 - priv->bittiming_const, 217 - priv->bitrate_const, 218 - priv->bitrate_const_cnt, 219 - extack); 220 - if (err) 221 - return err; 222 - 223 - if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { 224 - NL_SET_ERR_MSG_FMT(extack, 225 - "arbitration bitrate %u bps surpasses transceiver capabilities of %u bps", 226 - bt.bitrate, priv->bitrate_max); 227 - return -EINVAL; 228 - } 229 - 230 - memcpy(&priv->bittiming, &bt, sizeof(bt)); 231 - 232 - if (priv->do_set_bittiming) { 233 - /* Finally, set the bit-timing registers */ 234 - err = priv->do_set_bittiming(dev); 235 - if (err) 236 - return err; 237 - } 238 - } 239 - 240 198 if (data[IFLA_CAN_CTRLMODE]) { 241 199 struct can_ctrlmode *cm; 242 200 u32 ctrlstatic; ··· 240 282 */ 241 283 if (tdc_mask) 242 284 priv->ctrlmode &= cm->flags | ~CAN_CTRLMODE_TDC_MASK; 285 + } 286 + 287 + if (data[IFLA_CAN_BITTIMING]) { 288 + struct can_bittiming bt; 289 + 290 + /* Do not allow changing bittiming while running */ 291 + if (dev->flags & IFF_UP) 292 + return -EBUSY; 293 + 294 + /* Calculate bittiming parameters based on 295 + * bittiming_const if set, otherwise pass bitrate 296 + * directly via do_set_bitrate(). Bail out if neither 297 + * is given. 298 + */ 299 + if (!priv->bittiming_const && !priv->do_set_bittiming && 300 + !priv->bitrate_const) 301 + return -EOPNOTSUPP; 302 + 303 + memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); 304 + err = can_get_bittiming(dev, &bt, 305 + priv->bittiming_const, 306 + priv->bitrate_const, 307 + priv->bitrate_const_cnt, 308 + extack); 309 + if (err) 310 + return err; 311 + 312 + if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { 313 + NL_SET_ERR_MSG_FMT(extack, 314 + "arbitration bitrate %u bps surpasses transceiver capabilities of %u bps", 315 + bt.bitrate, priv->bitrate_max); 316 + return -EINVAL; 317 + } 318 + 319 + memcpy(&priv->bittiming, &bt, sizeof(bt)); 320 + 321 + if (priv->do_set_bittiming) { 322 + /* Finally, set the bit-timing registers */ 323 + err = priv->do_set_bittiming(dev); 324 + if (err) 325 + return err; 326 + } 243 327 } 244 328 245 329 if (data[IFLA_CAN_RESTART_MS]) {
+13 -13
drivers/net/can/kvaser_pciefd.c
··· 1053 1053 void __iomem *serdes_base; 1054 1054 u32 word1, word2; 1055 1055 1056 - #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 1057 - word1 = addr | KVASER_PCIEFD_ALTERA_DMA_64BIT; 1058 - word2 = addr >> 32; 1059 - #else 1060 - word1 = addr; 1061 - word2 = 0; 1062 - #endif 1056 + if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)) { 1057 + word1 = lower_32_bits(addr) | KVASER_PCIEFD_ALTERA_DMA_64BIT; 1058 + word2 = upper_32_bits(addr); 1059 + } else { 1060 + word1 = addr; 1061 + word2 = 0; 1062 + } 1063 1063 serdes_base = KVASER_PCIEFD_SERDES_ADDR(pcie) + 0x8 * index; 1064 1064 iowrite32(word1, serdes_base); 1065 1065 iowrite32(word2, serdes_base + 0x4); ··· 1072 1072 u32 lsb = addr & KVASER_PCIEFD_SF2_DMA_LSB_MASK; 1073 1073 u32 msb = 0x0; 1074 1074 1075 - #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 1076 - msb = addr >> 32; 1077 - #endif 1075 + if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)) 1076 + msb = upper_32_bits(addr); 1077 + 1078 1078 serdes_base = KVASER_PCIEFD_SERDES_ADDR(pcie) + 0x10 * index; 1079 1079 iowrite32(lsb, serdes_base); 1080 1080 iowrite32(msb, serdes_base + 0x4); ··· 1087 1087 u32 lsb = addr & KVASER_PCIEFD_XILINX_DMA_LSB_MASK; 1088 1088 u32 msb = 0x0; 1089 1089 1090 - #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 1091 - msb = addr >> 32; 1092 - #endif 1090 + if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)) 1091 + msb = upper_32_bits(addr); 1092 + 1093 1093 serdes_base = KVASER_PCIEFD_SERDES_ADDR(pcie) + 0x8 * index; 1094 1094 iowrite32(msb, serdes_base); 1095 1095 iowrite32(lsb, serdes_base + 0x4);
+16 -26
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
··· 898 898 ops = driver_info->ops; 899 899 900 900 err = ops->dev_setup_endpoints(dev); 901 - if (err) { 902 - dev_err(&intf->dev, "Cannot get usb endpoint(s)"); 903 - return err; 904 - } 901 + if (err) 902 + return dev_err_probe(&intf->dev, err, "Cannot get usb endpoint(s)"); 905 903 906 904 dev->udev = interface_to_usbdev(intf); 907 905 ··· 910 912 dev->card_data.ctrlmode_supported = 0; 911 913 dev->card_data.capabilities = 0; 912 914 err = ops->dev_init_card(dev); 913 - if (err) { 914 - dev_err(&intf->dev, 915 - "Failed to initialize card, error %d\n", err); 916 - return err; 917 - } 915 + if (err) 916 + return dev_err_probe(&intf->dev, err, 917 + "Failed to initialize card\n"); 918 918 919 919 err = ops->dev_get_software_info(dev); 920 - if (err) { 921 - dev_err(&intf->dev, 922 - "Cannot get software info, error %d\n", err); 923 - return err; 924 - } 920 + if (err) 921 + return dev_err_probe(&intf->dev, err, 922 + "Cannot get software info\n"); 925 923 926 924 if (ops->dev_get_software_details) { 927 925 err = ops->dev_get_software_details(dev); 928 - if (err) { 929 - dev_err(&intf->dev, 930 - "Cannot get software details, error %d\n", err); 931 - return err; 932 - } 926 + if (err) 927 + return dev_err_probe(&intf->dev, err, 928 + "Cannot get software details\n"); 933 929 } 934 930 935 931 if (WARN_ON(!dev->cfg)) ··· 937 945 dev_dbg(&intf->dev, "Max outstanding tx = %d URBs\n", dev->max_tx_urbs); 938 946 939 947 err = ops->dev_get_card_info(dev); 940 - if (err) { 941 - dev_err(&intf->dev, "Cannot get card info, error %d\n", err); 942 - return err; 943 - } 948 + if (err) 949 + return dev_err_probe(&intf->dev, err, 950 + "Cannot get card info\n"); 944 951 945 952 if (ops->dev_get_capabilities) { 946 953 err = ops->dev_get_capabilities(dev); 947 954 if (err) { 948 - dev_err(&intf->dev, 949 - "Cannot get capabilities, error %d\n", err); 950 955 kvaser_usb_remove_interfaces(dev); 951 - return err; 956 + return dev_err_probe(&intf->dev, err, 957 + "Cannot get capabilities\n"); 952 958 } 953 959 } 954 960
+4 -4
net/can/j1939/transport.c
··· 1179 1179 break; 1180 1180 case -ENETDOWN: 1181 1181 /* In this case we should get a netdev_event(), all active 1182 - * sessions will be cleared by 1183 - * j1939_cancel_all_active_sessions(). So handle this as an 1184 - * error, but let j1939_cancel_all_active_sessions() do the 1185 - * cleanup including propagation of the error to user space. 1182 + * sessions will be cleared by j1939_cancel_active_session(). 1183 + * So handle this as an error, but let 1184 + * j1939_cancel_active_session() do the cleanup including 1185 + * propagation of the error to user space. 1186 1186 */ 1187 1187 break; 1188 1188 case -EOVERFLOW: