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-7.1-20260401' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2026-04-01

The first patch is by Ethan Nelson-Moore and removes a useless copy of
PCI_DEVICE_DATA from the ctucanfd driver.

Geert Uytterhoeven's patch for the rcar_can converts the driver to use
the FIELD_MODIFY macro.

Viken Dadhaniya contributes 2 patches for the mcp251xfd driver that
add transceiver standby control.

The last 2 aptches are by Johan Hovold and refactor the usb endpoint
lookup of the kvaser_usb and ucan driver.

* tag 'linux-can-next-for-7.1-20260401' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next:
can: ucan: refactor endpoint lookup
can: rcar_can: Convert to FIELD_MODIFY()
can: mcp251xfd: add support for XSTBYEN transceiver standby control
can: kvaser_usb: leaf: refactor endpoint lookup
net: can: ctucanfd: remove useless copy of PCI_DEVICE_DATA macro
dt-bindings: can: mcp251xfd: add microchip,xstbyen property
====================

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

+66 -56
+8
Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml
··· 44 44 signals a pending RX interrupt. 45 45 maxItems: 1 46 46 47 + microchip,xstbyen: 48 + type: boolean 49 + description: 50 + If present, configure the INT0/GPIO0/XSTBY pin as transceiver standby 51 + control. The pin is driven low when the controller is active and high 52 + when it enters Sleep mode, allowing automatic standby control of an 53 + external CAN transceiver connected to this pin. 54 + 47 55 spi-max-frequency: 48 56 description: 49 57 Must be half or less of "clocks" frequency.
-8
drivers/net/can/ctucanfd/ctucanfd_pci.c
··· 22 22 23 23 #include "ctucanfd.h" 24 24 25 - #ifndef PCI_DEVICE_DATA 26 - #define PCI_DEVICE_DATA(vend, dev, data) \ 27 - .vendor = PCI_VENDOR_ID_##vend, \ 28 - .device = PCI_DEVICE_ID_##vend##_##dev, \ 29 - .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \ 30 - .driver_data = (kernel_ulong_t)(data) 31 - #endif 32 - 33 25 #ifndef PCI_VENDOR_ID_TEDIA 34 26 #define PCI_VENDOR_ID_TEDIA 0x1760 35 27 #endif
+1 -2
drivers/net/can/rcar/rcar_can.c
··· 496 496 priv->can.state = CAN_STATE_ERROR_ACTIVE; 497 497 498 498 /* Go to operation mode */ 499 - ctlr &= ~RCAR_CAN_CTLR_CANM; 500 - ctlr |= FIELD_PREP(RCAR_CAN_CTLR_CANM, RCAR_CAN_CTLR_CANM_OPER); 499 + FIELD_MODIFY(RCAR_CAN_CTLR_CANM, &ctlr, RCAR_CAN_CTLR_CANM_OPER); 501 500 writew(ctlr, &priv->regs->ctlr); 502 501 for (i = 0; i < MAX_STR_READS; i++) { 503 502 if (!(readw(&priv->regs->str) & RCAR_CAN_STR_RSTST))
+37
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
··· 764 764 mcp251xfd_chip_set_mode(priv, MCP251XFD_REG_CON_MODE_CONFIG); 765 765 } 766 766 767 + static int mcp251xfd_chip_xstbyen_enable(const struct mcp251xfd_priv *priv) 768 + { 769 + /* Configure the INT0/GPIO0/XSTBY pin as transceiver standby control: 770 + * 771 + * - XSTBYEN=1: route the pin to the transceiver standby function 772 + * - TRIS0=0: set output direction; the reset default is 1 (input), 773 + * which leaves the pin floating HIGH and keeps the 774 + * transceiver in standby regardless of XSTBYEN 775 + * - LAT0=0: drive pin LOW => transceiver active (not in standby) 776 + * 777 + * All three bits are included in the mask; only XSTBYEN is set in 778 + * val, so TRIS0 and LAT0 are cleared to 0 atomically. 779 + * 780 + * Pin behaviour by mode: 781 + * - Config mode: controlled by LAT0 (LAT0=0 => LOW => active) 782 + * - Normal mode: hardware drives pin LOW (active) 783 + * - Sleep mode: hardware drives pin HIGH (standby) 784 + */ 785 + return regmap_update_bits(priv->map_reg, MCP251XFD_REG_IOCON, 786 + MCP251XFD_REG_IOCON_XSTBYEN | 787 + MCP251XFD_REG_IOCON_TRIS0 | 788 + MCP251XFD_REG_IOCON_LAT0, 789 + MCP251XFD_REG_IOCON_XSTBYEN); 790 + } 791 + 767 792 static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv) 768 793 { 769 794 int err; ··· 820 795 goto out_chip_stop; 821 796 822 797 priv->can.state = CAN_STATE_ERROR_ACTIVE; 798 + 799 + if (priv->xstbyen) { 800 + err = mcp251xfd_chip_xstbyen_enable(priv); 801 + if (err) 802 + goto out_chip_stop; 803 + } 823 804 824 805 err = mcp251xfd_chip_set_normal_mode(priv); 825 806 if (err) ··· 1836 1805 u32 pin_mask = MCP251XFD_REG_IOCON_PM(offset); 1837 1806 int ret; 1838 1807 1808 + if (priv->xstbyen && offset == 0) { 1809 + netdev_err(priv->ndev, "Can't use GPIO 0 with XSTBYEN!\n"); 1810 + return -EINVAL; 1811 + } 1812 + 1839 1813 if (priv->rx_int && offset == 1) { 1840 1814 netdev_err(priv->ndev, "Can't use GPIO 1 with RX-INT!\n"); 1841 1815 return -EINVAL; ··· 2307 2271 priv->pll_enable = pll_enable; 2308 2272 priv->reg_vdd = reg_vdd; 2309 2273 priv->reg_xceiver = reg_xceiver; 2274 + priv->xstbyen = device_property_present(&spi->dev, "microchip,xstbyen"); 2310 2275 priv->devtype_data = *(struct mcp251xfd_devtype_data *)spi_get_device_match_data(spi); 2311 2276 2312 2277 /* Errata Reference:
+1
drivers/net/can/spi/mcp251xfd/mcp251xfd.h
··· 672 672 struct gpio_desc *rx_int; 673 673 struct clk *clk; 674 674 bool pll_enable; 675 + bool xstbyen; 675 676 struct regulator *reg_vdd; 676 677 struct regulator *reg_xceiver; 677 678
+8 -17
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
··· 1957 1957 1958 1958 static int kvaser_usb_leaf_setup_endpoints(struct kvaser_usb *dev) 1959 1959 { 1960 - const struct usb_host_interface *iface_desc; 1961 - struct usb_endpoint_descriptor *endpoint; 1962 - int i; 1960 + struct usb_host_interface *iface_desc; 1961 + int ret; 1963 1962 1964 1963 iface_desc = dev->intf->cur_altsetting; 1965 1964 1966 - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { 1967 - endpoint = &iface_desc->endpoint[i].desc; 1965 + /* use first bulk endpoint for in and out */ 1966 + ret = usb_find_common_endpoints(iface_desc, &dev->bulk_in, &dev->bulk_out, 1967 + NULL, NULL); 1968 + if (ret) 1969 + return -ENODEV; 1968 1970 1969 - if (!dev->bulk_in && usb_endpoint_is_bulk_in(endpoint)) 1970 - dev->bulk_in = endpoint; 1971 - 1972 - if (!dev->bulk_out && usb_endpoint_is_bulk_out(endpoint)) 1973 - dev->bulk_out = endpoint; 1974 - 1975 - /* use first bulk endpoint for in and out */ 1976 - if (dev->bulk_in && dev->bulk_out) 1977 - return 0; 1978 - } 1979 - 1980 - return -ENODEV; 1971 + return 0; 1981 1972 } 1982 1973 1983 1974 const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops = {
+11 -29
drivers/net/can/usb/ucan.c
··· 1302 1302 const struct usb_device_id *id) 1303 1303 { 1304 1304 int ret; 1305 - int i; 1306 1305 u32 protocol_version; 1307 1306 struct usb_device *udev; 1308 1307 struct net_device *netdev; 1309 1308 struct usb_host_interface *iface_desc; 1310 1309 struct ucan_priv *up; 1311 - struct usb_endpoint_descriptor *ep; 1310 + struct usb_endpoint_descriptor *ep_in, *ep_out; 1312 1311 u16 in_ep_size; 1313 1312 u16 out_ep_size; 1314 1313 u8 in_ep_addr; ··· 1342 1343 } 1343 1344 1344 1345 /* check interface endpoints */ 1345 - in_ep_addr = 0; 1346 - out_ep_addr = 0; 1347 - in_ep_size = 0; 1348 - out_ep_size = 0; 1349 - for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { 1350 - ep = &iface_desc->endpoint[i].desc; 1351 - 1352 - if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != 0) && 1353 - ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 1354 - USB_ENDPOINT_XFER_BULK)) { 1355 - /* In Endpoint */ 1356 - in_ep_addr = ep->bEndpointAddress; 1357 - in_ep_addr &= USB_ENDPOINT_NUMBER_MASK; 1358 - in_ep_size = le16_to_cpu(ep->wMaxPacketSize); 1359 - } else if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == 1360 - 0) && 1361 - ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 1362 - USB_ENDPOINT_XFER_BULK)) { 1363 - /* Out Endpoint */ 1364 - out_ep_addr = ep->bEndpointAddress; 1365 - out_ep_addr &= USB_ENDPOINT_NUMBER_MASK; 1366 - out_ep_size = le16_to_cpu(ep->wMaxPacketSize); 1367 - } 1368 - } 1369 - 1370 - /* check if interface is sane */ 1371 - if (!in_ep_addr || !out_ep_addr) { 1346 + ret = usb_find_common_endpoints_reverse(iface_desc, &ep_in, &ep_out, 1347 + NULL, NULL); 1348 + if (ret) { 1372 1349 dev_err(&udev->dev, "%s: invalid endpoint configuration\n", 1373 1350 UCAN_DRIVER_NAME); 1374 1351 goto err_firmware_needs_update; 1375 1352 } 1353 + 1354 + in_ep_addr = usb_endpoint_num(ep_in); 1355 + out_ep_addr = usb_endpoint_num(ep_out); 1356 + in_ep_size = usb_endpoint_maxp(ep_in); 1357 + out_ep_size = usb_endpoint_maxp(ep_out); 1358 + 1359 + /* check if interface is sane */ 1376 1360 if (in_ep_size < sizeof(struct ucan_message_in)) { 1377 1361 dev_err(&udev->dev, "%s: invalid in_ep MaxPacketSize\n", 1378 1362 UCAN_DRIVER_NAME);