Subject: Re: [PATCH] net: phy: realtek: clear interrupt during init for rtl8211f

From: Heiner Kallweit <[email-masked]>
Date: Thu, 14 May 2020 21:50:53 +0200

On 14.05.2020 08:25, Jisheng Zhang wrote:
> On Wed, 13 May 2020 20:45:13 +0200 Heiner Kallweit wrote:
> 
>>
>> On 13.05.2020 08:51, Jisheng Zhang wrote:
>>> Hi,
>>>
>>> On Tue, 12 May 2020 20:43:40 +0200 Heiner Kallweit wrote:
>>>  
>>>>
>>>>
>>>> On 12.05.2020 12:46, Jisheng Zhang wrote:  
>>>>> The PHY Register Accessible Interrupt is enabled by default, so
>>>>> there's such an interrupt during init. In PHY POLL mode case, the
>>>>> INTB/PMEB pin is alway active, it is not good. Clear the interrupt by
>>>>> calling rtl8211f_ack_interrupt().  
>>>>
>>>> As you say "it's not good" w/o elaborating a little bit more on it:
>>>> Do you face any actual issue? Or do you just think that it's not nice?  
>>>
>>>
>>> The INTB/PMEB pin can be used in two different modes:
>>> INTB: used for interrupt
>>> PMEB: special mode for Wake-on-LAN
>>>
>>> The PHY Register Accessible Interrupt is enabled by
>>> default, there's always such an interrupt during the init. In PHY POLL mode
>>> case, the pin is always active. If platforms plans to use the INTB/PMEB pin
>>> as WOL, then the platform will see WOL active. It's not good.
>>>  
>> The platform should listen to this pin only once WOL has been configured and
>> the pin has been switched to PMEB function. For the latter you first would
>> have to implement the set_wol callback in the PHY driver.
>> Or where in which code do you plan to switch the pin function to PMEB?
> 
> I think it's better to switch the pin function in set_wol callback. But this
> is another story. No matter WOL has been configured or not, keeping the
> INTB/PMEB pin active is not good. what do you think?
> 

It shouldn't hurt (at least it didn't hurt for the last years), because no
listener should listen to the pin w/o having it configured before.
So better extend the PHY driver first (set_wol, ..), and then do the follow-up
platform changes (e.g. DT config of a connected GPIO).

>> One more thing to consider when implementing set_wol would be that the PHY
>> supports two WOL options:
>> 1. INT/PMEB configured as PMEB
>> 2. INT/PMEB configured as INT and WOL interrupt source active
>>
>>>  
>>>> I'm asking because you don't provide a Fixes tag and you don't
>>>> annotate your patch as net or net-next.  
>>>
>>> should be Fixes: 3447cf2e9a11 ("net/phy: Add support for Realtek RTL8211F")
>>>  
>>>> Once you provide more details we would also get an idea whether a
>>>> change would have to be made to phylib, because what you describe
>>>> doesn't seem to be specific to this one PHY model.  
>>>
>>> Nope, we don't need this change in phylib, this is specific to rtl8211f
>>>
>>> Thanks,
>>> Jisheng
>>>  
>> Heiner
>