netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel González Cabanelas" <dgcbueu@gmail.com>
To: davem@davemloft.net
Cc: kuba@kernel.org, f.fainelli@gmail.com,
	gregkh@linuxfoundation.org, netdev@vger.kernel.org,
	noltari@gmail.com
Subject: [PATCH] bcm63xx_enet: fix internal phy IRQ assignment
Date: Wed, 24 Feb 2021 15:56:08 +0100	[thread overview]
Message-ID: <2270332.afWbCi5vXM@tool> (raw)

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.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index fd876721316..0dad527abb9 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -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) {
-- 
2.30.1





             reply	other threads:[~2021-02-24 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 14:56 Daniel González Cabanelas [this message]
2021-02-25 13:48 ` [PATCH] bcm63xx_enet: fix internal phy IRQ assignment Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2270332.afWbCi5vXM@tool \
    --to=dgcbueu@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=noltari@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).