Re: [PATCH net-next v5 13/13] ax88796b: Add support for AX88772D, AX88179A and AX88279
Birger Koblitz <[email protected]> Thu, 6 Aug 2026 21:35:49 +0200
| Newsgroups | org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
On 02/08/2026 23:55, Andrew Lunn wrote:
>> +static int asix_ax88279_read_status(struct phy_device *phydev)
>> +{
>> + int ret, val;
>> +
>> + ret = genphy_update_link(phydev);
>> + if (ret)
>> + return ret;
>> +
>> + phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED;
>> + phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED;
>> + phydev->speed = SPEED_UNKNOWN;
>> + phydev->duplex = DUPLEX_UNKNOWN;
>> + phydev->pause = 0;
>> + phydev->asym_pause = 0;
>> + phydev->rate_matching = RATE_MATCH_PAUSE;
>> +
>> + if (!phydev->link)
>> + return 0;
>> +
>> + ret = genphy_read_master_slave(phydev);
>> + if (ret < 0)
>> + return ret;
>> +
>> + ret = genphy_read_lpa(phydev);
>> + if (ret < 0)
>> + return ret;
>
> This looks pretty similar to genphy_read_status(). Can you call that
> here? And then the rest of the code here can deal with higher speeds.
Changed in v5.
>
>> + /* Read actual speed from vendor register */
>> + val = phy_read(phydev, AX_CTRL_STATUS);
>> + switch (val & AX_CTRL_STATUS_SPEED_MASK) {
>> + case AX_CTRL_STATUS_SPEED_2500:
>> + phydev->speed = SPEED_2500;
>> + break;
>> + case AX_CTRL_STATUS_SPEED_1000:
>> + phydev->speed = SPEED_1000;
>> + break;
>> + case AX_CTRL_STATUS_SPEED_100:
>> + phydev->speed = SPEED_100;
>> + break;
>> + case AX_CTRL_STATUS_SPEED_10:
>> + phydev->speed = SPEED_10;
>> + }
>> +
>> + /* MDIO_AN_10GBT_STAT_LP2_5G is broken, but we can deduce that
>> + * the link-partner advertised 2500M if remotely AN succceded
>> + * for link speed > 1000M and we locally have a link speed of
>> + * 2500M
>> + */
>> + val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_10GBT_STAT);
>> + if (val >= 0 && val & MDIO_AN_10GBT_STAT_REMOK) {
>> + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
>> + phydev->lp_advertising,
>> + phydev->speed == SPEED_2500);
>> + }
>> + /* Only supports full duplex */
>> + phydev->duplex = DUPLEX_FULL;
>> +
>> + return 0;
>> +}
>> +
>> +static int asix_ax88279_config_aneg(struct phy_device *phydev)
>> +{
>> + bool adv_2500;
>> + int ret;
>> +
>> + if (phydev->autoneg == AUTONEG_DISABLE) {
>> + phydev_warn(phydev, "Disabling autoneg is not supported\n");
>> + return -EINVAL;
>> + }
>
> Why is that? Now that phylink is driving the PHY, and reporting
> speeds, duplex etc, you should have everything you need to program the
> MAC when the link mode is forced.
>
I tried forcing the PHY speed in the past, and it does not work.
This is a limitation which is also acknowledged for the suspected underlying PHY
hardware Airoha EN8811H, see the head of air_en8811h.c
Birger