Re: [PATCH v2 4/4] can: flexcan: add wakeup support for imx95

From: Marc Kleine-Budde
Date: Tue Jul 16 2024 - 13:51:06 EST


On 16.07.2024 10:40:31, Frank Li wrote:
> > > @@ -2330,9 +2366,12 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device)
> > > if (netif_running(dev)) {
> > > int err;
> > >
> > > - err = pm_runtime_force_resume(device);
> > > - if (err)
> > > - return err;
> > > + if (!(device_may_wakeup(device) &&
> > ^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > Where does this come from?
>
> include/linux/pm_wakeup.h
>
> static inline bool device_may_wakeup(struct device *dev)
> {
> return dev->power.can_wakeup && !!dev->power.wakeup;
> }

Sorry for the confusion. I wanted to point out, that the original driver
doesn't have the check to device_may_wakeup(). Why was this added?

> >
> > > + priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_SCMI)) {
> > > + err = pm_runtime_force_resume(device);
> > > + if (err)
> > > + return err;
> > > + }
> > >
> > > if (device_may_wakeup(device))
> > > flexcan_enable_wakeup_irq(priv, false);
> > > diff --git a/drivers/net/can/flexcan/flexcan.h b/drivers/net/can/flexcan/flexcan.h
> > > index 025c3417031f4..4933d8c7439e6 100644
> > > --- a/drivers/net/can/flexcan/flexcan.h
> > > +++ b/drivers/net/can/flexcan/flexcan.h
> > > @@ -68,6 +68,8 @@
> > > #define FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR BIT(15)
> > > /* Device supports RX via FIFO */
> > > #define FLEXCAN_QUIRK_SUPPORT_RX_FIFO BIT(16)
> > > +/* Setup stop mode with ATF SCMI protocol to support wakeup */
> > > +#define FLEXCAN_QUIRK_SETUP_STOP_MODE_SCMI BIT(17)
> > >
> > > struct flexcan_devtype_data {
> > > u32 quirks; /* quirks needed for different IP cores */

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

Attachment: signature.asc
Description: PGP signature