Re: Aquantia PHY in OCSGMII mode?

Alexander Wilhelm
2025-10-08T13:28:32Z

On Wed, Oct 08, 2025 at 02:10:59PM +0300, Vladimir Oltean wrote:
[...]
> For that, please break the link again, by making the following changes on top:
>
> 1. Configure IF_MODE=3 (SGMII autoneg format) for 2500base-x:
>
> diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c
> index a88cbe67cc9d..ea42b8d813f3 100644
> --- a/drivers/net/pcs/pcs-lynx.c
> +++ b/drivers/net/pcs/pcs-lynx.c
> @@ -152,11 +152,10 @@ static int lynx_pcs_config_giga(struct mdio_device *pcs,
> mdiodev_write(pcs, LINK_TIMER_HI, link_timer >> 16);
> }
>
> - if (interface == PHY_INTERFACE_MODE_1000BASEX ||
> - interface == PHY_INTERFACE_MODE_2500BASEX) {
> + if (interface == PHY_INTERFACE_MODE_1000BASEX) {
> if_mode = 0;
> } else {
> - /* SGMII and QSGMII */
> + /* SGMII, QSGMII and (incorrectly) 2500base-x */
> if_mode = IF_MODE_SGMII_EN;
> if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
> if_mode |= IF_MODE_USE_SGMII_AN;
>
> 2. Edit your MAC OF node in the device tree and add:
>
> &mac {
> managed = "in-band-status"; // this
> phy-mode = "2500base-x";
> };
>
> This will reliably cause the same behaviour as before, but with no dependency on U-Boot.

I have the broken 100M link state again (IF_MODE=3). Below are the debug
details I was able to observe:

* With 2.5G link:

mdio_bus 0x0000000ffe4e5000:00: BMSR 0x2d, BMCR 0x1140, ADV 0x41a0, LPA 0xdc01, IF_MODE 0x3

* With 1G link:

mdio_bus 0x0000000ffe4e5000:00: BMSR 0x2d, BMCR 0x1140, ADV 0x41a0, LPA 0xd801, IF_MODE 0x3

* With 100M link:

mdio_bus 0x0000000ffe4e5000:00: BMSR 0x2d, BMCR 0x1140, ADV 0x41a0, LPA 0xd401, IF_MODE 0x3

[...]
> Regarding my patch vs yours, my thoughts on this topic are: the bug is
> old, the PCS driver never worked if the registers were not as expected
> (this is not a regression), and your patch is incomplete if MII_BMCR
> also contains significant differences. I would recommend submitting
> mine, as a new feature to net-next, when it reopens for patches for 6.19.
> I've credited you with Co-developed-by due to the significance of your
> findings. Thanks.

Sure, thank you.

Best regards
Alexander Wilhelm