Commit 384cba25 authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge tag 'linux-can-next-for-6.15-20250219' of...

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

Marc Kleine-Budde says:

====================
pull-request: can-next 2025-02-19

this is a pull request of 12 patches for net-next/master.

The first 4 patches are by Krzysztof Kozlowski and simplify the c_can
driver's c_can_plat_probe() function.

Ciprian Marian Costea contributes 3 patches to add S32G2/S32G3 support
to the flexcan driver.

Ruffalo Lavoisier's patch removes a duplicated word from the mcp251xfd
DT bindings documentation.

Oleksij Rempel extends the J1939 documentation.

The next patch is by Oliver Hartkopp and adds access for the Remote
Request Substitution bit in CAN-XL frames.

Henrik Brix Andersen's patch for the gs_usb driver adds support for
the CANnectivity firmware.

The last patch is by Robin van der Gracht and removes a duplicated
setup of RX FIFO in the rockchip_canfd driver.

linux-can-next-for-6.15-20250219

* tag 'linux-can-next-for-6.15-20250219' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next:
  can: rockchip_canfd: rkcanfd_chip_fifo_setup(): remove duplicated setup of RX FIFO
  can: gs_usb: add VID/PID for the CANnectivity firmware
  can: canxl: support Remote Request Substitution bit access
  can: j1939: Extend stack documentation with buffer size behavior
  dt-binding: can: mcp251xfd: remove duplicate word
  can: flexcan: add NXP S32G2/S32G3 SoC support
  can: flexcan: Add quirk to handle separate interrupt lines for mailboxes
  dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support
  can: c_can: Use syscon_regmap_lookup_by_phandle_args
  can: c_can: Use of_property_present() to test existence of DT property
  can: c_can: Simplify handling syscon error path
  can: c_can: Drop useless final probe failure message
====================

Link: https://patch.msgid.link/20250219113354.529611-1-mkl@pengutronix.de


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 67181985 d9e1cc08
Loading
Loading
Loading
Loading
+40 −4
Original line number Diff line number Diff line
@@ -10,9 +10,6 @@ title:
maintainers:
  - Marc Kleine-Budde <mkl@pengutronix.de>

allOf:
  - $ref: can-controller.yaml#

properties:
  compatible:
    oneOf:
@@ -28,6 +25,7 @@ properties:
          - fsl,vf610-flexcan
          - fsl,ls1021ar2-flexcan
          - fsl,lx2160ar1-flexcan
          - nxp,s32g2-flexcan
      - items:
          - enum:
              - fsl,imx53-flexcan
@@ -43,12 +41,21 @@ properties:
          - enum:
              - fsl,ls1028ar1-flexcan
          - const: fsl,lx2160ar1-flexcan
      - items:
          - enum:
              - nxp,s32g3-flexcan
          - const: nxp,s32g2-flexcan

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1
    minItems: 1
    maxItems: 4

  interrupt-names:
    minItems: 1
    maxItems: 4

  clocks:
    maxItems: 2
@@ -136,6 +143,35 @@ required:
  - reg
  - interrupts

allOf:
  - $ref: can-controller.yaml#
  - if:
      properties:
        compatible:
          contains:
            const: nxp,s32g2-flexcan
    then:
      properties:
        interrupts:
          items:
            - description: Message Buffer interrupt for mailboxes 0-7 and Enhanced RX FIFO
            - description: Device state change
            - description: Bus Error detection
            - description: Message Buffer interrupt for mailboxes 8-127
        interrupt-names:
          items:
            - const: mb-0
            - const: state
            - const: berr
            - const: mb-1
      required:
        - interrupt-names
    else:
      properties:
        interrupts:
          maxItems: 1
        interrupt-names: false

additionalProperties: false

examples:
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ properties:

  microchip,rx-int-gpios:
    description:
      GPIO phandle of GPIO connected to to INT1 pin of the MCP251XFD, which
      GPIO phandle of GPIO connected to INT1 pin of the MCP251XFD, which
      signals a pending RX interrupt.
    maxItems: 1

+675 −0

File changed.

Preview size limit exceeded, changes collapsed.

+15 −36
Original line number Diff line number Diff line
@@ -269,30 +269,22 @@ static int c_can_plat_probe(struct platform_device *pdev)

	/* get the appropriate clk */
	clk = devm_clk_get(&pdev->dev, NULL);
	if (IS_ERR(clk)) {
		ret = PTR_ERR(clk);
		goto exit;
	}
	if (IS_ERR(clk))
		return PTR_ERR(clk);

	/* get the platform data */
	irq = platform_get_irq(pdev, 0);
	if (irq < 0) {
		ret = irq;
		goto exit;
	}
	if (irq < 0)
		return irq;

	addr = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
	if (IS_ERR(addr)) {
		ret =  PTR_ERR(addr);
		goto exit;
	}
	if (IS_ERR(addr))
		return PTR_ERR(addr);

	/* allocate the c_can device */
	dev = alloc_c_can_dev(drvdata->msg_obj_num);
	if (!dev) {
		ret = -ENOMEM;
		goto exit;
	}
	if (!dev)
		return -ENOMEM;

	priv = netdev_priv(dev);
	switch (drvdata->id) {
@@ -324,33 +316,22 @@ static int c_can_plat_probe(struct platform_device *pdev)
		/* Check if we need custom RAMINIT via syscon. Mostly for TI
		 * platforms. Only supported with DT boot.
		 */
		if (np && of_property_read_bool(np, "syscon-raminit")) {
		if (np && of_property_present(np, "syscon-raminit")) {
			unsigned int args[2];
			u32 id;
			struct c_can_raminit *raminit = &priv->raminit_sys;

			ret = -EINVAL;
			raminit->syscon = syscon_regmap_lookup_by_phandle(np,
									  "syscon-raminit");
			raminit->syscon = syscon_regmap_lookup_by_phandle_args(np,
									       "syscon-raminit",
									       2, args);
			if (IS_ERR(raminit->syscon)) {
				/* can fail with -EPROBE_DEFER */
				ret = PTR_ERR(raminit->syscon);
				free_c_can_dev(dev);
				return ret;
			}

			if (of_property_read_u32_index(np, "syscon-raminit", 1,
						       &raminit->reg)) {
				dev_err(&pdev->dev,
					"couldn't get the RAMINIT reg. offset!\n");
				goto exit_free_device;
			}

			if (of_property_read_u32_index(np, "syscon-raminit", 2,
						       &id)) {
				dev_err(&pdev->dev,
					"couldn't get the CAN instance ID\n");
				goto exit_free_device;
			}
			raminit->reg = args[0];
			id = args[1];

			if (id >= drvdata->raminit_num) {
				dev_err(&pdev->dev,
@@ -396,8 +377,6 @@ static int c_can_plat_probe(struct platform_device *pdev)
	pm_runtime_disable(priv->device);
exit_free_device:
	free_c_can_dev(dev);
exit:
	dev_err(&pdev->dev, "probe failed\n");

	return ret;
}
+34 −1
Original line number Diff line number Diff line
@@ -386,6 +386,16 @@ static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = {
		FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR,
};

static const struct flexcan_devtype_data nxp_s32g2_devtype_data = {
	.quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
		FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE |
		FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_SUPPORT_FD |
		FLEXCAN_QUIRK_SUPPORT_ECC | FLEXCAN_QUIRK_NR_IRQ_3 |
		FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX |
		FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR |
		FLEXCAN_QUIRK_SECONDARY_MB_IRQ,
};

static const struct can_bittiming_const flexcan_bittiming_const = {
	.name = DRV_NAME,
	.tseg1_min = 4,
@@ -1762,13 +1772,24 @@ static int flexcan_open(struct net_device *dev)
			goto out_free_irq_boff;
	}

	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SECONDARY_MB_IRQ) {
		err = request_irq(priv->irq_secondary_mb,
				  flexcan_irq, IRQF_SHARED, dev->name, dev);
		if (err)
			goto out_free_irq_err;
	}

	flexcan_chip_interrupts_enable(dev);

	netif_start_queue(dev);

	return 0;

 out_free_irq_err:
	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3)
		free_irq(priv->irq_err, dev);
 out_free_irq_boff:
	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3)
		free_irq(priv->irq_boff, dev);
 out_free_irq:
	free_irq(dev->irq, dev);
@@ -1794,6 +1815,9 @@ static int flexcan_close(struct net_device *dev)
	netif_stop_queue(dev);
	flexcan_chip_interrupts_disable(dev);

	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SECONDARY_MB_IRQ)
		free_irq(priv->irq_secondary_mb, dev);

	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) {
		free_irq(priv->irq_err, dev);
		free_irq(priv->irq_boff, dev);
@@ -2041,6 +2065,7 @@ static const struct of_device_id flexcan_of_match[] = {
	{ .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, },
	{ .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, },
	{ .compatible = "fsl,lx2160ar1-flexcan", .data = &fsl_lx2160a_r1_devtype_data, },
	{ .compatible = "nxp,s32g2-flexcan", .data = &nxp_s32g2_devtype_data, },
	{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, flexcan_of_match);
@@ -2187,6 +2212,14 @@ static int flexcan_probe(struct platform_device *pdev)
		}
	}

	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SECONDARY_MB_IRQ) {
		priv->irq_secondary_mb = platform_get_irq_byname(pdev, "mb-1");
		if (priv->irq_secondary_mb < 0) {
			err = priv->irq_secondary_mb;
			goto failed_platform_get_irq;
		}
	}

	if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SUPPORT_FD) {
		priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD |
			CAN_CTRLMODE_FD_NON_ISO;
Loading