2021-08-05 08:56:18

by Joakim Zhang

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

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


2021-08-05 08:58:31

by Joakim Zhang

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

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 <[email protected]>
Signed-off-by: Joakim Zhang <[email protected]>
---
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

2021-08-05 08:58:31

by Joakim Zhang

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

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

Signed-off-by: Fugang Duan <[email protected]>
Signed-off-by: Joakim Zhang <[email protected]>
---
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