Devicetree
 help / color / mirror / Atom feed
* [PATCH v5 0/2] can: m_can: introduce ti,am62-mcan compatible for out-of-band wakeup
@ 2026-09-12 21:26 Kendall Willis
  2026-09-12 21:26 ` [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible Kendall Willis
  2026-09-12 21:26 ` [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support Kendall Willis
  0 siblings, 2 replies; 6+ messages in thread
From: Kendall Willis @ 2026-09-12 21:26 UTC (permalink / raw)
  To: Markus Schneider-Pargmann, Marc Kleine-Budde, Vincent Mailhol,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chandrasekar Ramakrishnan
  Cc: s-kochidanadu, a-kaur, s-tripathi1, vishalm, k-willis, linux-can,
	devicetree, linux-kernel

This series introduces the "ti,am62-mcan" compatible which adds support
for out-of-band wakeup capability in m_can devices.

A corresponding DTS series enabling this feature on TI K3 AM62 family
of devices has been submitted separately:
"arm64: dts: ti: use ti,am62-mcan compatible for m_can devices"

Testing
-------
Tested suspend/resume with CAN wakeup on AM62P SK EVM.

Signed-off-by: Kendall Willis <k-willis@ti.com>
---
Changes in v5:
- Rename compatible string from "ti,am62-m_can" to "ti,am62-mcan".
- Update dt binding to use "oneOf" with a fallback compatible chain instead of a flat "enum".
- Rename "struct m_can_pdata" to "struct m_can_of_data".
- Read match data at probe time and cache it in "m_can_classdev" instead of fetching it in suspend.
- Add "out_band_wakeup" flag to "struct m_can_classdev".
- Guard wakeup/sleep pinctrl selection in suspend with a return value check.
- Link to v4: https://lore.kernel.org/r/20260902-temp-v4-0-3896f7d16ce8@ti.com

Changes in v4:
- Remove patch for "out-band-wakeup" property in dt binding.
- Create "ti,am62-m_can" compatible in the dt binding and m_can driver.
- Add "struct m_can_of_data" for compatible-specific data which keeps track
  of "out_band_wakeup" flag.
- Replace check "out-band-wakeup" dt property in the device driver upon
  suspend with check for "out_band_wakeup" variable from the
  "m_can_of_data".
- Link to v3: https://lore.kernel.org/r/20260821-temp-v3-0-9ac1f8806929@ti.com

Changes in v3:
- Remove definition of "out-band-wakeup" property in dt binding.
- Allow "out-band-wakeup" property in dt binding.
- Link to v2: https://lore.kernel.org/r/20260820-temp-v2-0-dd3f8cacc15e@ti.com

Changes in v2:
- Create "out-band-wakeup" property in dt bindings.
- Use "out-band-wakeup" property to set the out_band_wakeup flag upon
  suspend.
- Rebase to v7.2
- Link to v1: https://lore.kernel.org/r/20260213-mcan-out-of-band-v1-1-af68d4c570b3@ti.com

---
Kendall Willis (2):
      dt-bindings: can: m_can: add ti,am62-mcan compatible
      can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support

 Documentation/devicetree/bindings/net/can/bosch,m_can.yaml |  6 +++++-
 drivers/net/can/m_can/m_can.c                              | 10 ++++++++--
 drivers/net/can/m_can/m_can.h                              |  6 ++++++
 drivers/net/can/m_can/m_can_platform.c                     |  9 +++++++++
 4 files changed, 28 insertions(+), 3 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260819-temp-93299bee27b7

Best regards,
-- 
Kendall Willis <k-willis@ti.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible
  2026-09-12 21:26 [PATCH v5 0/2] can: m_can: introduce ti,am62-mcan compatible for out-of-band wakeup Kendall Willis
@ 2026-09-12 21:26 ` Kendall Willis
  2026-09-12 21:37   ` sashiko-bot
  2026-09-13  7:54   ` Krzysztof Kozlowski
  2026-09-12 21:26 ` [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support Kendall Willis
  1 sibling, 2 replies; 6+ messages in thread
From: Kendall Willis @ 2026-09-12 21:26 UTC (permalink / raw)
  To: Markus Schneider-Pargmann, Marc Kleine-Budde, Vincent Mailhol,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chandrasekar Ramakrishnan
  Cc: s-kochidanadu, a-kaur, s-tripathi1, vishalm, k-willis, linux-can,
	devicetree, linux-kernel

Add "ti,am62-mcan" device. Device is fully compatible with Bosch.
The device supports out-of-band wakeup capability.

Signed-off-by: Kendall Willis <k-willis@ti.com>
---
 Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
index 2c9d37975bedd652b3060ab11ba75c37565edaad..e0ac14de54fb20b46c29edf96fd9cee647df6283 100644
--- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
+++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
@@ -16,7 +16,11 @@ allOf:
 
 properties:
   compatible:
-    const: bosch,m_can
+    oneOf:
+      - const: bosch,m_can
+      - items:
+        - const: ti,am62-mcan
+        - const: bosch,m_can
 
   reg:
     items:

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support
  2026-09-12 21:26 [PATCH v5 0/2] can: m_can: introduce ti,am62-mcan compatible for out-of-band wakeup Kendall Willis
  2026-09-12 21:26 ` [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible Kendall Willis
@ 2026-09-12 21:26 ` Kendall Willis
  2026-09-12 21:35   ` sashiko-bot
  1 sibling, 1 reply; 6+ messages in thread
From: Kendall Willis @ 2026-09-12 21:26 UTC (permalink / raw)
  To: Markus Schneider-Pargmann, Marc Kleine-Budde, Vincent Mailhol,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chandrasekar Ramakrishnan
  Cc: s-kochidanadu, a-kaur, s-tripathi1, vishalm, k-willis, linux-can,
	devicetree, linux-kernel

In TI K3 AM62 SoCs, the M_CAN controllers are in power domains which are
OFF in the deepest low power states. However, the m_can pins are able to
wakeup the system from states where the power domain is OFF through its
out-of-band wakeup functionality.

Introduce the ti,am62-mcan compatible with match data to identify the
out-of-band wakeup capability for TI AM62 SoCs. During suspend, set the
out-of-band wakeup flag when the device is configured as a wakeup
source, the "wakeup" pinctrl state is present, and the match data
indicates out-of-band wakeup support.

Signed-off-by: Kendall Willis <k-willis@ti.com>
---
 drivers/net/can/m_can/m_can.c          | 10 ++++++++--
 drivers/net/can/m_can/m_can.h          |  6 ++++++
 drivers/net/can/m_can/m_can_platform.c |  9 +++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 16f80607e150e2ca2950616ff2c39b7aa13710b4..67ac6995a7f27c412b61bbe235b4aa0f5980688e 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -2622,8 +2622,14 @@ int m_can_class_suspend(struct device *dev)
 		cdev->can.state = CAN_STATE_SLEEPING;
 	}
 
-	if (!m_can_class_wakeup_pinctrl_enabled(cdev))
-		pinctrl_pm_select_sleep_state(dev);
+	if (!ret) {
+		if (m_can_class_wakeup_pinctrl_enabled(cdev)) {
+			if (cdev->out_band_wakeup)
+				device_set_out_band_wakeup(dev);
+		} else {
+			pinctrl_pm_select_sleep_state(dev);
+		}
+	}
 
 	return ret;
 }
diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h
index 4743342b2fba3823819b9e2bc5b085cc0fe6d1e2..da64e6bbcef2a721a330e67fd852ca4a703c5794 100644
--- a/drivers/net/can/m_can/m_can.h
+++ b/drivers/net/can/m_can/m_can.h
@@ -132,6 +132,12 @@ struct m_can_classdev {
 
 	struct pinctrl *pinctrl;
 	struct pinctrl_state *pinctrl_state_wakeup;
+
+	bool out_band_wakeup;
+};
+
+struct m_can_of_data {
+	bool out_band_wakeup;
 };
 
 struct m_can_classdev *m_can_class_allocate_dev(struct device *dev, int sizeof_priv);
diff --git a/drivers/net/can/m_can/m_can_platform.c b/drivers/net/can/m_can/m_can_platform.c
index 56da411878af0185ff9cc512e325137428a68255..9deded10e8a6a99eff5ff1a78696f660db443db6 100644
--- a/drivers/net/can/m_can/m_can_platform.c
+++ b/drivers/net/can/m_can/m_can_platform.c
@@ -83,6 +83,7 @@ static int m_can_plat_probe(struct platform_device *pdev)
 	void __iomem *addr;
 	void __iomem *mram_addr;
 	struct phy *transceiver;
+	const struct m_can_of_data *of_data;
 	int irq = 0, ret = 0;
 
 	mcan_class = m_can_class_allocate_dev(&pdev->dev,
@@ -148,6 +149,9 @@ static int m_can_plat_probe(struct platform_device *pdev)
 
 	mcan_class->is_peripheral = false;
 
+	of_data = of_device_get_match_data(&pdev->dev);
+	mcan_class->out_band_wakeup = of_data && of_data->out_band_wakeup;
+
 	platform_set_drvdata(pdev, mcan_class);
 
 	pm_runtime_enable(mcan_class->dev);
@@ -218,8 +222,13 @@ static const struct dev_pm_ops m_can_pmops = {
 	SET_SYSTEM_SLEEP_PM_OPS(m_can_suspend, m_can_resume)
 };
 
+static const struct m_can_of_data m_can_plat_am62 = {
+	.out_band_wakeup = true,
+};
+
 static const struct of_device_id m_can_of_table[] = {
 	{ .compatible = "bosch,m_can", .data = NULL },
+	{ .compatible = "ti,am62-mcan", .data = &m_can_plat_am62 },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, m_can_of_table);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support
  2026-09-12 21:26 ` [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support Kendall Willis
@ 2026-09-12 21:35   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-09-12 21:35 UTC (permalink / raw)
  To: Kendall Willis
  Cc: Vincent Mailhol, linux-can, Marc Kleine-Budde, devicetree,
	Oleksij Rempel, conor+dt, robh, Oliver Hartkopp

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing rollback in m_can_class_suspend error path leaves device permanently unusable if deinit fails.
--

commit f4778144b1ead7bde54359bb563953cd8601ac93
Author: Kendall Willis <k-willis@ti.com>

can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support

This commit introduces the ti,am62-mcan compatible with match data to
identify the out-of-band wakeup capability for TI AM62 SoCs. It also
updates the suspend path to set the out-of-band wakeup flag when
the device is configured appropriately.

> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index 16f80607e150e..67ac6995a7f27 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -2622,8 +2622,14 @@ int m_can_class_suspend(struct device *dev)
>  		cdev->can.state = CAN_STATE_SLEEPING;
>  	}
>  
> -	if (!m_can_class_wakeup_pinctrl_enabled(cdev))
> -		pinctrl_pm_select_sleep_state(dev);
> +	if (!ret) {
> +		if (m_can_class_wakeup_pinctrl_enabled(cdev)) {
> +			if (cdev->out_band_wakeup)
> +				device_set_out_band_wakeup(dev);
> +		} else {
> +			pinctrl_pm_select_sleep_state(dev);
> +		}
> +	}
>  
>  	return ret;
>  }

[Severity: High]
This is a pre-existing issue, but could this error path leave the CAN device
permanently unusable?

If cdev->ops->deinit() returns a negative error code (e.g. due to an SPI
error in a peripheral driver), ret is set, but m_can_class_suspend()
unconditionally stops the clocks and changes the state earlier in the
function:

    if (cdev->pm_wake_source) {
        ...
        if (cdev->ops->deinit)
            ret = cdev->ops->deinit(cdev);
    } else {
        m_can_stop(ndev);
    }

    m_can_clk_stop(cdev);
    cdev->can.state = CAN_STATE_SLEEPING;

If an error is returned to the PM core, the suspend operation is aborted
and the resume callback is never invoked. Does this leave the network
interface detached via netif_device_detach(), its clocks stopped, and the
state stuck in CAN_STATE_SLEEPING indefinitely without a manual module
reload?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912-temp-v5-0-2e3201c02109@ti.com?part=2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible
  2026-09-12 21:26 ` [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible Kendall Willis
@ 2026-09-12 21:37   ` sashiko-bot
  2026-09-13  7:54   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-09-12 21:37 UTC (permalink / raw)
  To: Kendall Willis
  Cc: Oliver Hartkopp, conor+dt, robh, devicetree, Marc Kleine-Budde,
	Oleksij Rempel, Vincent Mailhol, linux-can

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect YAML indentation for the `items` sequence violates the kernel's yamllint rules, breaking `make dt_binding_check`.
--

commit ce14f1f5cb441a60c48d5a3b96ea09ddcd2c9e74
Author: Kendall Willis <k-willis@ti.com>

dt-bindings: can: m_can: add ti,am62-mcan compatible

This commit adds the ti,am62-mcan compatible string to the Bosch M_CAN
device tree bindings. It updates the schema to allow the new TI compatible
as a fallback to the generic Bosch compatible.

> diff --git a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> --- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> +++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
> @@ -16,7 +16,11 @@ allOf:
>  
>  properties:
>    compatible:
> -    const: bosch,m_can
> +    oneOf:
> +      - const: bosch,m_can
> +      - items:
> +        - const: ti,am62-mcan
> +        - const: bosch,m_can

[Severity: Low]
Does this indentation in properties.compatible violate the yamllint rules
for device tree bindings?

The configuration in Documentation/devicetree/bindings/.yamllint enforces
an indent-sequences rule with a 2-space indentation requirement. It looks
like the sequence items under the items keyword are placed at 8 spaces,
which matches the column start of the items keyword rather than being
indented to 10 spaces.

Could this formatting violation cause make dt_binding_check to fail during
the build?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912-temp-v5-0-2e3201c02109@ti.com?part=1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible
  2026-09-12 21:26 ` [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible Kendall Willis
  2026-09-12 21:37   ` sashiko-bot
@ 2026-09-13  7:54   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-13  7:54 UTC (permalink / raw)
  To: Kendall Willis
  Cc: Markus Schneider-Pargmann, Marc Kleine-Budde, Vincent Mailhol,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chandrasekar Ramakrishnan, s-kochidanadu, a-kaur, s-tripathi1,
	vishalm, linux-can, devicetree, linux-kernel

On Sat, Sep 12, 2026 at 04:26:55PM -0500, Kendall Willis wrote:
> Add "ti,am62-mcan" device. Device is fully compatible with Bosch.
> The device supports out-of-band wakeup capability.
> 
> Signed-off-by: Kendall Willis <k-willis@ti.com>
> ---
>  Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Fails checks.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-13  7:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-12 21:26 [PATCH v5 0/2] can: m_can: introduce ti,am62-mcan compatible for out-of-band wakeup Kendall Willis
2026-09-12 21:26 ` [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible Kendall Willis
2026-09-12 21:37   ` sashiko-bot
2026-09-13  7:54   ` Krzysztof Kozlowski
2026-09-12 21:26 ` [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support Kendall Willis
2026-09-12 21:35   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox