Commit 54226116 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: systemport: Create helper to set MPD

Create a helper function to turn on/off MPD, this will be used to avoid
duplicating code as we are going to add additional types of wake-up
types.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e85e227
...@@ -1041,17 +1041,25 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget) ...@@ -1041,17 +1041,25 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget)
return work_done; return work_done;
} }
static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv) static void mpd_enable_set(struct bcm_sysport_priv *priv, bool enable)
{ {
u32 reg; u32 reg;
reg = umac_readl(priv, UMAC_MPD_CTRL);
if (enable)
reg |= MPD_EN;
else
reg &= ~MPD_EN;
umac_writel(priv, reg, UMAC_MPD_CTRL);
}
static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv)
{
/* Stop monitoring MPD interrupt */ /* Stop monitoring MPD interrupt */
intrl2_0_mask_set(priv, INTRL2_0_MPD); intrl2_0_mask_set(priv, INTRL2_0_MPD);
/* Clear the MagicPacket detection logic */ /* Clear the MagicPacket detection logic */
reg = umac_readl(priv, UMAC_MPD_CTRL); mpd_enable_set(priv, false);
reg &= ~MPD_EN;
umac_writel(priv, reg, UMAC_MPD_CTRL);
netif_dbg(priv, wol, priv->netdev, "resumed from WOL\n"); netif_dbg(priv, wol, priv->netdev, "resumed from WOL\n");
} }
...@@ -2447,9 +2455,7 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) ...@@ -2447,9 +2455,7 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
/* Do not leave the UniMAC RBUF matching only MPD packets */ /* Do not leave the UniMAC RBUF matching only MPD packets */
if (!timeout) { if (!timeout) {
reg = umac_readl(priv, UMAC_MPD_CTRL); mpd_enable_set(priv, false);
reg &= ~MPD_EN;
umac_writel(priv, reg, UMAC_MPD_CTRL);
netif_err(priv, wol, ndev, "failed to enter WOL mode\n"); netif_err(priv, wol, ndev, "failed to enter WOL mode\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment