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@xxxxxxx> Signed-off-by: Joakim Zhang <qiangqing.zhang@xxxxxxx> --- 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