Commit 3424b700 authored by David S. Miller's avatar David S. Miller

Merge branch 'dsa-systemport-WoL'

Florian Fainelli says:

====================
net: dsa and systemport WoL changes

This patch series extracts what was previously submitted as part of the
"WAKE_FILTER" Wake-on-LAN patch series into patches that do not.

Changes in this series:

- properly align the dsa_is_cpu_port() check in first patch
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 723a0043 54226116
...@@ -166,6 +166,11 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, ...@@ -166,6 +166,11 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
reg &= ~P_TXQ_PSM_VDD(port); reg &= ~P_TXQ_PSM_VDD(port);
core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL); core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);
/* Enable learning */
reg = core_readl(priv, CORE_DIS_LEARN);
reg &= ~BIT(port);
core_writel(priv, reg, CORE_DIS_LEARN);
/* Enable Broadcom tags for that port if requested */ /* Enable Broadcom tags for that port if requested */
if (priv->brcm_tag_mask & BIT(port)) if (priv->brcm_tag_mask & BIT(port))
b53_brcm_hdr_setup(ds, port); b53_brcm_hdr_setup(ds, port);
...@@ -222,8 +227,13 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port, ...@@ -222,8 +227,13 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
u32 reg; u32 reg;
if (priv->wol_ports_mask & (1 << port)) /* Disable learning while in WoL mode */
if (priv->wol_ports_mask & (1 << port)) {
reg = core_readl(priv, CORE_DIS_LEARN);
reg |= BIT(port);
core_writel(priv, reg, CORE_DIS_LEARN);
return; return;
}
if (port == priv->moca_port) if (port == priv->moca_port)
bcm_sf2_port_intr_disable(priv, port); bcm_sf2_port_intr_disable(priv, port);
......
...@@ -755,7 +755,8 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, ...@@ -755,7 +755,8 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES; port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES;
if (fs->ring_cookie == RX_CLS_FLOW_DISC || if (fs->ring_cookie == RX_CLS_FLOW_DISC ||
!dsa_is_user_port(ds, port_num) || !(dsa_is_user_port(ds, port_num) ||
dsa_is_cpu_port(ds, port_num)) ||
port_num >= priv->hw_params.num_ports) port_num >= priv->hw_params.num_ports)
return -EINVAL; return -EINVAL;
/* /*
......
...@@ -168,6 +168,8 @@ enum bcm_sf2_reg_offs { ...@@ -168,6 +168,8 @@ enum bcm_sf2_reg_offs {
#define CORE_SWITCH_CTRL 0x00088 #define CORE_SWITCH_CTRL 0x00088
#define MII_DUMB_FWDG_EN (1 << 6) #define MII_DUMB_FWDG_EN (1 << 6)
#define CORE_DIS_LEARN 0x000f0
#define CORE_SFT_LRN_CTRL 0x000f8 #define CORE_SFT_LRN_CTRL 0x000f8
#define SW_LEARN_CNTL(x) (1 << (x)) #define SW_LEARN_CNTL(x) (1 << (x))
......
...@@ -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");
} }
...@@ -1102,10 +1110,8 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id) ...@@ -1102,10 +1110,8 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id)
if (priv->irq0_stat & INTRL2_0_TX_RING_FULL) if (priv->irq0_stat & INTRL2_0_TX_RING_FULL)
bcm_sysport_tx_reclaim_all(priv); bcm_sysport_tx_reclaim_all(priv);
if (priv->irq0_stat & INTRL2_0_MPD) { if (priv->irq0_stat & INTRL2_0_MPD)
netdev_info(priv->netdev, "Wake-on-LAN interrupt!\n"); netdev_info(priv->netdev, "Wake-on-LAN interrupt!\n");
bcm_sysport_resume_from_wol(priv);
}
if (!priv->is_lite) if (!priv->is_lite)
goto out; goto out;
...@@ -2449,9 +2455,7 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) ...@@ -2449,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