diff mbox series

bcm63xx_enet: fix internal phy IRQ assignment

Message ID 2270332.afWbCi5vXM@tool (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series bcm63xx_enet: fix internal phy IRQ assignment | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 5 maintainers not CCed: liew.s.piaw@gmail.com bcm-kernel-feedback-list@broadcom.com leon@kernel.org linux-arm-kernel@lists.infradead.org tangbin@cmss.chinamobile.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: 'asign' may be misspelled - perhaps 'assign'?
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Daniel González Cabanelas Feb. 24, 2021, 2:56 p.m. UTC
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(+)

Comments

Andrew Lunn Feb. 25, 2021, 1:48 p.m. UTC | #1
On Wed, Feb 24, 2021 at 03:56:08PM +0100, Daniel González Cabanelas wrote:
> 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;

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
diff mbox series

Patch

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) {