Skip to contentSkip to conversation

can: m_can: support out-of-band wakeup capability

PATCH Superseded Kendall Willis 2 participants 5 messages Aug 20 – Aug 21

Subsystems (3)

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v2 cover can: m_can: support out-of-band wakeup capability

This series adds support for the out-of-band wakeup capability in the m_can driver. Some CAN devices are wakeup capable and can wake up the system while being in a domain that is OFF. Allow the driver to set the out-of-band wakeup flag during suspend if the "out-band-wakeup" property is present in the device tree.

A corresponding DTS series enabling this feature on TI K3 AM62A, AM62D, AM62P, and AM62X-LP SoCs has been submitted separately:
"arm64: dts: ti: add out-band-wakeup property to m_can devices"

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

---
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/[email protected]

---
Kendall Willis (2):
dt-bindings: can: m_can: add out band wakeup property
can: m_can: set out-of-band wakeup if wakeup pinctrl exists

 Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 12 ++++++++++++
 drivers/net/can/m_can/m_can.c                              |  6 +++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

---
base-commit: 8d3ae59288f1e7d58d76558a6ee96d533bc5019f
change-id: 20260819-temp-93299bee27b7

Best regards,

Signature · 1 line
Kendall Willis <[email protected]>
#1 lore raw

PATCH v2 1/2 dt-bindings: can: m_can: add out band wakeup property

Create out-band-wakeup property. The property indicates that the device can wakeup the system even when its power domain is off. The property is only used if the device is a wakeup source.

---
 Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +12 -0
index 2c9d37975bedd652b3060ab11ba75c37565edaad..b6cb945c225f168533f714b5db08afbdc4ebeb93 100644
@@ -150,6 +150,11 @@ properties:
     description:
       List of phandles to system idle states in which mcan can wakeup the system.
 
+  out-band-wakeup:
+    type: boolean
+    description:
+      Indicates CAN device is out-of-band wakeup capable.
+
 required:
   - compatible
   - reg
@@ -158,6 +163,13 @@ required:
   - clock-names
   - bosch,mram-cfg
 
+if:
+  required:
+    - out-band-wakeup
+then:
+  required:
+    - wakeup-source
+
 unevaluatedProperties: false
 
 examples:
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: can: m_can: add out band wakeup property

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The newly added custom device-specific property `out-band-wakeup` is missing a vendor prefix. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The newly added custom device-specific property out-band-wakeup is missing a vendor prefix. --

--- Patch [1]: [PATCH v2 1/2] dt-bindings: can: m_can: add out band wakeup property --- commit 66d860c00379089f5518db1a67a453077a6864ea
Author: Kendall Willis <[email protected]>

dt-bindings: can: m_can: add out band wakeup property

This commit introduces the out-band-wakeup property to the m_can binding. The property indicates if the CAN device is capable of waking up the system even when its power domain is off.

Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 156

Quoted 12 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +4 -0
index 2c9d37975bedd..b6cb945c225f1 100644
@@ -150,6 +150,11 @@ properties:
     description:
       List of phandles to system idle states in which mcan can wakeup the system.
 
+  out-band-wakeup:
+    type: boolean
+    description:
+      Indicates CAN device is out-of-band wakeup capable.

[Severity: Low]
Should this device-specific property have a vendor prefix?

Since this property is not defined in a core common schema like dtschema or can-controller.yaml, the Devicetree specification requires a vendor prefix (such as ti,out-band-wakeup or bosch,out-band-wakeup) to prevent property name collisions.

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH v2 1/2] dt-bindings: can: m_can: add out band wakeup property

Quoted 30 lines · On 21:48-20260820, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The newly added custom device-specific property out-band-wakeup is missing a vendor prefix. --

--- Patch [1]: [PATCH v2 1/2] dt-bindings: can: m_can: add out band wakeup property --- commit 66d860c00379089f5518db1a67a453077a6864ea
Author: Kendall Willis <[email protected]>

dt-bindings: can: m_can: add out band wakeup property

This commit introduces the out-band-wakeup property to the m_can binding. The property indicates if the CAN device is capable of waking up the system even when its power domain is off.

Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 156

Quoted 12 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +4 -0
index 2c9d37975bedd..b6cb945c225f1 100644
@@ -150,6 +150,11 @@ properties:
     description:
       List of phandles to system idle states in which mcan can wakeup the system.
 
+  out-band-wakeup:
+    type: boolean
+    description:
+      Indicates CAN device is out-of-band wakeup capable.

[Severity: Low]
Should this device-specific property have a vendor prefix?

Quoted 4 lines

Since this property is not defined in a core common schema like dtschema or can-controller.yaml, the Devicetree specification requires a vendor prefix (such as ti,out-band-wakeup or bosch,out-band-wakeup) to prevent property name collisions.

This is a valid point. I sent a PR to the dtschema repo [1] to add the out-band-wakeup property to the core common schema. I will be sending a v3 to fix the bindings with that PR in mind.

[1] https://github.com/devicetree-org/dt-schema/pull/205

Best,
Kendall

Quoted 5 lines

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#4 lore raw

PATCH v2 2/2 can: m_can: set out-of-band wakeup if wakeup pinctrl exists

In reply to Kendall Willis

In TI AM62X, AM62A, and AM62P SoCs, the m_can pins can act as a wakeup source in the deepest low power states. However, the m_can pins are a part of the MCU domain which is OFF in deeper low power states. Since the m_can pins continue to be ON even if the MCU domain is turned off, set the out-of-band wakeup flag if the CAN device may wakeup, has the "out-band-wakeup" property in the device tree node, and has the "wakeup" pinctrl state.

---
 drivers/net/can/m_can/m_can.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/can/m_can/m_can.c +5 -1
index eb856547ae7df27a844b236a0c1d4498cbb8b60f..e745660fb3eb311de70635fcfc016a44e62d5602 100644
@@ -2622,8 +2622,12 @@ int m_can_class_suspend(struct device *dev)
 		cdev->can.state = CAN_STATE_SLEEPING;
 	}
 
-	if (!m_can_class_wakeup_pinctrl_enabled(cdev))
+	if (m_can_class_wakeup_pinctrl_enabled(cdev)) {
+		if (device_property_read_bool(dev, "out-band-wakeup"))
+			device_set_out_band_wakeup(dev);
+	} else {
 		pinctrl_pm_select_sleep_state(dev);
+	}
 
 	return ret;
 }
Signature · 1 line
2.34.1