[PATCH v8 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support
From: Kendall Willis
Date: Thu Oct 01 2026 - 12:44:48 EST
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@xxxxxx>
---
drivers/net/can/m_can/m_can.c | 6 +++++-
drivers/net/can/m_can/m_can.h | 2 ++
drivers/net/can/m_can/m_can_platform.c | 13 +++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 91a0c5eca260c19fa97c6f5724341cad0c1c95b8..ab2e869df62de00bfd2a475f38c38cdb703a5962 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -2628,8 +2628,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 (cdev->out_band_wakeup)
+ device_set_out_band_wakeup(dev);
+ } else {
pinctrl_pm_select_sleep_state(dev);
+ }
return 0;
diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h
index 4743342b2fba3823819b9e2bc5b085cc0fe6d1e2..7b5466b02666a4e1d327e3c8d8a4b57efd0c6eaf 100644
--- a/drivers/net/can/m_can/m_can.h
+++ b/drivers/net/can/m_can/m_can.h
@@ -132,6 +132,8 @@ struct m_can_classdev {
struct pinctrl *pinctrl;
struct pinctrl_state *pinctrl_state_wakeup;
+
+ 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 51dd41dbf2c9a971295994946e190ec0187addd5..eaa76c98ad0c603ef9b9dc2b78863217d9c62d99 100644
--- a/drivers/net/can/m_can/m_can_platform.c
+++ b/drivers/net/can/m_can/m_can_platform.c
@@ -18,6 +18,10 @@ struct m_can_plat_priv {
void __iomem *mram_base;
};
+struct m_can_of_data {
+ bool out_band_wakeup;
+};
+
static inline struct m_can_plat_priv *cdev_to_priv(struct m_can_classdev *cdev)
{
return container_of(cdev, struct m_can_plat_priv, cdev);
@@ -83,6 +87,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 +153,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 +226,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