* [PATCH 1/2] ARM: imx6: disable deeper idle states when FEC is active w/o HW workaround
2016-06-01 15:29 [PATCH 0/2] Software workaround for i.MX6Q/DL ERR006687 Lucas Stach
@ 2016-06-01 15:29 ` Lucas Stach
2016-06-16 15:47 ` Arnd Bergmann
2016-06-01 15:29 ` [PATCH 2/2] ARM: dts: imx6: tag boards that have the HW workaround for ERR006687 Lucas Stach
2016-06-02 19:10 ` [PATCH 0/2] Software workaround for i.MX6Q/DL ERR006687 David Miller
2 siblings, 1 reply; 10+ messages in thread
From: Lucas Stach @ 2016-06-01 15:29 UTC (permalink / raw)
To: Shawn Guo, Fugang Duan
Cc: devicetree, linux-arm-kernel, netdev, kernel, patchwork-lst
The i.MX6 Q/DL has an erratum (ERR006687) that prevents the FEC from
waking the CPUs when they are in wait(unclocked) state. As the hardware
workaround isn't applicable to all boards, disable the deeper idle state
when the workaround isn't present and the FEC is in use.
This allows to safely run a kernel with CPUidle enabled on all i.MX6
boards.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
Documentation/devicetree/bindings/net/fsl-fec.txt | 3 +++
arch/arm/mach-imx/cpuidle-imx6q.c | 16 +++++++++++++++
drivers/net/ethernet/freescale/fec.h | 2 ++
drivers/net/ethernet/freescale/fec_main.c | 12 +++++++++++
include/soc/imx/cpuidle.h | 25 +++++++++++++++++++++++
5 files changed, 58 insertions(+)
create mode 100644 include/soc/imx/cpuidle.h
diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt
index b037a9d78d93..7d923cd2dba7 100644
--- a/Documentation/devicetree/bindings/net/fsl-fec.txt
+++ b/Documentation/devicetree/bindings/net/fsl-fec.txt
@@ -27,6 +27,9 @@ Optional properties:
number to 1.
- fsl,magic-packet : If present, indicates that the hardware supports waking
up via magic packet.
+- fsl,err006687-war-present: If present indicates that the system has the
+ hardware workaround for ERR006687 applied and does not need a software
+ workaround.
Optional subnodes:
- mdio : specifies the mdio bus in the FEC, used as a container for phy nodes
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index 353bb8774112..c3cc8ca8d2ff 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -62,6 +62,22 @@ static struct cpuidle_driver imx6q_cpuidle_driver = {
.safe_state_index = 0,
};
+/*
+ * i.MX6 Q/DL has an erratum (ERR006687) that prevents the FEC from waking the
+ * CPUs when they are in wait(unclocked) state. As the hardware workaround isn't
+ * applicable to all boards, disable the deeper idle state when the workaround
+ * isn't present and the FEC is in use.
+ */
+void imx6q_cpuidle_fec_irqs_used(void)
+{
+ imx6q_cpuidle_driver.states[1].disabled = true;
+}
+
+void imx6q_cpuidle_fec_irqs_unused(void)
+{
+ imx6q_cpuidle_driver.states[1].disabled = false;
+}
+
int __init imx6q_cpuidle_init(void)
{
/* Set INT_MEM_CLK_LPM bit to get a reliable WAIT mode support */
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index f58f9ea51639..dc71a88e9c55 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -442,6 +442,8 @@ struct bufdesc_ex {
#define FEC_QUIRK_SINGLE_MDIO (1 << 11)
/* Controller supports RACC register */
#define FEC_QUIRK_HAS_RACC (1 << 12)
+/* Interrupt doesn't wake CPU from deep idle */
+#define FEC_QUIRK_ERR006687 (1 << 13)
struct bufdesc_prop {
int qid;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ca2cccc594fd..8fb4f370dcc3 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -60,6 +60,7 @@
#include <linux/if_vlan.h>
#include <linux/pinctrl/consumer.h>
#include <linux/prefetch.h>
+#include <soc/imx/cpuidle.h>
#include <asm/cacheflush.h>
@@ -2820,6 +2821,9 @@ fec_enet_open(struct net_device *ndev)
if (ret)
goto err_enet_mii_probe;
+ if (fep->quirks & FEC_QUIRK_ERR006687)
+ imx6q_cpuidle_fec_irqs_used();
+
napi_enable(&fep->napi);
phy_start(ndev->phydev);
netif_tx_start_all_queues(ndev);
@@ -2855,6 +2859,9 @@ fec_enet_close(struct net_device *ndev)
phy_disconnect(ndev->phydev);
+ if (fep->quirks & FEC_QUIRK_ERR006687)
+ imx6q_cpuidle_fec_irqs_unused();
+
fec_enet_clk_enable(ndev, false);
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
pm_runtime_mark_last_busy(&fep->pdev->dev);
@@ -3294,6 +3301,11 @@ fec_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ndev);
+ if ((of_machine_is_compatible("fsl,imx6q") ||
+ of_machine_is_compatible("fsl,imx6dl")) &&
+ !of_property_read_bool(np, "fsl,err006687-war-present"))
+ fep->quirks |= FEC_QUIRK_ERR006687;
+
if (of_get_property(np, "fsl,magic-packet", NULL))
fep->wol_flag |= FEC_WOL_HAS_MAGIC_PACKET;
diff --git a/include/soc/imx/cpuidle.h b/include/soc/imx/cpuidle.h
new file mode 100644
index 000000000000..986a4823bce1
--- /dev/null
+++ b/include/soc/imx/cpuidle.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2016 Pengutronix, <kernel@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef __SOC_IMX_CPUIDLE_H__
+#define __SOC_IMX_CPUIDLE_H__
+
+#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_SOC_IMX6Q)
+void imx6q_cpuidle_fec_irqs_used(void);
+void imx6q_cpuidle_fec_irqs_unused(void);
+#else
+void imx6q_cpuidle_fec_irqs_used(void) { }
+void imx6q_cpuidle_fec_irqs_unused(void) { }
+#endif
+
+#endif /* __SOC_IMX_CPUIDLE_H__ */
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] ARM: imx6: disable deeper idle states when FEC is active w/o HW workaround
2016-06-01 15:29 ` [PATCH 1/2] ARM: imx6: disable deeper idle states when FEC is active w/o HW workaround Lucas Stach
@ 2016-06-16 15:47 ` Arnd Bergmann
2016-06-21 2:40 ` Shawn Guo
0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2016-06-16 15:47 UTC (permalink / raw)
To: Lucas Stach
Cc: Shawn Guo, Fugang Duan, devicetree, linux-arm-kernel, netdev,
kernel, patchwork-lst
On Wednesday, June 1, 2016 5:29:42 PM CEST Lucas Stach wrote:
> +/*
> + * i.MX6 Q/DL has an erratum (ERR006687) that prevents the FEC from waking the
> + * CPUs when they are in wait(unclocked) state. As the hardware workaround isn't
> + * applicable to all boards, disable the deeper idle state when the workaround
> + * isn't present and the FEC is in use.
> + */
> +void imx6q_cpuidle_fec_irqs_used(void)
> +{
> + imx6q_cpuidle_driver.states[1].disabled = true;
> +}
> +
> +void imx6q_cpuidle_fec_irqs_unused(void)
> +{
> + imx6q_cpuidle_driver.states[1].disabled = false;
> +}
> +
These functions need to be exported, I just saw a build error in
an allmodconfig test:
ERROR: "imx6q_cpuidle_fec_irqs_unused" [drivers/net/ethernet/freescale/fec.ko] undefined!
ERROR: "imx6q_cpuidle_fec_irqs_used" [drivers/net/ethernet/freescale/fec.ko] undefined!
Arnd
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] ARM: imx6: disable deeper idle states when FEC is active w/o HW workaround
2016-06-16 15:47 ` Arnd Bergmann
@ 2016-06-21 2:40 ` Shawn Guo
0 siblings, 0 replies; 10+ messages in thread
From: Shawn Guo @ 2016-06-21 2:40 UTC (permalink / raw)
To: Arnd Bergmann
Cc: devicetree, Fugang Duan, netdev, patchwork-lst, kernel,
linux-arm-kernel, Lucas Stach
On Thu, Jun 16, 2016 at 05:47:26PM +0200, Arnd Bergmann wrote:
> On Wednesday, June 1, 2016 5:29:42 PM CEST Lucas Stach wrote:
> > +/*
> > + * i.MX6 Q/DL has an erratum (ERR006687) that prevents the FEC from waking the
> > + * CPUs when they are in wait(unclocked) state. As the hardware workaround isn't
> > + * applicable to all boards, disable the deeper idle state when the workaround
> > + * isn't present and the FEC is in use.
> > + */
> > +void imx6q_cpuidle_fec_irqs_used(void)
> > +{
> > + imx6q_cpuidle_driver.states[1].disabled = true;
> > +}
> > +
> > +void imx6q_cpuidle_fec_irqs_unused(void)
> > +{
> > + imx6q_cpuidle_driver.states[1].disabled = false;
> > +}
> > +
>
> These functions need to be exported, I just saw a build error in
> an allmodconfig test:
>
> ERROR: "imx6q_cpuidle_fec_irqs_unused" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "imx6q_cpuidle_fec_irqs_used" [drivers/net/ethernet/freescale/fec.ko] undefined!
Thanks for the report, Arnd. Just sent a fix for it.
Shawn
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] ARM: dts: imx6: tag boards that have the HW workaround for ERR006687
2016-06-01 15:29 [PATCH 0/2] Software workaround for i.MX6Q/DL ERR006687 Lucas Stach
2016-06-01 15:29 ` [PATCH 1/2] ARM: imx6: disable deeper idle states when FEC is active w/o HW workaround Lucas Stach
@ 2016-06-01 15:29 ` Lucas Stach
2016-06-01 16:17 ` Russell King - ARM Linux
2016-06-02 19:10 ` [PATCH 0/2] Software workaround for i.MX6Q/DL ERR006687 David Miller
2 siblings, 1 reply; 10+ messages in thread
From: Lucas Stach @ 2016-06-01 15:29 UTC (permalink / raw)
To: Shawn Guo, Fugang Duan
Cc: devicetree, linux-arm-kernel, netdev, kernel, patchwork-lst
Add the DT property to all boards that have the hardware workaround
for erratum ERR006687 present. This allows the CPUidle driver to use
the deep idle states, even if the FEC is active.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boot/dts/imx6dl-riotboard.dts | 1 +
arch/arm/boot/dts/imx6q-arm2.dts | 1 +
arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi | 1 +
arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi | 1 +
arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 1 +
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 1 +
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 1 +
arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 1 +
8 files changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/imx6dl-riotboard.dts b/arch/arm/boot/dts/imx6dl-riotboard.dts
index bfbed52ce1bd..b10dc9513c6b 100644
--- a/arch/arm/boot/dts/imx6dl-riotboard.dts
+++ b/arch/arm/boot/dts/imx6dl-riotboard.dts
@@ -97,6 +97,7 @@
phy-reset-gpios = <&gpio3 31 0>;
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts
index d6515f7a56c4..fce60ef991ce 100644
--- a/arch/arm/boot/dts/imx6q-arm2.dts
+++ b/arch/arm/boot/dts/imx6q-arm2.dts
@@ -185,6 +185,7 @@
phy-mode = "rgmii";
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi
index e456b5cc1b03..a74f396965ca 100644
--- a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi
@@ -250,6 +250,7 @@
txd3-skew-ps = <0>;
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
index 657da6b6ccd2..da76a128e5a9 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
@@ -385,6 +385,7 @@
txd3-skew-ps = <0>;
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
index 73915db704a0..dfcb5001a126 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
@@ -287,6 +287,7 @@
txd3-skew-ps = <0>;
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index d354d406954d..e250da2a4caa 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -155,6 +155,7 @@
phy-mode = "rgmii";
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
index c47fe6c79b36..d451ca242751 100644
--- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
@@ -273,6 +273,7 @@
txd3-skew-ps = <0>;
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
index 8e7c40e114dd..684c6a776565 100644
--- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
@@ -211,6 +211,7 @@
phy-reset-gpios = <&gpio3 29 0>;
interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,err006687-war-present;
status = "okay";
};
--
2.8.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] ARM: dts: imx6: tag boards that have the HW workaround for ERR006687
2016-06-01 15:29 ` [PATCH 2/2] ARM: dts: imx6: tag boards that have the HW workaround for ERR006687 Lucas Stach
@ 2016-06-01 16:17 ` Russell King - ARM Linux
[not found] ` <20160601161729.GB19428-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Russell King - ARM Linux @ 2016-06-01 16:17 UTC (permalink / raw)
To: Lucas Stach
Cc: Shawn Guo, Fugang Duan, devicetree, patchwork-lst, kernel,
linux-arm-kernel, netdev
On Wed, Jun 01, 2016 at 05:29:43PM +0200, Lucas Stach wrote:
> @@ -97,6 +97,7 @@
> phy-reset-gpios = <&gpio3 31 0>;
> interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
> <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
> + fsl,err006687-war-present;
war? Any reason not to spell it out, or use the more natural
abbreviation "wa"?
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Software workaround for i.MX6Q/DL ERR006687
2016-06-01 15:29 [PATCH 0/2] Software workaround for i.MX6Q/DL ERR006687 Lucas Stach
2016-06-01 15:29 ` [PATCH 1/2] ARM: imx6: disable deeper idle states when FEC is active w/o HW workaround Lucas Stach
2016-06-01 15:29 ` [PATCH 2/2] ARM: dts: imx6: tag boards that have the HW workaround for ERR006687 Lucas Stach
@ 2016-06-02 19:10 ` David Miller
2 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2016-06-02 19:10 UTC (permalink / raw)
To: l.stach
Cc: shawnguo, fugang.duan, devicetree, linux-arm-kernel, netdev,
kernel, patchwork-lst
From: Lucas Stach <l.stach@pengutronix.de>
Date: Wed, 1 Jun 2016 17:29:41 +0200
> I would prefer if this series gets merged through the imx achitecture
> tree with acks for the FEC changes from the network people.
Sure, this is fine:
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 10+ messages in thread