Commit 73f784b2 authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge tag 'linux-can-next-for-6.19-20251126' of...

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

Marc Kleine-Budde says:

====================
pull-request: can-next 2025-11-26

this is a pull request of 27 patches for net-next/main.

The first 17 patches are by Vincent Mailhol and Oliver Hartkopp and
add CAN XL support to the CAN netlink interface.

Geert Uytterhoeven and Biju Das provide 7 patches for the rcar_canfd
driver to add suspend/resume support.

The next 2 patches are by Markus Schneider-Pargmann and add them as
the m_can maintainer.

Conor Dooley's patch updates the mpfs-can DT bindungs.

linux-can-next-for-6.19-20251126

* tag 'linux-can-next-for-6.19-20251126' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: (27 commits)
  dt-bindings: can: mpfs: document resets
  MAINTAINERS: Simplify m_can section
  MAINTAINERS: Add myself as m_can maintainer
  can: rcar_canfd: Add suspend/resume support
  can: rcar_canfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  can: rcar_canfd: Invert CAN clock and close_candev() order
  can: rcar_canfd: Extract rcar_canfd_global_{,de}init()
  can: rcar_canfd: Use devm_clk_get_optional() for RAM clk
  can: rcar_canfd: Invert global vs. channel teardown
  can: rcar_canfd: Invert reset assert order
  can: dev: print bitrate error with two decimal digits
  can: raw: instantly reject unsupported CAN frames
  can: add dummy_can driver
  can: calc_bittiming: add can_calc_sample_point_pwm()
  can: calc_bittiming: add can_calc_sample_point_nrz()
  can: calc_bittiming: replace misleading "nominal" by "reference"
  can: netlink: add PWM netlink interface
  can: calc_bittiming: add PWM calculation
  can: bittiming: add PWM validation
  can: bittiming: add PWM parameters
  ...
====================

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


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 45d100ee 9aea35eb
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -32,11 +32,15 @@ properties:
      - description: AHB peripheral clock
      - description: CAN bus clock

  resets:
    maxItems: 1

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - resets

additionalProperties: false

@@ -46,6 +50,7 @@ examples:
        compatible = "microchip,mpfs-can";
        reg = <0x2010c000 0x1000>;
        clocks = <&clkcfg 17>, <&clkcfg 37>;
        resets = <&clkcfg 17>;
        interrupt-parent = <&plic>;
        interrupts = <56>;
    };
+3 −5
Original line number Diff line number Diff line
@@ -15412,14 +15412,12 @@ S: Supported
F:	drivers/net/phy/mxl-86110.c
F:	drivers/net/phy/mxl-gpy.c
MCAN MMIO DEVICE DRIVER
M:	Chandrasekar Ramakrishnan <rcsekar@samsung.com>
MCAN DEVICE DRIVER
M:	Markus Schneider-Pargmann <msp@baylibre.com>
L:	linux-can@vger.kernel.org
S:	Maintained
F:	Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
F:	drivers/net/can/m_can/m_can.c
F:	drivers/net/can/m_can/m_can.h
F:	drivers/net/can/m_can/m_can_platform.c
F:	drivers/net/can/m_can/
MCBA MICROCHIP CAN BUS ANALYZER TOOL DRIVER
R:	Yasushi SHOJI <yashi@spacecubics.com>
+17 −0
Original line number Diff line number Diff line
@@ -124,6 +124,23 @@ config CAN_CAN327

	  If this driver is built as a module, it will be called can327.

config CAN_DUMMY
	tristate "Dummy CAN"
	help
	  A dummy CAN module supporting Classical CAN, CAN FD and CAN XL. It
	  exposes bittiming values which can be configured through the netlink
	  interface.

	  The module will simply echo any frame sent to it. If debug messages
	  are activated, it prints all the CAN bittiming information in the
	  kernel log. Aside from that it does nothing.

	  This is convenient for testing the CAN netlink interface. Most of the
	  users will never need this. If unsure, say NO.

	  To compile this driver as a module, choose M here: the module will be
	  called dummy-can.

config CAN_FLEXCAN
	tristate "Support for Freescale FLEXCAN based chips"
	depends on OF || COLDFIRE || COMPILE_TEST
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ obj-$(CONFIG_CAN_CAN327) += can327.o
obj-$(CONFIG_CAN_CC770)		+= cc770/
obj-$(CONFIG_CAN_C_CAN)		+= c_can/
obj-$(CONFIG_CAN_CTUCANFD)	+= ctucanfd/
obj-$(CONFIG_CAN_DUMMY)		+= dummy_can.o
obj-$(CONFIG_CAN_FLEXCAN)	+= flexcan/
obj-$(CONFIG_CAN_GRCAN)		+= grcan.o
obj-$(CONFIG_CAN_IFI_CANFD)	+= ifi_canfd/
+63 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
/* Copyright (C) 2005 Marc Kleine-Budde, Pengutronix
 * Copyright (C) 2006 Andrey Volkov, Varma Electronics
 * Copyright (C) 2008-2009 Wolfgang Grandegger <wg@grandegger.com>
 * Copyright (c) 2025 Vincent Mailhol <mailhol@kernel.org>
 */

#include <linux/can/dev.h>
@@ -151,3 +152,65 @@ int can_get_bittiming(const struct net_device *dev, struct can_bittiming *bt,

	return -EINVAL;
}

int can_validate_pwm_bittiming(const struct net_device *dev,
			       const struct can_pwm *pwm,
			       struct netlink_ext_ack *extack)
{
	const struct can_priv *priv = netdev_priv(dev);
	u32 xl_bit_time_tqmin = can_bit_time_tqmin(&priv->xl.data_bittiming);
	u32 nom_bit_time_tqmin = can_bit_time_tqmin(&priv->bittiming);
	u32 pwms_ns = can_tqmin_to_ns(pwm->pwms, priv->clock.freq);
	u32 pwml_ns = can_tqmin_to_ns(pwm->pwml, priv->clock.freq);

	if (pwms_ns + pwml_ns > CAN_PWM_NS_MAX) {
		NL_SET_ERR_MSG_FMT(extack,
				   "The PWM symbol duration: %u ns may not exceed %u ns",
				   pwms_ns + pwml_ns, CAN_PWM_NS_MAX);
		return -EINVAL;
	}

	if (pwms_ns < CAN_PWM_DECODE_NS) {
		NL_SET_ERR_MSG_FMT(extack,
				   "PWMS: %u ns shall be at least %u ns",
				   pwms_ns, CAN_PWM_DECODE_NS);
		return -EINVAL;
	}

	if (pwm->pwms >= pwm->pwml) {
		NL_SET_ERR_MSG_FMT(extack,
				   "PWMS: %u tqmin shall be smaller than PWML: %u tqmin",
				   pwm->pwms, pwm->pwml);
		return -EINVAL;
	}

	if (pwml_ns - pwms_ns < 2 * CAN_PWM_DECODE_NS) {
		NL_SET_ERR_MSG_FMT(extack,
				   "At least %u ns shall separate PWMS: %u ns from PMWL: %u ns",
				   2 * CAN_PWM_DECODE_NS, pwms_ns, pwml_ns);
		return -EINVAL;
	}

	if (xl_bit_time_tqmin % (pwm->pwms + pwm->pwml) != 0) {
		NL_SET_ERR_MSG_FMT(extack,
				   "PWM duration: %u tqmin does not divide XL's bit time: %u tqmin",
				   pwm->pwms + pwm->pwml, xl_bit_time_tqmin);
		return -EINVAL;
	}

	if (pwm->pwmo >= pwm->pwms + pwm->pwml) {
		NL_SET_ERR_MSG_FMT(extack,
				   "PWMO: %u tqmin can not be greater than PWMS + PWML: %u tqmin",
				   pwm->pwmo, pwm->pwms + pwm->pwml);
		return -EINVAL;
	}

	if (nom_bit_time_tqmin % (pwm->pwms + pwm->pwml) != pwm->pwmo) {
		NL_SET_ERR_MSG_FMT(extack,
				   "Can not assemble nominal bit time: %u tqmin out of PWMS + PMWL and PWMO",
				   nom_bit_time_tqmin);
		return -EINVAL;
	}

	return 0;
}
Loading