提交 8562056f 编写于 作者: F Florian Fainelli 提交者: David S. Miller

net: bcmgenet: request Wake-on-LAN interrupt

Attempt to the request the Wake-on-LAN interrupt bit, and if successful,
advertise wakeup capability instead of doing this unconditionnally.
Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b6e978e5
...@@ -1918,6 +1918,15 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) ...@@ -1918,6 +1918,15 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t bcmgenet_wol_isr(int irq, void *dev_id)
{
struct bcmgenet_priv *priv = dev_id;
pm_wakeup_event(&priv->pdev->dev, 0);
return IRQ_HANDLED;
}
static void bcmgenet_umac_reset(struct bcmgenet_priv *priv) static void bcmgenet_umac_reset(struct bcmgenet_priv *priv)
{ {
u32 reg; u32 reg;
...@@ -2046,8 +2055,6 @@ static int bcmgenet_open(struct net_device *dev) ...@@ -2046,8 +2055,6 @@ static int bcmgenet_open(struct net_device *dev)
bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
} }
device_set_wakeup_capable(&dev->dev, 1);
/* Disable RX/TX DMA and flush TX queues */ /* Disable RX/TX DMA and flush TX queues */
dma_ctrl = bcmgenet_dma_disable(priv); dma_ctrl = bcmgenet_dma_disable(priv);
...@@ -2473,6 +2480,7 @@ static int bcmgenet_probe(struct platform_device *pdev) ...@@ -2473,6 +2480,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
priv = netdev_priv(dev); priv = netdev_priv(dev);
priv->irq0 = platform_get_irq(pdev, 0); priv->irq0 = platform_get_irq(pdev, 0);
priv->irq1 = platform_get_irq(pdev, 1); priv->irq1 = platform_get_irq(pdev, 1);
priv->wol_irq = platform_get_irq(pdev, 2);
if (!priv->irq0 || !priv->irq1) { if (!priv->irq0 || !priv->irq1) {
dev_err(&pdev->dev, "can't find IRQs\n"); dev_err(&pdev->dev, "can't find IRQs\n");
err = -EINVAL; err = -EINVAL;
...@@ -2507,6 +2515,13 @@ static int bcmgenet_probe(struct platform_device *pdev) ...@@ -2507,6 +2515,13 @@ static int bcmgenet_probe(struct platform_device *pdev)
dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM;
/* Request the WOL interrupt and advertise suspend if available */
priv->wol_irq_disabled = true;
err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0,
dev->name, priv);
if (!err)
device_set_wakeup_capable(&pdev->dev, 1);
/* Set the needed headroom to account for any possible /* Set the needed headroom to account for any possible
* features enabling/disabling at runtime * features enabling/disabling at runtime
*/ */
......
...@@ -569,6 +569,8 @@ struct bcmgenet_priv { ...@@ -569,6 +569,8 @@ struct bcmgenet_priv {
int irq1; int irq1;
unsigned int irq0_stat; unsigned int irq0_stat;
unsigned int irq1_stat; unsigned int irq1_stat;
int wol_irq;
bool wol_irq_disabled;
/* HW descriptors/checksum variables */ /* HW descriptors/checksum variables */
bool desc_64b_en; bool desc_64b_en;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册