Re: [PATCH net-next 00/19] net: phy: add support for shared interrupts (part 1)

From: Heiner Kallweit
Date: Sat Oct 31 2020 - 06:18:33 EST


On 31.10.2020 00:36, Andrew Lunn wrote:
>>> - Every PHY driver gains a .handle_interrupt() implementation that, for
>>> the most part, would look like below:
>>>
>>> irq_status = phy_read(phydev, INTR_STATUS);
>>> if (irq_status < 0) {
>>> phy_error(phydev);
>>> return IRQ_NONE;
>>> }
>>>
>>> if (irq_status == 0)
>>
>> Here I have a concern, bits may be set even if the respective interrupt
>> source isn't enabled. Therefore we may falsely blame a device to have
>> triggered the interrupt. irq_status should be masked with the actually
>> enabled irq source bits.
>
> Hi Heiner
>
Hi Andrew,

> I would say that is a driver implementation detail, for each driver to
> handle how it needs to handle it. I've seen some hardware where the
> interrupt status is already masked with the interrupt enabled
> bits. I've soon other hardware where it is not.
>
Sure, I just wanted to add the comment before others simply copy and
paste this (pseudo) code. And in patch 9 (aquantia) and 18 (realtek)
it is used as is. And IIRC at least the Aquantia PHY doesn't mask
the interrupt status.

> For example code, what is listed above is O.K. The real implementation
> in a driver need knowledge of the hardware.
>
> Andrew
> .
>
Heiner