Re: [PATCH net-next v3 03/13] ax88179_178a: Use MMD accessor functions for AX88179A

Birger Koblitz <[email protected]> Fri, 31 Jul 2026 18:10:12 +0200
Newsgroups org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
On 24/07/2026 18:44, Andrew Lunn wrote:
> On Fri, Jul 24, 2026 at 09:36:46AM +0200, Birger Koblitz wrote:
>> The AX88179A uses a much simpler Clause-45 MMD access interface,
>> which are made available through ax_read_mmd() and ax_write_mmd(),
>> which in turn call the chips' respective implementation.
>>
>> Make use of these functions for stract MMD read/write operations.
>>
>> Signed-off-by: Birger Koblitz <[email protected]>
>> ---
>>   drivers/net/usb/ax88179_178a.c | 39 +++++++++++----------------------------
>>   1 file changed, 11 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
>> index b90a75a11024c58192bdb4a9436636bc9312148c..b7837c7a89f9b5ee520ef1ae91bbc7619d1a12bd 100644
>> --- a/drivers/net/usb/ax88179_178a.c
>> +++ b/drivers/net/usb/ax88179_178a.c
>> @@ -985,22 +985,19 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_keee *data)
>>   	int val;
>>   
>>   	/* Get Supported EEE */
>> -	val = ax88179_phy_read_mmd_indirect(dev, MDIO_PCS_EEE_ABLE,
>> -					    MDIO_MMD_PCS);
>> +	val = ax_read_mmd(dev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE);
> 
> All these look to be standard EEE registers. phylib should be handling
> this for you. Put a printk in genphy_c45_read_eee_cap1() and make sure
> it is being called.
> 
> Basically, anything which is part of 802.3 clause 22 or clause 45
> should have helpers in phylib, and in most cases, phylib itself will
> take care of it. A MAC driver touching the PHY is generally a bad
> design, a layer violation. So any driver using phylink or phylib, all
> direct access to the PHY needs to be removed.
> 
Fixed in v4 by directly using phy_ethtool_get_link_ksettings
and phy_ethtool_set_link_ksettings

Birger