Skip to content

Commit cc7f105

Browse files
Ryceancurrydavem330
authored andcommitted
net: bcmasp: Add support for PHY interrupts
Hook up the phy interrupts for internal phys to reduce mdio traffic and improve responsiveness of link changes. Signed-off-by: Justin Chen <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4688f4f commit cc7f105

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

drivers/net/ethernet/broadcom/asp2/bcmasp.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ static void _intr2_mask_set(struct bcmasp_priv *priv, u32 mask)
3131
priv->irq_mask |= mask;
3232
}
3333

34+
void bcmasp_enable_phy_irq(struct bcmasp_intf *intf, int en)
35+
{
36+
struct bcmasp_priv *priv = intf->parent;
37+
38+
/* Only supported with internal phys */
39+
if (!intf->internal_phy)
40+
return;
41+
42+
if (en)
43+
_intr2_mask_clear(priv, ASP_INTR2_PHY_EVENT(intf->channel));
44+
else
45+
_intr2_mask_set(priv, ASP_INTR2_PHY_EVENT(intf->channel));
46+
}
47+
3448
void bcmasp_enable_tx_irq(struct bcmasp_intf *intf, int en)
3549
{
3650
struct bcmasp_priv *priv = intf->parent;
@@ -79,6 +93,9 @@ static void bcmasp_intr2_handling(struct bcmasp_intf *intf, u32 status)
7993
__napi_schedule_irqoff(&intf->tx_napi);
8094
}
8195
}
96+
97+
if (status & ASP_INTR2_PHY_EVENT(intf->channel))
98+
phy_mac_interrupt(intf->ndev->phydev);
8299
}
83100

84101
static irqreturn_t bcmasp_isr(int irq, void *data)

drivers/net/ethernet/broadcom/asp2/bcmasp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#define ASP_INTR2_TX_DESC(intr) BIT((intr) + 14)
2020
#define ASP_INTR2_UMC0_WAKE BIT(22)
2121
#define ASP_INTR2_UMC1_WAKE BIT(28)
22+
#define ASP_INTR2_PHY_EVENT(intr) ((intr) ? BIT(30) | BIT(31) : \
23+
BIT(24) | BIT(25))
2224

2325
#define ASP_WAKEUP_INTR2_OFFSET 0x1200
2426
#define ASP_WAKEUP_INTR2_STATUS 0x0
@@ -556,6 +558,8 @@ void bcmasp_enable_tx_irq(struct bcmasp_intf *intf, int en);
556558

557559
void bcmasp_enable_rx_irq(struct bcmasp_intf *intf, int en);
558560

561+
void bcmasp_enable_phy_irq(struct bcmasp_intf *intf, int en);
562+
559563
void bcmasp_flush_rx_port(struct bcmasp_intf *intf);
560564

561565
extern const struct ethtool_ops bcmasp_ethtool_ops;

drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ static void bcmasp_netif_start(struct net_device *dev)
382382

383383
bcmasp_enable_rx_irq(intf, 1);
384384
bcmasp_enable_tx_irq(intf, 1);
385+
bcmasp_enable_phy_irq(intf, 1);
385386

386387
phy_start(dev->phydev);
387388
}
@@ -890,6 +891,7 @@ static void bcmasp_netif_deinit(struct net_device *dev)
890891
/* Disable interrupts */
891892
bcmasp_enable_tx_irq(intf, 0);
892893
bcmasp_enable_rx_irq(intf, 0);
894+
bcmasp_enable_phy_irq(intf, 0);
893895

894896
netif_napi_del(&intf->tx_napi);
895897
netif_napi_del(&intf->rx_napi);
@@ -1028,6 +1030,9 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
10281030
goto err_phy_disable;
10291031
}
10301032

1033+
if (intf->internal_phy)
1034+
dev->phydev->irq = PHY_MAC_INTERRUPT;
1035+
10311036
/* Indicate that the MAC is responsible for PHY PM */
10321037
phydev->mac_managed_pm = true;
10331038
} else if (!intf->wolopts) {

0 commit comments

Comments
 (0)