From patchwork Wed Jun 14 22:30:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 108165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp267992vqr; Wed, 14 Jun 2023 15:43:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Io9pUPMnL6cpJz8IRGOZcoKOYnztjlX/B+qJhy9GWwM897uKxcKDrYI5Y2oAmmwhO0wJb X-Received: by 2002:a17:907:9802:b0:971:fa86:27e with SMTP id ji2-20020a170907980200b00971fa86027emr19055199ejc.16.1686782612835; Wed, 14 Jun 2023 15:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686782612; cv=none; d=google.com; s=arc-20160816; b=Elu4Ut1VY9rfgS77kKBa8PoqWAnhcY9CPvokddGDuvhRu4o7nxKsw7B659Oc6xmwAA Sopa5RYa/qGs5zaF0xqJz4WlBehSGdK7wOvKji8fWvJWqReWCmKsRSRV5wIR4xmxMT6D pgk4ZArndQ38FPEN/dEVbLHspZbISrlpg8UyDMy0v0Yi19DpWnUbbWY2GIOvqGzd2bTw FgBtwE+aGsUSFCgLPXLaflgvwJLzNPMfzHqY0WpT02BzDmS5DuaLoeZovyZQSHyhfzNy T7Av8ZEFt1P0qcHWB1lciriXIDYMatxdX1bBXAmax2lFvktACeBFdzHuwW5UACTFtphz Y2uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=YelVQtn6X9Ycq1Mlau/Bc0alEuimdDbkJF/ycM+nmkw=; b=Wun+RKLhDyVQnbLsE0Ye63lNVXQ8dvzAAO3iIRv06zQIwEr/4UkBWOyWhWxJM8T+1F HoTttu2zVDVOhyU1YTJHI55O5vxOvrVViU56zOFBekAoWPdzf+0N5dbRB9YxEfWutOQ/ 9KhN/EvarXU3Y/ljhxV8U+X6pnP5n79skhFXMRW4bxEkoFxaQSv1lDTW9EEE+nka+Fzb Y61MUq5UP0vv9FBw4cRsBhaIQFAsffg6FdzjY7ttVJ7mtkiRYRjOCNLhKatPHVvPxeY8 dYaAQu9xDZBo2LTklFj9UgB2LCSL4EYsjif1CBZU0Mhm3G4aDU8WmHm95A/rBhKVJZuC 2CtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=HZufVfy9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb19-20020a1709070f9300b009572d0759a8si8809703ejc.225.2023.06.14.15.43.08; Wed, 14 Jun 2023 15:43:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=HZufVfy9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236893AbjFNWay (ORCPT + 99 others); Wed, 14 Jun 2023 18:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236673AbjFNWar (ORCPT ); Wed, 14 Jun 2023 18:30:47 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D67C26B5 for ; Wed, 14 Jun 2023 15:30:39 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-3f9de2605b2so1002941cf.1 for ; Wed, 14 Jun 2023 15:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686781838; x=1689373838; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=YelVQtn6X9Ycq1Mlau/Bc0alEuimdDbkJF/ycM+nmkw=; b=HZufVfy9ebvO1Bzzjz3TF0hZ1j7PkC2rCwR10AvvkuwQG6YoITxCbJCTMusRzXccib xjkkOdDBu9HxlRnjHnQiheYu1O0tl7lD/OY3IgNzB1b5ApN9KYnTZSMBOHEeCX4erMaB 7bOUnHLb1jXz22+2EGeh9yJI3XABetMmu0cCA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686781838; x=1689373838; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YelVQtn6X9Ycq1Mlau/Bc0alEuimdDbkJF/ycM+nmkw=; b=C8rXIaKsbQKzIN4hRhu33nl7tLUK8SGKD2RtGSmNchMcomJFoqMDI8g5AbdseyMpDF xi6CJx1xcLIE+mW/YZRD1paLJ8A50c87NFsAYdDIWh9rnYqNxdOAcg+ciBa7Gf3YIXgn mWbx5leiX+dEQ/s7yhUxssOJAJ5cieHGE5ME7IvDg9dfur58EVcaMHiJdYzP5ZC/Zh9y hR6hoPpqqCUpZKAVH4NE8YQ4izIPgco7ceHjCdZsNztT/sWiH9hTpxOaYehzKHVvD8H8 P7fUqrY+47ukjA0E2v4OMJe3aufaIfQDojSdyDli7TxYGw6oxFHlPcc9Y95bLvUEwpvl G9dg== X-Gm-Message-State: AC+VfDyKHM3JBhWrnVxhXHLGHurHjArevoVtjv4ybqNXiLO9qqjYQyJN vZGWpBNy3fCscyrp4Euxeoub8Q== X-Received: by 2002:ac8:7d4d:0:b0:3f8:25c:c434 with SMTP id h13-20020ac87d4d000000b003f8025cc434mr3460689qtb.19.1686781838434; Wed, 14 Jun 2023 15:30:38 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id d3-20020ac85443000000b003ef2db16e72sm5419360qtq.94.2023.06.14.15.30.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2023 15:30:37 -0700 (PDT) From: Justin Chen To: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, bcm-kernel-feedback-list@broadcom.com Cc: florian.fainelli@broadcom.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, opendmb@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, richardcochran@gmail.com, sumit.semwal@linaro.org, christian.koenig@amd.com, simon.horman@corigine.com, Justin Chen Subject: [PATCH net-next v7 04/11] net: bcmasp: Add support for WoL magic packet Date: Wed, 14 Jun 2023 15:30:13 -0700 Message-Id: <1686781820-832-5-git-send-email-justin.chen@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1686781820-832-1-git-send-email-justin.chen@broadcom.com> References: <1686781820-832-1-git-send-email-justin.chen@broadcom.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, MIME_HEADER_CTYPE_ONLY,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768719765083910025?= X-GMAIL-MSGID: =?utf-8?q?1768719765083910025?= Add support for Wake-On-Lan magic packet and magic packet with password. Signed-off-by: Justin Chen --- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 148 +++++++++++++++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp.h | 18 +++ .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 36 +++++ drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 77 +++++++++-- 4 files changed, 266 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c index 5dbd9fcdd23f..9e3977856b71 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c @@ -441,6 +441,139 @@ static int bcmasp_is_port_valid(struct bcmasp_priv *priv, int port) return port == 0 || port == 1; } +static irqreturn_t bcmasp_isr_wol(int irq, void *data) +{ + struct bcmasp_priv *priv = data; + u32 status; + + /* No L3 IRQ, so we good */ + if (priv->wol_irq <= 0) + goto irq_handled; + + status = wakeup_intr2_core_rl(priv, ASP_WAKEUP_INTR2_STATUS) & + ~wakeup_intr2_core_rl(priv, ASP_WAKEUP_INTR2_MASK_STATUS); + wakeup_intr2_core_wl(priv, status, ASP_WAKEUP_INTR2_CLEAR); + +irq_handled: + pm_wakeup_event(&priv->pdev->dev, 0); + return IRQ_HANDLED; +} + +static int bcmasp_get_and_request_irq(struct bcmasp_priv *priv, int i) +{ + struct platform_device *pdev = priv->pdev; + int irq, ret; + + irq = platform_get_irq_optional(pdev, i); + if (irq < 0) + return irq; + + ret = devm_request_irq(&pdev->dev, irq, bcmasp_isr_wol, 0, + pdev->name, priv); + if (ret) + return ret; + + return irq; +} + +static void bcmasp_init_wol_shared(struct bcmasp_priv *priv) +{ + struct platform_device *pdev = priv->pdev; + struct device *dev = &pdev->dev; + int irq; + + irq = bcmasp_get_and_request_irq(priv, 1); + if (irq < 0) { + dev_warn(dev, "Failed to init WoL irq: %d\n", irq); + return; + } + + priv->wol_irq = irq; + priv->wol_irq_enabled_mask = 0; + device_set_wakeup_capable(&pdev->dev, 1); +} + +static void bcmasp_enable_wol_shared(struct bcmasp_intf *intf, bool en) +{ + struct bcmasp_priv *priv = intf->parent; + struct device *dev = &priv->pdev->dev; + + if (en) { + if (priv->wol_irq_enabled_mask) { + set_bit(intf->port, &priv->wol_irq_enabled_mask); + return; + } + + /* First enable */ + set_bit(intf->port, &priv->wol_irq_enabled_mask); + enable_irq_wake(priv->wol_irq); + device_set_wakeup_enable(dev, 1); + } else { + if (!priv->wol_irq_enabled_mask) + return; + + clear_bit(intf->port, &priv->wol_irq_enabled_mask); + if (priv->wol_irq_enabled_mask) + return; + + /* Last disable */ + disable_irq_wake(priv->wol_irq); + device_set_wakeup_enable(dev, 0); + } +} + +static void bcmasp_wol_irq_destroy_shared(struct bcmasp_priv *priv) +{ + if (priv->wol_irq > 0) + free_irq(priv->wol_irq, priv); +} + +static void bcmasp_init_wol_per_intf(struct bcmasp_priv *priv) +{ + struct platform_device *pdev = priv->pdev; + struct device *dev = &pdev->dev; + struct bcmasp_intf *intf; + int irq, i; + + for (i = 0; i < priv->intf_count; i++) { + intf = priv->intfs[i]; + irq = bcmasp_get_and_request_irq(priv, intf->port + 1); + if (irq < 0) { + dev_warn(dev, "Failed to init WoL irq(port %d): %d\n", + intf->port, irq); + continue; + } + + intf->wol_irq = irq; + intf->wol_irq_enabled = false; + device_set_wakeup_capable(&pdev->dev, 1); + } +} + +static void bcmasp_enable_wol_per_intf(struct bcmasp_intf *intf, bool en) +{ + struct device *dev = &intf->parent->pdev->dev; + + if (en ^ intf->wol_irq_enabled) + irq_set_irq_wake(intf->wol_irq, en); + + intf->wol_irq_enabled = en; + device_set_wakeup_enable(dev, en); +} + +static void bcmasp_wol_irq_destroy_per_intf(struct bcmasp_priv *priv) +{ + struct bcmasp_intf *intf; + int i; + + for (i = 0; i < priv->intf_count; i++) { + intf = priv->intfs[i]; + + if (intf->wol_irq > 0) + free_irq(intf->wol_irq, priv); + } +} + static struct bcmasp_hw_info v20_hw_info = { .rx_ctrl_flush = ASP_RX_CTRL_FLUSH, .umac2fb = UMAC2FB_OFFSET, @@ -450,6 +583,9 @@ static struct bcmasp_hw_info v20_hw_info = { }; static const struct bcmasp_plat_data v20_plat_data = { + .init_wol = bcmasp_init_wol_per_intf, + .enable_wol = bcmasp_enable_wol_per_intf, + .destroy_wol = bcmasp_wol_irq_destroy_per_intf, .hw_info = &v20_hw_info, }; @@ -463,6 +599,9 @@ static struct bcmasp_hw_info v21_hw_info = { }; static const struct bcmasp_plat_data v21_plat_data = { + .init_wol = bcmasp_init_wol_shared, + .enable_wol = bcmasp_enable_wol_shared, + .destroy_wol = bcmasp_wol_irq_destroy_shared, .hw_info = &v21_hw_info, }; @@ -515,11 +654,15 @@ static int bcmasp_probe(struct platform_device *pdev) priv->pdev = pdev; spin_lock_init(&priv->mda_lock); spin_lock_init(&priv->clk_lock); + mutex_init(&priv->wol_lock); pdata = device_get_match_data(&pdev->dev); if (!pdata) return dev_err_probe(dev, -EINVAL, "unable to find platform data\n"); + priv->init_wol = pdata->init_wol; + priv->enable_wol = pdata->enable_wol; + priv->destroy_wol = pdata->destroy_wol; priv->hw_info = pdata->hw_info; /* Enable all clocks to ensure successful probing */ @@ -579,6 +722,9 @@ static int bcmasp_probe(struct platform_device *pdev) i++; } + /* Check and enable WoL */ + priv->init_wol(priv); + /* Drop the clock reference count now and let ndo_open()/ndo_close() * manage it for us from now on. */ @@ -617,6 +763,8 @@ static int bcmasp_remove(struct platform_device *pdev) struct bcmasp_intf *intf; int i; + priv->destroy_wol(priv); + for (i = 0; i < priv->intf_count; i++) { intf = priv->intfs[i]; if (!intf) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.h b/drivers/net/ethernet/broadcom/asp2/bcmasp.h index 26bcf09a63df..7034418101a4 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.h +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.h @@ -299,6 +299,12 @@ struct bcmasp_intf { /* Statistics */ struct bcmasp_intf_stats64 stats64; + + u32 wolopts; + u8 sopass[SOPASS_MAX]; + /* Used if per intf wol irq */ + int wol_irq; + unsigned int wol_irq_enabled:1; }; #define NUM_MDA_FILTERS 32 @@ -321,6 +327,9 @@ struct bcmasp_hw_info { }; struct bcmasp_plat_data { + void (*init_wol)(struct bcmasp_priv *priv); + void (*enable_wol)(struct bcmasp_intf *intf, bool en); + void (*destroy_wol)(struct bcmasp_priv *priv); struct bcmasp_hw_info *hw_info; }; @@ -331,6 +340,15 @@ struct bcmasp_priv { int irq; u32 irq_mask; + /* Used if shared wol irq */ + struct mutex wol_lock; + int wol_irq; + unsigned long wol_irq_enabled_mask; + + void (*init_wol)(struct bcmasp_priv *priv); + void (*enable_wol)(struct bcmasp_intf *intf, bool en); + void (*destroy_wol)(struct bcmasp_priv *priv); + void __iomem *base; struct bcmasp_hw_info *hw_info; diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c index 394c0e1cb026..ae24a1f74d49 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c @@ -30,6 +30,40 @@ static void bcmasp_set_msglevel(struct net_device *dev, u32 level) intf->msg_enable = level; } +#define BCMASP_SUPPORTED_WAKE (WAKE_MAGIC | WAKE_MAGICSECURE) +static void bcmasp_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) +{ + struct bcmasp_intf *intf = netdev_priv(dev); + + wol->supported = BCMASP_SUPPORTED_WAKE; + wol->wolopts = intf->wolopts; + memset(wol->sopass, 0, sizeof(wol->sopass)); + + if (wol->wolopts & WAKE_MAGICSECURE) + memcpy(wol->sopass, intf->sopass, sizeof(intf->sopass)); +} + +static int bcmasp_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) +{ + struct bcmasp_intf *intf = netdev_priv(dev); + struct bcmasp_priv *priv = intf->parent; + struct device *kdev = &priv->pdev->dev; + + if (!device_can_wakeup(kdev)) + return -EOPNOTSUPP; + + /* Interface Specific */ + intf->wolopts = wol->wolopts; + if (intf->wolopts & WAKE_MAGICSECURE) + memcpy(intf->sopass, wol->sopass, sizeof(wol->sopass)); + + mutex_lock(&priv->wol_lock); + priv->enable_wol(intf, !!intf->wolopts); + mutex_unlock(&priv->wol_lock); + + return 0; +} + const struct ethtool_ops bcmasp_ethtool_ops = { .get_drvinfo = bcmasp_get_drvinfo, .get_link = ethtool_op_get_link, @@ -37,4 +71,6 @@ const struct ethtool_ops bcmasp_ethtool_ops = { .set_link_ksettings = phy_ethtool_set_link_ksettings, .get_msglevel = bcmasp_get_msglevel, .set_msglevel = bcmasp_set_msglevel, + .get_wol = bcmasp_get_wol, + .set_wol = bcmasp_set_wol, }; diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c index 9d5990663768..35b9d6390db3 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c @@ -1044,7 +1044,7 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect) netdev_err(dev, "could not attach to PHY\n"); goto err_phy_disable; } - } else { + } else if (!intf->wolopts) { ret = phy_resume(dev->phydev); if (ret) goto err_phy_disable; @@ -1301,8 +1301,39 @@ void bcmasp_interface_destroy(struct bcmasp_intf *intf, bool unregister) free_netdev(intf->ndev); } +static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf) +{ + struct net_device *ndev = intf->ndev; + u32 reg; + + reg = umac_rl(intf, UMC_MPD_CTRL); + if (intf->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) + reg |= UMC_MPD_CTRL_MPD_EN; + reg &= ~UMC_MPD_CTRL_PSW_EN; + if (intf->wolopts & WAKE_MAGICSECURE) { + /* Program the SecureOn password */ + umac_wl(intf, get_unaligned_be16(&intf->sopass[0]), + UMC_PSW_MS); + umac_wl(intf, get_unaligned_be32(&intf->sopass[2]), + UMC_PSW_LS); + reg |= UMC_MPD_CTRL_PSW_EN; + } + umac_wl(intf, reg, UMC_MPD_CTRL); + + /* UniMAC receive needs to be turned on */ + umac_enable_set(intf, UMC_CMD_RX_EN, 1); + + if (intf->parent->wol_irq > 0) { + wakeup_intr2_core_wl(intf->parent, 0xffffffff, + ASP_WAKEUP_INTR2_MASK_CLEAR); + } + + netif_dbg(intf, wol, ndev, "entered WOL mode\n"); +} + int bcmasp_interface_suspend(struct bcmasp_intf *intf) { + struct device *kdev = &intf->parent->pdev->dev; struct net_device *dev = intf->ndev; int ret = 0; @@ -1313,20 +1344,24 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf) bcmasp_netif_deinit(dev); - ret = phy_suspend(dev->phydev); - if (ret) - goto out; + if (!intf->wolopts) { + ret = phy_suspend(dev->phydev); + if (ret) + goto out; - if (intf->internal_phy) - bcmasp_ephy_enable_set(intf, false); - else - bcmasp_rgmii_mode_en_set(intf, false); + if (intf->internal_phy) + bcmasp_ephy_enable_set(intf, false); + else + bcmasp_rgmii_mode_en_set(intf, false); - /* - * If Wake-on-LAN is disabled, we can safely - * disable the network interface clocks. - */ - bcmasp_core_clock_set_intf(intf, false); + /* If Wake-on-LAN is disabled, we can safely + * disable the network interface clocks. + */ + bcmasp_core_clock_set_intf(intf, false); + } + + if (device_may_wakeup(kdev) && intf->wolopts) + bcmasp_suspend_to_wol(intf); clk_disable_unprepare(intf->parent->clk); @@ -1337,6 +1372,20 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf) return ret; } +static void bcmasp_resume_from_wol(struct bcmasp_intf *intf) +{ + u32 reg; + + reg = umac_rl(intf, UMC_MPD_CTRL); + reg &= ~UMC_MPD_CTRL_MPD_EN; + umac_wl(intf, reg, UMC_MPD_CTRL); + + if (intf->parent->wol_irq > 0) { + wakeup_intr2_core_wl(intf->parent, 0xffffffff, + ASP_WAKEUP_INTR2_MASK_SET); + } +} + int bcmasp_interface_resume(struct bcmasp_intf *intf) { struct net_device *dev = intf->ndev; @@ -1353,6 +1402,8 @@ int bcmasp_interface_resume(struct bcmasp_intf *intf) if (ret) goto out; + bcmasp_resume_from_wol(intf); + netif_device_attach(dev); return 0;