[PATCH net-next 0/3] net: fec: add support to select wakeup irq source

STALE1817d

16 messages, 4 authors, 2021-08-16 · open the first message on its own page

[PATCH net-next 0/3] net: fec: add support to select wakeup irq source

From: Joakim Zhang <hidden>
Date: 2021-08-05 07:47:16

This patch set intends to add support to select wakeup irq source.

Joakim Zhang (3):
  dt-bindings: net: fsl,fec: add "fsl,wakeup-irq" property
  net: fec: add support to select wakeup irq source
  arm64: dts: imx8m: add "fsl,wakeup-irq" property for FEC

 .../devicetree/bindings/net/fsl,fec.yaml          |  7 +++++++
 arch/arm64/boot/dts/freescale/imx8mm.dtsi         |  1 +
 arch/arm64/boot/dts/freescale/imx8mn.dtsi         |  1 +
 arch/arm64/boot/dts/freescale/imx8mp.dtsi         |  1 +
 arch/arm64/boot/dts/freescale/imx8mq.dtsi         |  1 +
 drivers/net/ethernet/freescale/fec.h              |  1 +
 drivers/net/ethernet/freescale/fec_main.c         | 15 +++++++++++----
 7 files changed, 23 insertions(+), 4 deletions(-)

-- 
2.17.1

[PATCH net-next 1/3] dt-bindings: net: fsl,fec: add "fsl,wakeup-irq" property

From: Joakim Zhang <hidden>
Date: 2021-08-05 07:47:30

Add "fsl,wakeup-irq" property for FEC controller to select wakeup irq
source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
---
 Documentation/devicetree/bindings/net/fsl,fec.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/fsl,fec.yaml b/Documentation/devicetree/bindings/net/fsl,fec.yaml
index eca41443fcce..d83f2103c1e6 100644
--- a/Documentation/devicetree/bindings/net/fsl,fec.yaml
+++ b/Documentation/devicetree/bindings/net/fsl,fec.yaml
@@ -164,6 +164,13 @@ properties:
       req_gpr is the gpr register offset for ENET stop request.
       req_bit is the gpr bit offset for ENET stop request.
 
+  fsl,wakeup-irq:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      The property defines the wakeup irq index in enet irq source, the default
+      value is 0 if not specified.
+    enum: [0, 1, 2, 3]
+
   mdio:
     type: object
     description:
-- 
2.17.1

[PATCH net-next 2/3] net: fec: add support to select wakeup irq source

From: Joakim Zhang <hidden>
Date: 2021-08-05 07:47:47

The FEC driver default treats irq[0] as wakeup source, but this situation
changed on i.MX8M SoCs, this patch adds support to select wakeup irq
source with "fsl,wakeup-irq" property.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
---
 drivers/net/ethernet/freescale/fec.h      |  1 +
 drivers/net/ethernet/freescale/fec_main.c | 15 +++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index ae3259164395..fe4dfe2d25ea 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -578,6 +578,7 @@ struct fec_enet_private {
 	bool	bufdesc_ex;
 	int	pause_flag;
 	int	wol_flag;
+	int     wake_irq;
 	u32	quirks;
 
 	struct	napi_struct napi;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 1201c13afa6f..c422a309d33c 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2878,12 +2878,12 @@ fec_enet_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 	device_set_wakeup_enable(&ndev->dev, wol->wolopts & WAKE_MAGIC);
 	if (device_may_wakeup(&ndev->dev)) {
 		fep->wol_flag |= FEC_WOL_FLAG_ENABLE;
-		if (fep->irq[0] > 0)
-			enable_irq_wake(fep->irq[0]);
+		if (fep->wake_irq > 0)
+			enable_irq_wake(fep->wake_irq);
 	} else {
 		fep->wol_flag &= (~FEC_WOL_FLAG_ENABLE);
-		if (fep->irq[0] > 0)
-			disable_irq_wake(fep->irq[0]);
+		if (fep->wake_irq > 0)
+			disable_irq_wake(fep->wake_irq);
 	}
 
 	return 0;
@@ -3935,6 +3935,13 @@ fec_probe(struct platform_device *pdev)
 		fep->irq[i] = irq;
 	}
 
+	/* Get wakeup irq */
+	ret = of_property_read_u32(np, "fsl,wakeup-irq", &irq);
+	if (!ret && irq >= 0 && irq < irq_cnt)
+		fep->wake_irq = fep->irq[irq];
+	else
+		fep->wake_irq = fep->irq[0];
+
 	ret = fec_enet_mii_init(pdev);
 	if (ret)
 		goto failed_mii_init;
-- 
2.17.1

[PATCH net-next 3/3] arm64: dts: imx8m: add "fsl,wakeup-irq" property for FEC

From: Joakim Zhang <hidden>
Date: 2021-08-05 07:47:50

Add "fsl,wakeup-irq" property for FEC to provide wakeup irq source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
---
 arch/arm64/boot/dts/freescale/imx8mm.dtsi | 1 +
 arch/arm64/boot/dts/freescale/imx8mn.dtsi | 1 +
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 +
 arch/arm64/boot/dts/freescale/imx8mq.dtsi | 1 +
 4 files changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
index 1608a48495b6..11aac9209944 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
@@ -948,6 +948,7 @@
 				nvmem-cell-names = "mac-address";
 				nvmem_macaddr_swap;
 				fsl,stop-mode = <&gpr 0x10 3>;
+				fsl,wakeup-irq = <2>;
 				status = "disabled";
 			};
 
diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
index e6de293865b0..2c921ba519dd 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
@@ -951,6 +951,7 @@
 				nvmem-cell-names = "mac-address";
 				nvmem_macaddr_swap;
 				fsl,stop-mode = <&gpr 0x10 3>;
+				fsl,wakeup-irq = <2>;
 				status = "disabled";
 			};
 
diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index f4eaab3ecf03..ce4efe0a9bca 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -814,6 +814,7 @@
 				nvmem-cells = <&eth_mac1>;
 				nvmem-cell-names = "mac-address";
 				fsl,stop-mode = <&gpr 0x10 3>;
+				fsl,wakeup-irq = <2>;
 				nvmem_macaddr_swap;
 				status = "disabled";
 			};
diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
index 91df9c5350ae..d7b68630098b 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
@@ -1191,6 +1191,7 @@
 				nvmem-cell-names = "mac-address";
 				nvmem_macaddr_swap;
 				fsl,stop-mode = <&iomuxc_gpr 0x10 3>;
+				fsl,wakeup-irq = <2>;
 				status = "disabled";
 			};
 		};
-- 
2.17.1

Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-08-05 09:18:34


On 8/5/2021 12:46 AM, Joakim Zhang wrote:
Add "fsl,wakeup-irq" property for FEC controller to select wakeup irq
source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
Why are not you making use of the standard interrupts-extended property 
which allows different interrupt lines to be originating from different 
interrupt controllers, e.g.:

interrupts-extended = <&gic GIC_SPI 112 4>, <&wakeup_intc 0>;
-- 
Florian

RE: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Joakim Zhang <hidden>
Date: 2021-08-09 05:09:00

Hi Florian,
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月5日 17:18
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property



On 8/5/2021 12:46 AM, Joakim Zhang wrote:
quoted
Add "fsl,wakeup-irq" property for FEC controller to select wakeup irq
source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
Why are not you making use of the standard interrupts-extended property
which allows different interrupt lines to be originating from different interrupt
controllers, e.g.:

interrupts-extended = <&gic GIC_SPI 112 4>, <&wakeup_intc 0>;
Thanks.

AFAIK, interrupts-extended should be used instead of interrupts when a device is connected to multiple interrupt controllers
as it encodes a parent phandle with each interrupt specifier. However, for FEC controller, all interrupt lines are originating from
the same interrupt controllers.

1) FEC controller has up to 4 interrupt lines and all of these are routed to GIC interrupt controller.
2) FEC has a wakeup interrupt signal and always are mixed with other interrupt signals, and then output to one interrupt line.
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but for i.MX8M serials, are mixed to int2 line.
4) Now driver treat int0 as the wakeup source by default, it is broken for i.MX8M.

Best Regards,
Joakim Zhang
--
Florian

Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-08-09 18:39:51


On 8/8/2021 10:08 PM, Joakim Zhang wrote:
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月5日 17:18
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property



On 8/5/2021 12:46 AM, Joakim Zhang wrote:
quoted
Add "fsl,wakeup-irq" property for FEC controller to select wakeup irq
source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
Why are not you making use of the standard interrupts-extended property
which allows different interrupt lines to be originating from different interrupt
controllers, e.g.:

interrupts-extended = <&gic GIC_SPI 112 4>, <&wakeup_intc 0>;
Thanks.

AFAIK, interrupts-extended should be used instead of interrupts when a device is connected to multiple interrupt controllers
as it encodes a parent phandle with each interrupt specifier. However, for FEC controller, all interrupt lines are originating from
the same interrupt controllers.
OK, so why this custom property then?
1) FEC controller has up to 4 interrupt lines and all of these are routed to GIC interrupt controller.
2) FEC has a wakeup interrupt signal and always are mixed with other interrupt signals, and then output to one interrupt line.
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but for i.MX8M serials, are mixed to int2 line.
4) Now driver treat int0 as the wakeup source by default, it is broken for i.MX8M.
I don't really know what to make of your response, it seems to me that 
you are carrying some legacy Device Tree properties that were invented 
when interrupts-extended did not exist and we did not know any better.
-- 
Florian

RE: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Joakim Zhang <hidden>
Date: 2021-08-10 02:22:11

Hi Florian,
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月10日 2:40
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property



On 8/8/2021 10:08 PM, Joakim Zhang wrote:
quoted
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月5日 17:18
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add
"fsl, wakeup-irq" property



On 8/5/2021 12:46 AM, Joakim Zhang wrote:
quoted
Add "fsl,wakeup-irq" property for FEC controller to select wakeup
irq source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
Why are not you making use of the standard interrupts-extended
property which allows different interrupt lines to be originating
from different interrupt controllers, e.g.:

interrupts-extended = <&gic GIC_SPI 112 4>, <&wakeup_intc 0>;
Thanks.

AFAIK, interrupts-extended should be used instead of interrupts when a
device is connected to multiple interrupt controllers as it encodes a
parent phandle with each interrupt specifier. However, for FEC controller, all
interrupt lines are originating from the same interrupt controllers.

OK, so why this custom property then?
quoted
1) FEC controller has up to 4 interrupt lines and all of these are routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but for i.MX8M
serials, are mixed to int2 line.
quoted
4) Now driver treat int0 as the wakeup source by default, it is broken for
i.MX8M.

I don't really know what to make of your response, it seems to me that you are
carrying some legacy Device Tree properties that were invented when
interrupts-extended did not exist and we did not know any better.
As I described in former mail, it is not related to interrupts-extended property.

Let's take a look, e.g.

1) arch/arm/boot/dts/imx7d.dtsi
interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are originating from GIC interrupt controller, "int0" for queue 0 and other interrupt signals, containing wakeup;
"int1" for queue 1; "int2" for queue 2.

2) arch/arm64/boot/dts/freescale/imx8mq.dtsi
interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are also originating from GIC interrupt controller, "int0" for queue 0; "int1" for queue 1; "int2" for queue 2 and other
interrupt signals, containing wakeup.

If we want to use WoL feature, we need invoke enable_irq_wake() to let this specific interrupt line be a wakeup source. For FEC driver now,
it treats "int0" as wakeup interrupt by default. Obviously it's not fine for i.MX8M serials, since SoC mix wakeup interrupt signal into "int2",
so I add this "fsl,wakeup-irq" custom property to indicate which interrupt line contains wakeup signal.

Not sure if I have explained it clearly enough, from my point of view, I think interrupts-extended property can't fix this issue, right?

If there is any common properties can be used for it, please let me know. Or any other better solutions also be appreciated. Thanks.
 
Best Regards,
Joakim Zhang
--
Florian

Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-08-10 14:33:19

quoted
quoted
1) FEC controller has up to 4 interrupt lines and all of these are routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but for i.MX8M
serials, are mixed to int2 line.
So you need to know which of the interrupts listed is the wake up
interrupt.

I can see a few ways to do this:

The FEC driver already has quirks. Add a quirk to fec_imx8mq_info and
fec_imx8qm_info to indicate these should use int2.

or

Documentation/devicetree/bindings/interrupt-controller/interrupts.txt 

  b) two cells
  ------------
  The #interrupt-cells property is set to 2 and the first cell defines the
  index of the interrupt within the controller, while the second cell is used
  to specify any of the following flags:
    - bits[3:0] trigger type and level flags
        1 = low-to-high edge triggered
        2 = high-to-low edge triggered
        4 = active high level-sensitive
        8 = active low level-sensitive

You could add

       18 = wakeup source

and extend to core to either do all the work for you, or tell you this
interrupt is flagged as being a wakeup source. This solution has the
advantage of it should be usable in other drivers.

	  Andrew

Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-08-10 18:17:01


On 8/9/2021 7:21 PM, Joakim Zhang wrote:
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月10日 2:40
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property



On 8/8/2021 10:08 PM, Joakim Zhang wrote:
quoted
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月5日 17:18
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add
"fsl, wakeup-irq" property



On 8/5/2021 12:46 AM, Joakim Zhang wrote:
quoted
Add "fsl,wakeup-irq" property for FEC controller to select wakeup
irq source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
Why are not you making use of the standard interrupts-extended
property which allows different interrupt lines to be originating
from different interrupt controllers, e.g.:

interrupts-extended = <&gic GIC_SPI 112 4>, <&wakeup_intc 0>;
Thanks.

AFAIK, interrupts-extended should be used instead of interrupts when a
device is connected to multiple interrupt controllers as it encodes a
parent phandle with each interrupt specifier. However, for FEC controller, all
interrupt lines are originating from the same interrupt controllers.

OK, so why this custom property then?
quoted
1) FEC controller has up to 4 interrupt lines and all of these are routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but for i.MX8M
serials, are mixed to int2 line.
quoted
4) Now driver treat int0 as the wakeup source by default, it is broken for
i.MX8M.

I don't really know what to make of your response, it seems to me that you are
carrying some legacy Device Tree properties that were invented when
interrupts-extended did not exist and we did not know any better.
As I described in former mail, it is not related to interrupts-extended property.

Let's take a look, e.g.

1) arch/arm/boot/dts/imx7d.dtsi
interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are originating from GIC interrupt controller, "int0" for queue 0 and other interrupt signals, containing wakeup;
"int1" for queue 1; "int2" for queue 2.

2) arch/arm64/boot/dts/freescale/imx8mq.dtsi
interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are also originating from GIC interrupt controller, "int0" for queue 0; "int1" for queue 1; "int2" for queue 2 and other
interrupt signals, containing wakeup.

If we want to use WoL feature, we need invoke enable_irq_wake() to let this specific interrupt line be a wakeup source. For FEC driver now,
it treats "int0" as wakeup interrupt by default. Obviously it's not fine for i.MX8M serials, since SoC mix wakeup interrupt signal into "int2",
so I add this "fsl,wakeup-irq" custom property to indicate which interrupt line contains wakeup signal.

Not sure if I have explained it clearly enough, from my point of view, I think interrupts-extended property can't fix this issue, right?
This is clearer, and indeed interrupts-extended won't fix that, however 
it seems to me that this is a problem that ought to be fixed at the 
interrupt controller/irq_chip level which should know and be told which 
interrupt lines can be made wake-up interrupts or not. From there on, 
the driver can test with enable_irq_wake() whether this has a chance of 
working or not.

It seems to me that the 'fsl,wakeup-irq' property ought to be within the 
interrupt controller Device Tree node (where it would be easier to 
validate that the specific interrupt line is correct) as opposed to 
within the consumer (FEC) Device Tree node.
If there is any common properties can be used for it, please let me know. Or any other better solutions also be appreciated. Thanks.
There is a standard 'wakeup-source' boolean property that can be added 
to any Device Tree node to indicate it can be a wake-up source, but what 
you need here is a bitmask, so introducing a custom property may be 
appropriate here.
-- 
Florian

RE: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Joakim Zhang <hidden>
Date: 2021-08-11 07:58:13

Hi Andrew,
-----Original Message-----
From: Andrew Lunn <andrew@lunn.ch>
Sent: 2021年8月10日 22:33
To: Joakim Zhang <redacted>
Cc: Florian Fainelli <f.fainelli@gmail.com>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; kernel@pengutronix.de;
dl-linux-imx [off-list ref]; netdev@vger.kernel.org;
devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property
quoted
quoted
quoted
1) FEC controller has up to 4 interrupt lines and all of these are
routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with
other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but
for i.MX8M
serials, are mixed to int2 line.
So you need to know which of the interrupts listed is the wake up interrupt.

I can see a few ways to do this:

The FEC driver already has quirks. Add a quirk to fec_imx8mq_info and
fec_imx8qm_info to indicate these should use int2.

or

Documentation/devicetree/bindings/interrupt-controller/interrupts.txt

  b) two cells
  ------------
  The #interrupt-cells property is set to 2 and the first cell defines the
  index of the interrupt within the controller, while the second cell is used
  to specify any of the following flags:
    - bits[3:0] trigger type and level flags
        1 = low-to-high edge triggered
        2 = high-to-low edge triggered
        4 = active high level-sensitive
        8 = active low level-sensitive

You could add

       18 = wakeup source

and extend to core to either do all the work for you, or tell you this interrupt is
flagged as being a wakeup source. This solution has the advantage of it should
be usable in other drivers.
Thanks a lot for your comments first!

I just look into the irq code, if we extend bit[5] to carry wakeup info ( due to bit[4] is used for IRQ_TYPE_PROBE), 
then configure it in the TYPE field of 'interrupts' property, so that interrupt controller would know which interrupt
is wakeup capable. 
I think there is no much work core would do, may just set this interrupt wakup capable. Another functionality is
driver side get this info to identify which mixed interrupt has wakeup capability, we can export symbol from kernel/irq/irqdomain.c.

The intention is to let driver know which interrupt is wakeup capable, I would choose to provider this in specific driver,
instead of interrupt controller, it seems to me that others may all choose this solution for wakeup mixed interrupt.

So I would prefer solution 1, it's easier and under-control. I can have a try if you strongly recommend solution 2.

Best Regards,
Joakim Zhang
	  Andrew

RE: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Joakim Zhang <hidden>
Date: 2021-08-11 08:08:56

-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月11日 1:45
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property



On 8/9/2021 7:21 PM, Joakim Zhang wrote:
quoted
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月10日 2:40
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add
"fsl, wakeup-irq" property



On 8/8/2021 10:08 PM, Joakim Zhang wrote:
quoted
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月5日 17:18
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add
"fsl, wakeup-irq" property



On 8/5/2021 12:46 AM, Joakim Zhang wrote:
quoted
Add "fsl,wakeup-irq" property for FEC controller to select wakeup
irq source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
Why are not you making use of the standard interrupts-extended
property which allows different interrupt lines to be originating
from different interrupt controllers, e.g.:

interrupts-extended = <&gic GIC_SPI 112 4>, <&wakeup_intc 0>;
Thanks.

AFAIK, interrupts-extended should be used instead of interrupts when
a device is connected to multiple interrupt controllers as it
encodes a parent phandle with each interrupt specifier. However, for
FEC controller, all
interrupt lines are originating from the same interrupt controllers.

OK, so why this custom property then?
quoted
1) FEC controller has up to 4 interrupt lines and all of these are
routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but for
i.MX8M
serials, are mixed to int2 line.
quoted
4) Now driver treat int0 as the wakeup source by default, it is
broken for
i.MX8M.

I don't really know what to make of your response, it seems to me
that you are carrying some legacy Device Tree properties that were
invented when interrupts-extended did not exist and we did not know any
better.
quoted
As I described in former mail, it is not related to interrupts-extended
property.
quoted
Let's take a look, e.g.

1) arch/arm/boot/dts/imx7d.dtsi
interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are originating from GIC interrupt controller,
"int0" for queue 0 and other interrupt signals, containing wakeup; "int1" for
queue 1; "int2" for queue 2.
quoted
2) arch/arm64/boot/dts/freescale/imx8mq.dtsi
interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are also originating from GIC interrupt
controller, "int0" for queue 0; "int1" for queue 1; "int2" for queue 2 and other
interrupt signals, containing wakeup.
quoted
If we want to use WoL feature, we need invoke enable_irq_wake() to let
this specific interrupt line be a wakeup source. For FEC driver now,
it treats "int0" as wakeup interrupt by default. Obviously it's not fine for
i.MX8M serials, since SoC mix wakeup interrupt signal into "int2", so I add this
"fsl,wakeup-irq" custom property to indicate which interrupt line contains
wakeup signal.
quoted
Not sure if I have explained it clearly enough, from my point of view, I think
interrupts-extended property can't fix this issue, right?

This is clearer, and indeed interrupts-extended won't fix that, however it seems
to me that this is a problem that ought to be fixed at the interrupt
controller/irq_chip level which should know and be told which interrupt lines
can be made wake-up interrupts or not. From there on, the driver can test with
enable_irq_wake() whether this has a chance of working or not.
How can we test with enable_irq_wake()? I agree that interrupt controller can recognize
wakeup interrupt is better. 
It seems to me that the 'fsl,wakeup-irq' property ought to be within the
interrupt controller Device Tree node (where it would be easier to validate that
the specific interrupt line is correct) as opposed to within the consumer (FEC)
Device Tree node.
Not quite understand, could you explain more?
quoted
If there is any common properties can be used for it, please let me know. Or
any other better solutions also be appreciated. Thanks.

There is a standard 'wakeup-source' boolean property that can be added
to any Device Tree node to indicate it can be a wake-up source, but what
you need here is a bitmask, so introducing a custom property may be
appropriate here.
Yes, I know 'wakeup-source' boolean property that identify this DEVICE
can be a wakeup source, it's not related to interrupt.

Best Regards,
Joakim Zhang
--
Florian

Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-08-11 16:16:26

So I would prefer solution 1, it's easier and under-control.
Hi Joakim

Using quirks is fine by me.

      Andrew

Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-08-12 09:46:38


On 8/11/2021 1:06 AM, Joakim Zhang wrote:
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月11日 1:45
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property



On 8/9/2021 7:21 PM, Joakim Zhang wrote:
quoted
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月10日 2:40
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add
"fsl, wakeup-irq" property



On 8/8/2021 10:08 PM, Joakim Zhang wrote:
quoted
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli <f.fainelli@gmail.com>
Sent: 2021年8月5日 17:18
To: Joakim Zhang <redacted>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; andrew@lunn.ch
Cc: kernel@pengutronix.de; dl-linux-imx <redacted>;
netdev@vger.kernel.org; devicetree@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add
"fsl, wakeup-irq" property



On 8/5/2021 12:46 AM, Joakim Zhang wrote:
quoted
Add "fsl,wakeup-irq" property for FEC controller to select wakeup
irq source.

Signed-off-by: Fugang Duan <redacted>
Signed-off-by: Joakim Zhang <redacted>
Why are not you making use of the standard interrupts-extended
property which allows different interrupt lines to be originating
from different interrupt controllers, e.g.:

interrupts-extended = <&gic GIC_SPI 112 4>, <&wakeup_intc 0>;
Thanks.

AFAIK, interrupts-extended should be used instead of interrupts when
a device is connected to multiple interrupt controllers as it
encodes a parent phandle with each interrupt specifier. However, for
FEC controller, all
interrupt lines are originating from the same interrupt controllers.

OK, so why this custom property then?
quoted
1) FEC controller has up to 4 interrupt lines and all of these are
routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but for
i.MX8M
serials, are mixed to int2 line.
quoted
4) Now driver treat int0 as the wakeup source by default, it is
broken for
i.MX8M.

I don't really know what to make of your response, it seems to me
that you are carrying some legacy Device Tree properties that were
invented when interrupts-extended did not exist and we did not know any
better.
quoted
As I described in former mail, it is not related to interrupts-extended
property.
quoted
Let's take a look, e.g.

1) arch/arm/boot/dts/imx7d.dtsi
interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are originating from GIC interrupt controller,
"int0" for queue 0 and other interrupt signals, containing wakeup; "int1" for
queue 1; "int2" for queue 2.
quoted
2) arch/arm64/boot/dts/freescale/imx8mq.dtsi
interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
	<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1", "int2", "pps";

For these 4 interrupts are also originating from GIC interrupt
controller, "int0" for queue 0; "int1" for queue 1; "int2" for queue 2 and other
interrupt signals, containing wakeup.
quoted
If we want to use WoL feature, we need invoke enable_irq_wake() to let
this specific interrupt line be a wakeup source. For FEC driver now,
it treats "int0" as wakeup interrupt by default. Obviously it's not fine for
i.MX8M serials, since SoC mix wakeup interrupt signal into "int2", so I add this
"fsl,wakeup-irq" custom property to indicate which interrupt line contains
wakeup signal.
quoted
Not sure if I have explained it clearly enough, from my point of view, I think
interrupts-extended property can't fix this issue, right?

This is clearer, and indeed interrupts-extended won't fix that, however it seems
to me that this is a problem that ought to be fixed at the interrupt
controller/irq_chip level which should know and be told which interrupt lines
can be made wake-up interrupts or not. From there on, the driver can test with
enable_irq_wake() whether this has a chance of working or not.
How can we test with enable_irq_wake()? I agree that interrupt controller can recognize
wakeup interrupt is better.
If enable_irq_wake() returns -ENOTSUPP you would know that wake-up for 
that interrupt controller's line is not capable of wake-up?
quoted
It seems to me that the 'fsl,wakeup-irq' property ought to be within the
interrupt controller Device Tree node (where it would be easier to validate that
the specific interrupt line is correct) as opposed to within the consumer (FEC)
Device Tree node.
Not quite understand, could you explain more?
What I mean is that if you need to express which interrupt lines within 
an interrupt controller are capable of wake-up, then there should be a 
property that tells us that and that property needs to be within the 
interrupt controller, not within the consumer of that interrupt since 
the consumer has no idea how the system is wired up. Andrew's suggestion 
is sort of the same thing, except that it punts the responsibility of 
specifying the interrupt's capability towards the consumer of that 
interrupt.
-- 
Florian

Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Rob Herring <robh@kernel.org>
Date: 2021-08-13 18:23:04

On Wed, Aug 11, 2021 at 07:57:46AM +0000, Joakim Zhang wrote:
Hi Andrew,
quoted
-----Original Message-----
From: Andrew Lunn <andrew@lunn.ch>
Sent: 2021年8月10日 22:33
To: Joakim Zhang <redacted>
Cc: Florian Fainelli <f.fainelli@gmail.com>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; kernel@pengutronix.de;
dl-linux-imx [off-list ref]; netdev@vger.kernel.org;
devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property
quoted
quoted
quoted
1) FEC controller has up to 4 interrupt lines and all of these are
routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with
other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line, but
for i.MX8M
serials, are mixed to int2 line.
So you need to know which of the interrupts listed is the wake up interrupt.
We already have a way to do this by using 'wakeup' for the 
interrupt-names entry. But I guess that ship has sailed here and that 
wouldn't work well if not just a wakeup source (though you could repeat 
an interrupt line that's the wakeup source).
quoted
I can see a few ways to do this:

The FEC driver already has quirks. Add a quirk to fec_imx8mq_info and
fec_imx8qm_info to indicate these should use int2.
Bingo!

Note that if the device is wakeup capable, it should have a 
'wakeup-source' property in this case.
quoted
or

Documentation/devicetree/bindings/interrupt-controller/interrupts.txt

  b) two cells
  ------------
  The #interrupt-cells property is set to 2 and the first cell defines the
  index of the interrupt within the controller, while the second cell is used
  to specify any of the following flags:
    - bits[3:0] trigger type and level flags
        1 = low-to-high edge triggered
        2 = high-to-low edge triggered
        4 = active high level-sensitive
        8 = active low level-sensitive

You could add

       18 = wakeup source
I'd be okay with this (though it should be a power of 2 number).
quoted
and extend to core to either do all the work for you, or tell you this interrupt is
flagged as being a wakeup source. This solution has the advantage of it should
be usable in other drivers.
Another option is couldn't you just enable all the interrupts as wakeup 
sources? Presumably, only one of them would trigger a wakeup.
Thanks a lot for your comments first!

I just look into the irq code, if we extend bit[5] to carry wakeup info ( due to bit[4] is used for IRQ_TYPE_PROBE), 
then configure it in the TYPE field of 'interrupts' property, so that interrupt controller would know which interrupt
is wakeup capable. 
I think there is no much work core would do, may just set this interrupt wakup capable. Another functionality is
driver side get this info to identify which mixed interrupt has wakeup capability, we can export symbol from kernel/irq/irqdomain.c.

The intention is to let driver know which interrupt is wakeup capable, I would choose to provider this in specific driver,
instead of interrupt controller, it seems to me that others may all choose this solution for wakeup mixed interrupt.

So I would prefer solution 1, it's easier and under-control. I can have a try if you strongly recommend solution 2.

Best Regards,
Joakim Zhang
quoted
	  Andrew

RE: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property

From: Joakim Zhang <hidden>
Date: 2021-08-16 06:49:00

-----Original Message-----
From: Rob Herring <robh@kernel.org>
Sent: 2021年8月14日 2:23
To: Joakim Zhang <redacted>
Cc: Andrew Lunn <andrew@lunn.ch>; Florian Fainelli <f.fainelli@gmail.com>;
davem@davemloft.net; kuba@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; kernel@pengutronix.de;
dl-linux-imx [off-list ref]; netdev@vger.kernel.org;
devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl,
wakeup-irq" property

On Wed, Aug 11, 2021 at 07:57:46AM +0000, Joakim Zhang wrote:
quoted
Hi Andrew,
quoted
-----Original Message-----
From: Andrew Lunn <andrew@lunn.ch>
Sent: 2021年8月10日 22:33
To: Joakim Zhang <redacted>
Cc: Florian Fainelli <f.fainelli@gmail.com>; davem@davemloft.net;
kuba@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org;
s.hauer@pengutronix.de; festevam@gmail.com; kernel@pengutronix.de;
dl-linux-imx [off-list ref]; netdev@vger.kernel.org;
devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add
"fsl, wakeup-irq" property
quoted
quoted
quoted
1) FEC controller has up to 4 interrupt lines and all of these
are routed to GIC
interrupt controller.
quoted
2) FEC has a wakeup interrupt signal and always are mixed with
other
interrupt signals, and then output to one interrupt line.
quoted
3) For legacy SoCs, wakeup interrupt are mixed to int0 line,
but for i.MX8M
serials, are mixed to int2 line.
So you need to know which of the interrupts listed is the wake up interrupt.
We already have a way to do this by using 'wakeup' for the interrupt-names
entry. But I guess that ship has sailed here and that wouldn't work well if not
just a wakeup source (though you could repeat an interrupt line that's the
wakeup source).
Yes, I am not sure whether it's a common solution, such as:
interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
		<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
interrupt-names = "int0", "int1", "int2", "pps", "wakeup";

Where we repeat interrupt 120 for both "int2" and "wakeup", does you mean this?
quoted
quoted
I can see a few ways to do this:

The FEC driver already has quirks. Add a quirk to fec_imx8mq_info
and fec_imx8qm_info to indicate these should use int2.
Bingo!

Note that if the device is wakeup capable, it should have a 'wakeup-source'
property in this case.
quoted
quoted
or

Documentation/devicetree/bindings/interrupt-controller/interrupts.tx
t

  b) two cells
  ------------
  The #interrupt-cells property is set to 2 and the first cell defines the
  index of the interrupt within the controller, while the second cell is used
  to specify any of the following flags:
    - bits[3:0] trigger type and level flags
        1 = low-to-high edge triggered
        2 = high-to-low edge triggered
        4 = active high level-sensitive
        8 = active low level-sensitive

You could add

       18 = wakeup source
I'd be okay with this (though it should be a power of 2 number).
quoted
quoted
and extend to core to either do all the work for you, or tell you
this interrupt is flagged as being a wakeup source. This solution
has the advantage of it should be usable in other drivers.
Another option is couldn't you just enable all the interrupts as wakeup sources?
Presumably, only one of them would trigger a wakeup.
Yes, another solution, I thought it but not implemented it as we had better let users know which
interrupt is wakeup capable.

Best Regards,
Joakim Zhang
quoted
Thanks a lot for your comments first!

I just look into the irq code, if we extend bit[5] to carry wakeup
info ( due to bit[4] is used for IRQ_TYPE_PROBE), then configure it in
the TYPE field of 'interrupts' property, so that interrupt controller would know
which interrupt is wakeup capable.
quoted
I think there is no much work core would do, may just set this
interrupt wakup capable. Another functionality is driver side get this info to
identify which mixed interrupt has wakeup capability, we can export symbol
from kernel/irq/irqdomain.c.
quoted
The intention is to let driver know which interrupt is wakeup capable,
I would choose to provider this in specific driver, instead of interrupt
controller, it seems to me that others may all choose this solution for wakeup
mixed interrupt.
quoted
So I would prefer solution 1, it's easier and under-control. I can have a try if
you strongly recommend solution 2.
quoted
Best Regards,
Joakim Zhang
quoted
	  Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help