> -----Original Message----- > From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > Sent: 2022年11月30日 18:54 > To: Bough Chen <haibo.chen@xxxxxxx> > Cc: wg@xxxxxxxxxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; > kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; robh+dt@xxxxxxxxxx; > krzysztof.kozlowski+dt@xxxxxxxxxx; shawnguo@xxxxxxxxxx; > s.hauer@xxxxxxxxxxxxxx; kernel@xxxxxxxxxxxxxx; festevam@xxxxxxxxx; > dl-linux-imx <linux-imx@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx; > netdev@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx > Subject: Re: [PATCH 1/3] can: flexcan: add auto stop mode for IMX93 to support > wakeup > > On 22.11.2022 19:32:30, haibo.chen@xxxxxxx wrote: > > From: Haibo Chen <haibo.chen@xxxxxxx> > > > > IMX93 do not contain a GPR to config the stop mode, it will set the > > flexcan into stop mode automatically once the ARM core go into low > > power mode (WFI instruct) and gate off the flexcan related clock > > automatically. But to let these logic work as expect, before ARM core > > go into low power mode, need to make sure the flexcan related clock > > keep on. > > > > To support stop mode and wakeup feature on imx93, this patch add a new > > fsl_imx93_devtype_data to separate from imx8mp. > > > > Signed-off-by: Haibo Chen <haibo.chen@xxxxxxx> > > --- > > drivers/net/can/flexcan/flexcan-core.c | 37 +++++++++++++++++++++++--- > > drivers/net/can/flexcan/flexcan.h | 2 ++ > > 2 files changed, 36 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/can/flexcan/flexcan-core.c > > b/drivers/net/can/flexcan/flexcan-core.c > > index 9bdadd716f4e..0aeff34e5ae1 100644 > > --- a/drivers/net/can/flexcan/flexcan-core.c > > +++ b/drivers/net/can/flexcan/flexcan-core.c > > [...] > > > @@ -2299,8 +2322,16 @@ static int __maybe_unused > flexcan_noirq_suspend(struct device *device) > > if (netif_running(dev)) { > > int err; > > > > - if (device_may_wakeup(device)) > > + if (device_may_wakeup(device)) { > > flexcan_enable_wakeup_irq(priv, true); > > + /* For auto stop mode, need to keep the clock on before > > + * system go into low power mode. After system go into > > + * low power mode, hardware will config the flexcan into > > + * stop mode, and gate off the clock automatically. > > + */ > > + if (priv->devtype_data.quirks & > FLEXCAN_QUIRK_AUTO_STOP_MODE) > > + return 0; > > + } > > With this change the flexcan_noirq_resume() is not symmetrical any more: > pm_runtime_force_suspend() is not called for mx93, but > pm_runtime_force_resume() is called. Yes, I do not understand the logic of pm_runtime_force_suspend correctly. I also find there is an unbalance warning show up. My bad. Will fix this and send a V2 patch. Best Regards Haibo Chen > > > > > err = pm_runtime_force_suspend(device); > > if (err) > > Marc > > -- > Pengutronix e.K. | Marc Kleine-Budde | > Embedded Linux | https://www.pengutronix.de | > Vertretung West/Dortmund | Phone: +49-231-2826-924 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |