Skip to contentSkip to conversation

bcm63xx_enet: fix internal phy IRQ assignment

PATCH Superseded Daniel González Cabanelas 2 participants 2 messages Feb 24, 2021 – Feb 25, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcm63xx_enet: fix internal phy IRQ assignment

The current bcm63xx_enet driver doesn't asign the internal phy IRQ. As a result of this it works in polling mode.

Fix it using the phy_device structure to assign the platform IRQ.

Tested under a BCM6348 board. Kernel dmesg before the patch:
Broadcom BCM63XX (1) bcm63xx_enet-0:01: attached PHY driver [Broadcom

              BCM63XX (1)] (mii_bus:phy_addr=bcm63xx_enet-0:01, irq=POLL)

After the patch:
Broadcom BCM63XX (1) bcm63xx_enet-0:01: attached PHY driver [Broadcom

              BCM63XX (1)] (mii_bus:phy_addr=bcm63xx_enet-0:01, irq=17)

Pluging and uplugging the ethernet cable now generates interrupts and the PHY goes up and down as expected.

---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/ethernet/broadcom/bcm63xx_enet.c +7 -0
index fd876721316..0dad527abb9 100644
@@ -1819,7 +1819,14 @@ static int bcm_enet_probe(struct platform_device *pdev)
 		bus->phy_mask = ~(1 << priv->phy_id);
 
 		if (priv->has_phy_interrupt)
+			phydev = mdiobus_get_phy(bus, priv->phy_id);
+			if (!phydev) {
+				dev_err(&dev->dev, "no PHY found\n");
+				goto out_unregister_mdio;
+			}
+
 			bus->irq[priv->phy_id] = priv->phy_interrupt;
+			phydev->irq = priv->phy_interrupt;
 
 		ret = mdiobus_register(bus);
 		if (ret) {
Signature · 1 line
2.30.1
#1 lore raw
Quoted 27 lines · Daniel González Cabanelas

The current bcm63xx_enet driver doesn't asign the internal phy IRQ. As a result of this it works in polling mode.

Fix it using the phy_device structure to assign the platform IRQ.

Tested under a BCM6348 board. Kernel dmesg before the patch:
Broadcom BCM63XX (1) bcm63xx_enet-0:01: attached PHY driver [Broadcom

              BCM63XX (1)] (mii_bus:phy_addr=bcm63xx_enet-0:01, irq=POLL)

After the patch:
Broadcom BCM63XX (1) bcm63xx_enet-0:01: attached PHY driver [Broadcom

              BCM63XX (1)] (mii_bus:phy_addr=bcm63xx_enet-0:01, irq=17)

Pluging and uplugging the ethernet cable now generates interrupts and the PHY goes up and down as expected.

---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/ethernet/broadcom/bcm63xx_enet.c +0 -0
index fd876721316..0dad527abb9 100644
@@ -1819,7 +1819,14 @@ static int bcm_enet_probe(struct platform_device *pdev)
 		bus->phy_mask = ~(1 << priv->phy_id);

drivers/net/ethernet/broadcom/bcm63xx_enet.c static int bcm_enet_probe(struct platform_device *pdev) · line 1829

Quoted 10 lines
drivers/net/ethernet/broadcom/bcm63xx_enet.c +7 -0
 
 		if (priv->has_phy_interrupt)
+			phydev = mdiobus_get_phy(bus, priv->phy_id);
+			if (!phydev) {
+				dev_err(&dev->dev, "no PHY found\n");
+				goto out_unregister_mdio;
+			}
+
 			bus->irq[priv->phy_id] = priv->phy_interrupt;
+			phydev->irq = priv->phy_interrupt;

Hi Daniel

You should not need both bus->irq[priv->phy_id] and phydev->irq. When then MDIO bus is registered and then probed, and the PHY found, phydev->irq is set to bus->irq[priv->phy_id]. Assuming this did actually work once, has there been a change in the order during probe? You might just need to place the existing assignment earlier.

Andrew