LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: 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, linux-imx@nxp.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next 2/3] net: fec: add support to select wakeup irq source
Date: Thu,  5 Aug 2021 15:46:14 +0800	[thread overview]
Message-ID: <20210805074615.29096-3-qiangqing.zhang@nxp.com> (raw)
In-Reply-To: <20210805074615.29096-1-qiangqing.zhang@nxp.com>

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 <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 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


  parent reply	other threads:[~2021-08-05  7:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  7:46 [PATCH net-next 0/3] " Joakim Zhang
2021-08-05  7:46 ` [PATCH net-next 1/3] dt-bindings: net: fsl,fec: add "fsl,wakeup-irq" property Joakim Zhang
2021-08-05  9:18   ` [PATCH net-next 1/3] dt-bindings: net: fsl, fec: add "fsl, wakeup-irq" property Florian Fainelli
2021-08-09  5:08     ` Joakim Zhang
2021-08-09 18:39       ` Florian Fainelli
2021-08-10  2:21         ` Joakim Zhang
2021-08-10 14:32           ` Andrew Lunn
2021-08-11  7:57             ` Joakim Zhang
2021-08-11 16:16               ` Andrew Lunn
2021-08-13 18:22               ` Rob Herring
2021-08-16  6:48                 ` Joakim Zhang
2021-08-10 17:45           ` Florian Fainelli
2021-08-11  8:06             ` Joakim Zhang
2021-08-12  9:46               ` Florian Fainelli
2021-08-05  7:46 ` Joakim Zhang [this message]
2021-08-05  7:46 ` [PATCH net-next 3/3] arm64: dts: imx8m: add "fsl,wakeup-irq" property for FEC Joakim Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210805074615.29096-3-qiangqing.zhang@nxp.com \
    --to=qiangqing.zhang@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --subject='Re: [PATCH net-next 2/3] net: fec: add support to select wakeup irq source' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).