Netdev List
 help / color / mirror / Atom feed
From: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
	<netdev@vger.kernel.org>, <UNGLinuxDriver@microchip.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 2/3] net: ethernet: oa_tc6: deliver the PHY interrupt to phylib
Date: Fri, 4 Sep 2026 11:35:41 +0530	[thread overview]
Message-ID: <a01b3780-b36d-4544-a372-9daa3be20a9f@microchip.com> (raw)
In-Reply-To: <2d313e42-3fbe-4fc9-bd57-23a951d997b9@lunn.ch>

On 03/09/26 7:44 pm, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Thu, Sep 03, 2026 at 06:53:40PM +0530, Parthiban Veerasooran wrote:
>> Hi Andrew,
>>
>> On 02/09/26 6:00 am, Andrew Lunn wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>>> @@ -600,6 +642,16 @@ static int oa_tc6_phy_init(struct oa_tc6 *tc6)
>>>>                 return -ENODEV;
>>>>         }
>>>>
>>>> +     ret = oa_tc6_phy_irq_setup(tc6);
>>>> +     if (ret) {
>>>> +             oa_tc6_mdiobus_unregister(tc6);
>>>> +             return ret;
>>>> +     }
>>>> +
>>>> +     /* Deliver the PHY interrupt through the nested virtual IRQ. Set before
>>>> +      * phy_connect_direct() so phylib enters interrupt mode.
>>>> +      */
>>>> +     tc6->phydev->irq = tc6->phy_virq;
>>>
>>> I don't know how messy it will be, but it is better to set
>>> mii_bus->irq[] to the interrupt number. phy_device_create() will then
>>> copy it into phydev->irq.
> 
>> Thanks for the suggestion. To use mii_bus->irq[] so that phy_device_create()
>> picks it up, we would need to set mii_bus->irq[addr] with created virtual
>> irq number before mdiobus_register(). However, the PHY MDIO address is not
>> known until phy_find_first() returns, so we cannot pre-populate
>> mii_bus->irq[addr] before the bus scan runs.
> 
> This is why i made the comment, i did not know how messy it would be.
> 
> Where it becomes interesting is the recent patch:
> 
> https://patchwork.kernel.org/project/netdevbpf/patch/20260902080511.2211261-3-f@lex.la/
> 
> It just seems a bit brittle, phydev->irq says one thing, mii_bus->irq[]
> says something else.
> 
> Maybe set all member of mii_bus->irq[]?
Thanks for pointing to that patch. Now the concern is clear: 
mdiobus_alloc() initialises all bus->irq[] entries to PHY_POLL, so if 
phydev->irq is set directly without updating mii_bus->irq[], 
phy_restore_genphy_irq() would restore phydev->irq back to PHY_POLL if 
the generic driver ever binds.

So the fix would be to move oa_tc6_phy_irq_setup() before 
mdiobus_register(), populate all mii_bus->irq[] entries with the virtual 
IRQ, and drop the direct phydev->irq assignment. phy_device_create() 
then copies the correct value from bus->irq[addr] during the bus scan, 
keeping both tables consistent.

+     /* Populate all irq[] entries before registration so
+      * phy_device_create() picks up the virtual IRQ regardless of
+      * the PHY's MDIO address.
+      */
+     for (i = 0; i < PHY_MAX_ADDR; i++)
+             tc6->mdiobus->irq[i] = tc6->phy_virq;

       ret = mdiobus_register(tc6->mdiobus);
       if (ret) {
               netdev_err(tc6->netdev, "Could not register MDIO bus\n");
               mdiobus_free(tc6->mdiobus);
               return ret;
       }

Hope this is what expected?

Best regards,
Parthiban V
> 
>        Andrew


  reply	other threads:[~2026-09-04  6:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 13:09 [PATCH net-next 0/3] net: microchip_t1s: fix collision detection on PLCA status change Parthiban Veerasooran
2026-09-01 13:09 ` [PATCH net-next 1/3] net: phy: " Parthiban Veerasooran
2026-09-01 13:09 ` [PATCH net-next 2/3] net: ethernet: oa_tc6: deliver the PHY interrupt to phylib Parthiban Veerasooran
2026-09-02  0:30   ` Andrew Lunn
2026-09-03 13:23     ` Parthiban Veerasooran
2026-09-03 14:14       ` Andrew Lunn
2026-09-04  6:05         ` Parthiban Veerasooran [this message]
2026-09-04 13:07           ` Andrew Lunn
2026-09-02  0:43   ` Andrew Lunn
2026-09-03 13:02     ` Parthiban Veerasooran
2026-09-03 13:54       ` Andrew Lunn
2026-09-04  6:02         ` Parthiban Veerasooran
2026-09-01 13:09 ` [PATCH net-next 3/3] net: phy: microchip_t1s: fix collision detection for LAN867X Rev.D0 Parthiban Veerasooran

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=a01b3780-b36d-4544-a372-9daa3be20a9f@microchip.com \
    --to=parthiban.veerasooran@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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