* [PATCH 1/2] arm64: dts: imx93: add the Flex-CAN stop mode by GPR
@ 2023-07-26 3:50 haibo.chen
2023-07-26 3:50 ` [PATCH 2/2] can: flexcan: remove the auto stop mode for IMX93 haibo.chen
0 siblings, 1 reply; 4+ messages in thread
From: haibo.chen @ 2023-07-26 3:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, wg,
mkl
Cc: kernel, linux-imx, davem, edumazet, kuba, pabeni, haibo.chen,
devicetree, linux-can, netdev
From: Haibo Chen <haibo.chen@nxp.com>
imx93 A0 chip use the internal q-channel handshake signal in LPCG
and CCM to automatically handle the Flex-CAN stop mode. But this
method meet issue when do the system PM stress test. IC can't fix
it easily.
So in the new imx93 A1 chip, IC drop this method, and involve back
the old way,use the GPR method to trigger the Flex-CAN stop mode
signal.
Now NXP claim to drop imx93 A0, and only support imx93 A1. So here
add the stop mode through GPR.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
arch/arm64/boot/dts/freescale/imx93.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
index 8643612ace8c..d8113a9b11f2 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -280,6 +280,7 @@ flexcan1: can@443a0000 {
assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>;
assigned-clock-rates = <40000000>;
fsl,clk-source = /bits/ 8 <0>;
+ fsl,stop-mode = <&anomix_ns_gpr 0x14 0>;
status = "disabled";
};
@@ -532,6 +533,7 @@ flexcan2: can@425b0000 {
assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>;
assigned-clock-rates = <40000000>;
fsl,clk-source = /bits/ 8 <0>;
+ fsl,stop-mode = <&wakeupmix_gpr 0x0C 2>;
status = "disabled";
};
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] can: flexcan: remove the auto stop mode for IMX93
2023-07-26 3:50 [PATCH 1/2] arm64: dts: imx93: add the Flex-CAN stop mode by GPR haibo.chen
@ 2023-07-26 3:50 ` haibo.chen
2023-07-26 6:35 ` Marc Kleine-Budde
0 siblings, 1 reply; 4+ messages in thread
From: haibo.chen @ 2023-07-26 3:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, wg,
mkl
Cc: kernel, linux-imx, davem, edumazet, kuba, pabeni, haibo.chen,
devicetree, linux-can, netdev
From: Haibo Chen <haibo.chen@nxp.com>
IMX93 A0 chip involve the internal q-channel handshake in LPCG and
CCM to automatically handle the Flex-CAN IPG STOP signal. Only after
FLEX-CAN enter stop mode then can support the self-wakeup feature.
But meet issue when do the continue system PM stress test. When config
the CAN as wakeup source, the first time after system suspend, any data
on CAN bus can wakeup the system, this is as expect. But the second time
when system suspend, data on CAN bus can't wakeup the system. If continue
this test, we find in odd time system enter suspend, CAN can wakeup the
system, but in even number system enter suspend, CAN can't wakeup the
system.
IC find a bug in the auto stop mode logic when handle the q-channel, and
can't fix it easily. So for the new imx93 A1, IC drop the auto stop mode
and involve the GPR to support stop mode (used before). IC define a bit
in GPR which can trigger the IPG STOP signal to Flex-CAN, let it go into
stop mode.
Now NXP claim to drop IMX93 A0, and only support IMX93 A1. So this patch
remove the auto stop mode, and add flag FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR
to imx93.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/net/can/flexcan/flexcan-core.c | 37 ++++----------------------
drivers/net/can/flexcan/flexcan.h | 2 --
2 files changed, 5 insertions(+), 34 deletions(-)
diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index ff0fc18baf13..a3f3a9c909be 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -348,7 +348,7 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = {
static struct flexcan_devtype_data fsl_imx93_devtype_data = {
.quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX |
- FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_AUTO_STOP_MODE |
+ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR |
FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC |
FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX |
FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR,
@@ -544,11 +544,6 @@ static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv)
} else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) {
regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr,
1 << priv->stm.req_bit, 1 << priv->stm.req_bit);
- } else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE) {
- /* For the auto stop mode, software do nothing, hardware will cover
- * all the operation automatically after system go into low power mode.
- */
- return 0;
}
return flexcan_low_power_enter_ack(priv);
@@ -574,12 +569,6 @@ static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv)
reg_mcr &= ~FLEXCAN_MCR_SLF_WAK;
priv->write(reg_mcr, ®s->mcr);
- /* For the auto stop mode, hardware will exist stop mode
- * automatically after system go out of low power mode.
- */
- if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
- return 0;
-
return flexcan_low_power_exit_ack(priv);
}
@@ -1994,8 +1983,6 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev)
ret = flexcan_setup_stop_mode_scfw(pdev);
else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR)
ret = flexcan_setup_stop_mode_gpr(pdev);
- else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
- ret = 0;
else
/* return 0 directly if doesn't support stop mode feature */
return 0;
@@ -2320,16 +2307,8 @@ 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;
- }
err = pm_runtime_force_suspend(device);
if (err)
@@ -2347,15 +2326,9 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device)
if (netif_running(dev)) {
int err;
- /* For the wakeup in auto stop mode, no need to gate on the
- * clock here, hardware will do this automatically.
- */
- if (!(device_may_wakeup(device) &&
- priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)) {
- err = pm_runtime_force_resume(device);
- if (err)
- return err;
- }
+ 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 91402977780b..025c3417031f 100644
--- a/drivers/net/can/flexcan/flexcan.h
+++ b/drivers/net/can/flexcan/flexcan.h
@@ -68,8 +68,6 @@
#define FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR BIT(15)
/* Device supports RX via FIFO */
#define FLEXCAN_QUIRK_SUPPORT_RX_FIFO BIT(16)
-/* auto enter stop mode to support wakeup */
-#define FLEXCAN_QUIRK_AUTO_STOP_MODE BIT(17)
struct flexcan_devtype_data {
u32 quirks; /* quirks needed for different IP cores */
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] can: flexcan: remove the auto stop mode for IMX93
2023-07-26 3:50 ` [PATCH 2/2] can: flexcan: remove the auto stop mode for IMX93 haibo.chen
@ 2023-07-26 6:35 ` Marc Kleine-Budde
2023-07-26 8:04 ` Bough Chen
0 siblings, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2023-07-26 6:35 UTC (permalink / raw)
To: haibo.chen
Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, wg,
kernel, linux-imx, davem, edumazet, kuba, pabeni, devicetree,
linux-can, netdev
[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]
On 26.07.2023 11:50:32, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> IMX93 A0 chip involve the internal q-channel handshake in LPCG and
> CCM to automatically handle the Flex-CAN IPG STOP signal. Only after
> FLEX-CAN enter stop mode then can support the self-wakeup feature.
>
> But meet issue when do the continue system PM stress test. When config
> the CAN as wakeup source, the first time after system suspend, any data
> on CAN bus can wakeup the system, this is as expect. But the second time
> when system suspend, data on CAN bus can't wakeup the system. If continue
> this test, we find in odd time system enter suspend, CAN can wakeup the
> system, but in even number system enter suspend, CAN can't wakeup the
> system.
>
> IC find a bug in the auto stop mode logic when handle the q-channel, and
> can't fix it easily. So for the new imx93 A1, IC drop the auto stop mode
> and involve the GPR to support stop mode (used before). IC define a bit
> in GPR which can trigger the IPG STOP signal to Flex-CAN, let it go into
> stop mode.
>
> Now NXP claim to drop IMX93 A0, and only support IMX93 A1. So this patch
> remove the auto stop mode, and add flag FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR
> to imx93.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
> drivers/net/can/flexcan/flexcan-core.c | 37 ++++----------------------
> drivers/net/can/flexcan/flexcan.h | 2 --
> 2 files changed, 5 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index ff0fc18baf13..a3f3a9c909be 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
> @@ -348,7 +348,7 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = {
> static struct flexcan_devtype_data fsl_imx93_devtype_data = {
> .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
> FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX |
> - FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_AUTO_STOP_MODE |
> + FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR |
AFAICS this change breaks systems with old device trees (i.e. without
"fsl,stop-mode") and new kernels. The flexcan driver will not probe
anymore.
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 2/2] can: flexcan: remove the auto stop mode for IMX93
2023-07-26 6:35 ` Marc Kleine-Budde
@ 2023-07-26 8:04 ` Bough Chen
0 siblings, 0 replies; 4+ messages in thread
From: Bough Chen @ 2023-07-26 8:04 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de,
wg@grandegger.com, kernel@pengutronix.de, dl-linux-imx,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, devicetree@vger.kernel.org,
linux-can@vger.kernel.org, netdev@vger.kernel.org
> -----Original Message-----
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Sent: 2023年7月26日 14:36
> To: Bough Chen <haibo.chen@nxp.com>
> Cc: robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org;
> conor+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de;
> wg@grandegger.com; kernel@pengutronix.de; dl-linux-imx
> <linux-imx@nxp.com>; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; devicetree@vger.kernel.org;
> linux-can@vger.kernel.org; netdev@vger.kernel.org
> Subject: Re: [PATCH 2/2] can: flexcan: remove the auto stop mode for IMX93
>
> On 26.07.2023 11:50:32, haibo.chen@nxp.com wrote:
> > From: Haibo Chen <haibo.chen@nxp.com>
> >
> > IMX93 A0 chip involve the internal q-channel handshake in LPCG and CCM
> > to automatically handle the Flex-CAN IPG STOP signal. Only after
> > FLEX-CAN enter stop mode then can support the self-wakeup feature.
> >
> > But meet issue when do the continue system PM stress test. When config
> > the CAN as wakeup source, the first time after system suspend, any
> > data on CAN bus can wakeup the system, this is as expect. But the
> > second time when system suspend, data on CAN bus can't wakeup the
> > system. If continue this test, we find in odd time system enter
> > suspend, CAN can wakeup the system, but in even number system enter
> > suspend, CAN can't wakeup the system.
> >
> > IC find a bug in the auto stop mode logic when handle the q-channel,
> > and can't fix it easily. So for the new imx93 A1, IC drop the auto
> > stop mode and involve the GPR to support stop mode (used before). IC
> > define a bit in GPR which can trigger the IPG STOP signal to Flex-CAN,
> > let it go into stop mode.
> >
> > Now NXP claim to drop IMX93 A0, and only support IMX93 A1. So this
> > patch remove the auto stop mode, and add flag
> > FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR to imx93.
> >
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > ---
> > drivers/net/can/flexcan/flexcan-core.c | 37 ++++----------------------
> > drivers/net/can/flexcan/flexcan.h | 2 --
> > 2 files changed, 5 insertions(+), 34 deletions(-)
> >
> > diff --git a/drivers/net/can/flexcan/flexcan-core.c
> > b/drivers/net/can/flexcan/flexcan-core.c
> > index ff0fc18baf13..a3f3a9c909be 100644
> > --- a/drivers/net/can/flexcan/flexcan-core.c
> > +++ b/drivers/net/can/flexcan/flexcan-core.c
> > @@ -348,7 +348,7 @@ static struct flexcan_devtype_data
> > fsl_imx8mp_devtype_data = { static struct flexcan_devtype_data
> fsl_imx93_devtype_data = {
> > .quirks = FLEXCAN_QUIRK_DISABLE_RXFG |
> FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
> > FLEXCAN_QUIRK_DISABLE_MECR |
> FLEXCAN_QUIRK_USE_RX_MAILBOX |
> > - FLEXCAN_QUIRK_BROKEN_PERR_STATE |
> FLEXCAN_QUIRK_AUTO_STOP_MODE |
> > + FLEXCAN_QUIRK_BROKEN_PERR_STATE |
> FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR
> > +|
>
> AFAICS this change breaks systems with old device trees (i.e. without
> "fsl,stop-mode") and new kernels. The flexcan driver will not probe anymore.
You are right. Lack of "fsl,stop-mode" should not break the flexcan driver probe.
I will send V2 patch to fix this.
Best Regards
Haibo Chen
>
> 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 |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-26 8:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 3:50 [PATCH 1/2] arm64: dts: imx93: add the Flex-CAN stop mode by GPR haibo.chen
2023-07-26 3:50 ` [PATCH 2/2] can: flexcan: remove the auto stop mode for IMX93 haibo.chen
2023-07-26 6:35 ` Marc Kleine-Budde
2023-07-26 8:04 ` Bough Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).