can: m_can: support out-of-band wakeup capability
Subsystems (3)
v3 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"
Dependency
----------
The DT bindings are dependent on this PR in the dt-schema repository, which defines the out-band-wakeup property:
https://github.com/devicetree-org/dt-schema/pull/205
Testing
-------
Tested suspend/resume with CAN wakeup on AM62P SK EVM.
---
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/[email protected]
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 | 2 ++ drivers/net/can/m_can/m_can.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
---
base-commit: 8d3ae59288f1e7d58d76558a6ee96d533bc5019f
change-id: 20260819-temp-93299bee27b7
Best regards,
Signature · 1 line
Kendall Willis <[email protected]>
PATCH v3 1/2 dt-bindings: can: m_can: add out-band-wakeup property
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +2 -0
@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system. + out-band-wakeup: true + required: - compatible - reg
Signature · 1 line
2.34.1
PATCH v3 2/2 can: m_can: set out-of-band wakeup if wakeup pinctrl exists
In reply to Kendall WillisIn 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
@@ -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
[email protected]
AI reviewRe: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
In reply to Kendall WillisThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The newly added `out-band-wakeup` property lacks a type definition, description, and the…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly added out-band-wakeup property lacks a type definition, description, and the required vendor prefix. --
--- Patch [1]: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property --- commit 18cc4cb55e5269767b220486da77c10e4826ca15
Author: Kendall Willis <[email protected]>
dt-bindings: can: m_can: add out-band-wakeup property
This commit adds the out-band-wakeup property to the bosch,m_can device tree binding. The property indicates that the device can wake up the system even when its power domain is off.
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 9 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system. + out-band-wakeup: true
[Severity: Medium]
Does this property need a type constraint and a vendor prefix?
By defining the property merely as true, schema validation lacks the ability to enforce a specific data type, meaning it could silently allow arrays or strings instead of a boolean flag.
Additionally, if this is a custom hardware property rather than a standard one, should it have a vendor prefix to avoid namespace pollution?
Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ required: - compatible - reg
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
In reply to Kendall WillisQuoted 14 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system. + out-band-wakeup: true
Where is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
Quoted 8 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ required: - compatible - regSignature · 2 lines
-- 2.34.1
Re: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
Quoted 18 lines · Conor Dooley
Quoted 17 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system.
Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 1 line
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ out-band-wakeup: trueWhere is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
I sent a PR to define out-band-wakeup in the wakeup-source.yaml binding in dt-schema repo. I figured it made more sense to be defined in the wakeup-source.yaml binding to allow other drivers the option to use it.
dt-schema PR:
https://github.com/devicetree-org/dt-schema/pull/205
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ required: - compatible - regSignature · 2 lines
-- 2.34.1
Re: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
Quoted 24 lines · Kendall Willis
Quoted 18 lines · Conor Dooley
Quoted 17 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system.Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 1 line
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ out-band-wakeup: trueWhere is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
Quoted 6 lines
I sent a PR to define out-band-wakeup in the
wakeup-source.yamlbinding in dt-schema repo. I figured it made more sense to be defined in thewakeup-source.yamlbinding to allow other drivers the option to use it.dt-schema PR:
https://github.com/devicetree-org/dt-schema/pull/205
This sounds like something you should be able to determine from device specific compatibles for these platforms. Not sure why they are not used for this particular device, but this is an indication to me that that is a mistake.
Cheers,
Conor.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ required: - compatible - regSignature · 2 lines
-- 2.34.1
Re: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Kendall Willis
Quoted 18 lines · Conor Dooley
Quoted 17 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system.Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 1 line
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ out-band-wakeup: trueWhere is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
I sent a PR to define out-band-wakeup in the
wakeup-source.yamlbinding in dt-schema repo. I figured it made more sense to be defined in thewakeup-source.yamlbinding to allow other drivers the option to use it.
Quoted 7 lines
Quoted 2 lines
dt-schema PR:
https://github.com/devicetree-org/dt-schema/pull/205This sounds like something you should be able to determine from device specific compatibles for these platforms. Not sure why they are not used for this particular device, but this is an indication to me that that is a mistake.
Yeah, it looks a bit too much replicating Linux PM detail. I can imagine that some devices on some board are capable of waking up the system even when power domain is off, but this does not look like a capability of the actual device, but power domain. Device does not have different wakeups. (by device I mean this individual schema - Bosch CAN)
Happy to see some bigger picture through DTS or board layouts. Actually DTS, showing same Bosch CAN devices which are different on a board - some are wakeups and some out of band wakeups - would illustrate it better.
Best regards,
Krzysztof
Re: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
Quoted 44 lines · Krzysztof Kozlowski
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Kendall Willis
Quoted 18 lines · Conor Dooley
Quoted 17 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system.Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 1 line
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ out-band-wakeup: trueWhere is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
I sent a PR to define out-band-wakeup in the
wakeup-source.yamlbinding in dt-schema repo. I figured it made more sense to be defined in thewakeup-source.yamlbinding to allow other drivers the option to use it.Quoted 7 lines
Quoted 2 lines
dt-schema PR:
https://github.com/devicetree-org/dt-schema/pull/205This sounds like something you should be able to determine from device specific compatibles for these platforms. Not sure why they are not used for this particular device, but this is an indication to me that that is a mistake.
Yeah, it looks a bit too much replicating Linux PM detail. I can imagine that some devices on some board are capable of waking up the system even when power domain is off, but this does not look like a capability of the actual device, but power domain. Device does not have different wakeups. (by device I mean this individual schema - Bosch CAN)
Quoted 4 lines
Happy to see some bigger picture through DTS or board layouts. Actually DTS, showing same Bosch CAN devices which are different on a board - some are wakeups and some out of band wakeups - would illustrate it better.
As far as I could make out when I looked at the patch, "Bosch CAN" is an IP that can be integrated on an SoC rather than a device on the board, so I'm doubting that there's any difference in capability to wake up the device caused by the board at all. If there is, it's between different power domains on the SoC, as you say.
Quoted 4 lines
Best regards,
Krzysztof
Markus Schneider-Pargmann
maintainerRe: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
Hi,
Quoted 50 lines · Conor Dooley
Quoted 44 lines · Krzysztof Kozlowski
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Kendall Willis
Quoted 18 lines · Conor Dooley
Quoted 17 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system.Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 1 line
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ out-band-wakeup: trueWhere is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
I sent a PR to define out-band-wakeup in the
wakeup-source.yamlbinding in dt-schema repo. I figured it made more sense to be defined in thewakeup-source.yamlbinding to allow other drivers the option to use it.Quoted 7 lines
Quoted 2 lines
dt-schema PR:
https://github.com/devicetree-org/dt-schema/pull/205This sounds like something you should be able to determine from device specific compatibles for these platforms. Not sure why they are not used for this particular device, but this is an indication to me that that is a mistake.
Yeah, it looks a bit too much replicating Linux PM detail. I can imagine that some devices on some board are capable of waking up the system even when power domain is off, but this does not look like a capability of the actual device, but power domain. Device does not have different wakeups. (by device I mean this individual schema - Bosch CAN)
Quoted 4 lines
Happy to see some bigger picture through DTS or board layouts. Actually DTS, showing same Bosch CAN devices which are different on a board - some are wakeups and some out of band wakeups - would illustrate it better.
Quoted 5 lines
As far as I could make out when I looked at the patch, "Bosch CAN" is an IP that can be integrated on an SoC rather than a device on the board, so I'm doubting that there's any difference in capability to wake up the device caused by the board at all. If there is, it's between different power domains on the SoC, as you say.
m_can is an IP that can be integrated on an SoC. But it is also built into external chips, like the TI tcan chips that connect via SPI. There is also a PCI connected one. Also some SoC integrated m_can devices are coupled to the mcu and not the main processor and can't be fully accessed from the main processor, e.g. they are missing interrupts.
Best
Markus
Re: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
Quoted 59 lines · Markus Schneider-Pargmann
Hi,
Quoted 50 lines · Conor Dooley
Quoted 44 lines · Krzysztof Kozlowski
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Kendall Willis
Quoted 18 lines · Conor Dooley
Quoted 17 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system.Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 1 line
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ out-band-wakeup: trueWhere is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
I sent a PR to define out-band-wakeup in the
wakeup-source.yamlbinding in dt-schema repo. I figured it made more sense to be defined in thewakeup-source.yamlbinding to allow other drivers the option to use it.Quoted 7 lines
Quoted 2 lines
dt-schema PR:
https://github.com/devicetree-org/dt-schema/pull/205This sounds like something you should be able to determine from device specific compatibles for these platforms. Not sure why they are not used for this particular device, but this is an indication to me that that is a mistake.
Yeah, it looks a bit too much replicating Linux PM detail. I can imagine that some devices on some board are capable of waking up the system even when power domain is off, but this does not look like a capability of the actual device, but power domain. Device does not have different wakeups. (by device I mean this individual schema - Bosch CAN)
Quoted 4 lines
Happy to see some bigger picture through DTS or board layouts. Actually DTS, showing same Bosch CAN devices which are different on a board - some are wakeups and some out of band wakeups - would illustrate it better.
Quoted 5 lines
As far as I could make out when I looked at the patch, "Bosch CAN" is an IP that can be integrated on an SoC rather than a device on the board, so I'm doubting that there's any difference in capability to wake up the device caused by the board at all. If there is, it's between different power domains on the SoC, as you say.
Quoted 6 lines
m_canis an IP that can be integrated on an SoC. But it is also built into external chips, like the TI tcan chips that connect via SPI. There is also a PCI connected one. Also some SoC integratedm_candevices are coupled to the mcu and not the main processor and can't be fully accessed from the main processor, e.g. they are missing interrupts.
All of these things: soc integrations, each specific SPI connected SKU and the PCI connected device should have specific compatibles. Per the series adding these to devicetrees, it's all mcu connected instances that are growing the property, and not devices on boards that depend on how the specific board has been wired.
Re: [PATCH v3 1/2] dt-bindings: can: m_can: add out-band-wakeup property
Quoted 67 lines · Conor Dooley
Quoted 59 lines · Markus Schneider-Pargmann
Hi,
Quoted 50 lines · Conor Dooley
Quoted 44 lines · Krzysztof Kozlowski
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Kendall Willis
Quoted 18 lines · Conor Dooley
Quoted 17 lines · Kendall Willis
Add the out-band-wakeup property as a possible property. The property indicates that the device can wakeup the system even when its power domain is off.
Signed-off-by Kendall Willis <[email protected]>--- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +0
-0@@ -150,6 +150,8 @@ properties: description: List of phandles to system idle states in which mcan can wakeup the system.Quoted 4 lines
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml properties: · line 153
Quoted 1 line
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +1
-0+ out-band-wakeup: trueWhere is "-wakeup" defined genericly, or out-band-wakeup defined that you're getting the property definition from?
I sent a PR to define out-band-wakeup in the
wakeup-source.yamlbinding in dt-schema repo. I figured it made more sense to be defined in thewakeup-source.yamlbinding to allow other drivers the option to use it.Quoted 7 lines
Quoted 2 lines
dt-schema PR:
https://github.com/devicetree-org/dt-schema/pull/205This sounds like something you should be able to determine from device specific compatibles for these platforms. Not sure why they are not used for this particular device, but this is an indication to me that that is a mistake.
Yeah, it looks a bit too much replicating Linux PM detail. I can imagine that some devices on some board are capable of waking up the system even when power domain is off, but this does not look like a capability of the actual device, but power domain. Device does not have different wakeups. (by device I mean this individual schema - Bosch CAN)
Quoted 4 lines
Happy to see some bigger picture through DTS or board layouts. Actually DTS, showing same Bosch CAN devices which are different on a board - some are wakeups and some out of band wakeups - would illustrate it better.
Quoted 5 lines
As far as I could make out when I looked at the patch, "Bosch CAN" is an IP that can be integrated on an SoC rather than a device on the board, so I'm doubting that there's any difference in capability to wake up the device caused by the board at all. If there is, it's between different power domains on the SoC, as you say.
Quoted 6 lines
m_canis an IP that can be integrated on an SoC. But it is also built into external chips, like the TI tcan chips that connect via SPI. There is also a PCI connected one. Also some SoC integratedm_candevices are coupled to the mcu and not the main processor and can't be fully accessed from the main processor, e.g. they are missing interrupts.
Quoted 8 lines
All of these things: soc integrations, each specific SPI connected SKU and the PCI connected device should have specific compatibles. Per the series adding these to devicetrees, it's all mcu connected instances that are growing the property, and not devices on boards that depend on how the specific board has been wired.
I'll respin this series to drop the dts property and use compatibles instead since there are no examples for TI K3 AM62 devices that have different wakeup capabilities for CAN. Thanks for the feedback Conor, Krzysztof, and Markus!
Best,
Kendall