mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Birger Koblitz <mail@birger-koblitz.de>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 13/13] ax88796b: Add support for AX88772D, AX88179A and AX88279
Date: Fri, 31 Jul 2026 18:40:03 +0200	[thread overview]
Message-ID: <251845b9-e477-4d00-b162-097b92c583a2@lunn.ch> (raw)
In-Reply-To: <7d40cce5-6f82-4c40-8c94-ee674b5d0cfa@birger-koblitz.de>

On Fri, Jul 31, 2026 at 06:14:50PM +0200, Birger Koblitz wrote:
> On 24/07/2026 19:18, Andrew Lunn wrote:
> > > +static int asix_ax88279_read_status(struct phy_device *phydev)
> > > +{
> > 
> > > +	val = phy_read(phydev, MII_ADVERTISE);
> > > +	if (val < 0)
> > > +		return val;
> > > +
> > > +	linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
> > > +			 phydev->advertising, val & AX_ADVERTISE_2500);
> > 
> > This looks wrong. A PHY driver should configure the hardware to
> > advertise what is in phydev->advertising. The PHY driver itself should
> > never change this value, especially in _read_status(). It is up to
> > user space to decide on what is advertised, and the phylib core will
> > sanitise the value to ensure it is within the PHYs capabilities.
> > 
> This looks wrong, because the PHY uses the wrong bit for configuring
> advertising 2500_FD. Since phylink does not know about this behaviour
> the PHY driver needs to decipher this additional bit and then set it
> in advertising based on the value in the PHY register. But maybe
> I miss something?

We have two bitmaps.

phydev->supported lists all the modes the device supports. Generally,
that is filled out during probe, when genphy_read_abilities() or
genphy_c45_pma_read_abilities() is called, which looks at register
values which indicate what the PHY actually supports. If those
registers are wrong, because it breaks the standard, you can provide a
.get_features() callback in the PHY driver. That typically calls
genphy_read_abilities() and/or genphy_c45_pma_read_abilities(), and
them fixes up what they have discovered to fit what the device really
does.

phylink will also mask phydev->supported with what the MAC actually
supports. So the PHY might indicate it supported 1G Half, but the MAC
does not, and so it will be removed.

phydev->supported is then copied into phydev->advertised. The user can
modify phydev->advertised, but phydev->supported is fixed.

When the link is configured up, the .config_aneg() driver method is
called. It needs to push the bits in phydev->advertised into the
hardware, so it actually advertises those link modes.

If the hardware is broken and puts the bits in the wrong place, you
cannot use the helper. So the drive needs to do the interpretation and
write the correct bits in the registers. Depending on how it is
broken, you might be able to call genphy_config_aneg() to do
10/100/1G, and then do 2.5G manually in the driver.

The PHY driver should consider phydev->advertised read only.

	Andrew

  reply	other threads:[~2026-07-31 16:40 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  7:36 [PATCH net-next v3 00/13] ax88179_178a: Add support for AX88179A-based chips Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 01/13] ax88179_178a: Fix endianness of pause watermark register Birger Koblitz
2026-07-24 13:22   ` Andrew Lunn
2026-07-24  7:36 ` [PATCH net-next v3 02/13] ax88179_178a: Add HW support for AX179A-based chips Birger Koblitz
2026-07-24 16:22   ` Andrew Lunn
2026-07-31 16:06     ` Birger Koblitz
2026-07-24 16:37   ` Andrew Lunn
2026-07-31 16:09     ` Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 03/13] ax88179_178a: Use MMD accessor functions for AX88179A Birger Koblitz
2026-07-24 13:25   ` Andrew Lunn
2026-07-24 16:44   ` Andrew Lunn
2026-07-24 17:07     ` Birger Koblitz
2026-07-24 17:27       ` Andrew Lunn
2026-07-31 16:10     ` Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 04/13] ax88179_178a: Add EEE HW configuration support " Birger Koblitz
2026-07-24 13:32   ` Andrew Lunn
2026-07-24  7:36 ` [PATCH net-next v3 05/13] ax88179_178a: Use phylink in get/set_link_ksettings Birger Koblitz
2026-07-24 13:38   ` Andrew Lunn
2026-07-24 15:06     ` Birger Koblitz
2026-07-24 15:35       ` Andrew Lunn
2026-07-24 15:53         ` Birger Koblitz
2026-07-24 16:25           ` Andrew Lunn
2026-07-24 17:02             ` Birger Koblitz
2026-07-24 18:22               ` Andrew Lunn
2026-07-25  3:59                 ` Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 06/13] ax88179_178a: EEE setup for AX88179A-based chips Birger Koblitz
2026-07-24 16:31   ` Andrew Lunn
2026-07-31 16:08     ` Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 07/13] ax88179_178a: Obtain speed and duplex from Interrupt URB Birger Koblitz
2026-07-24 17:01   ` Andrew Lunn
2026-07-31 16:12     ` Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 08/13] ax88179_178a: Add support for ethtool pause parameter configuration Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 09/13] ax88179_178a: Add VLAN offload support for AX88179A Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 10/13] ax88179_178a: Add ethtool get_drvinfo Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 11/13] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 12/13] ax88179_178a: Add AX179A/AX279 multicast configuration Birger Koblitz
2026-07-24  7:36 ` [PATCH net-next v3 13/13] ax88796b: Add support for AX88772D, AX88179A and AX88279 Birger Koblitz
2026-07-24 13:51   ` Andrew Lunn
2026-07-24 17:18   ` Andrew Lunn
2026-07-31 16:14     ` Birger Koblitz
2026-07-31 16:40       ` Andrew Lunn [this message]
2026-07-31 17:39         ` Birger Koblitz

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=251845b9-e477-4d00-b162-097b92c583a2@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@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-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mail@birger-koblitz.de \
    --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

all inboxes | Powered by JetHome®