Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: as21xxx: better handle PHY HW reset on soft-reboot

On soft-reboot, with a reset GPIO defined for an Aeonsemi PHY, the
special match_phy_device fails to correctly identify that the PHY
needs to load the firmware again.

This is caused by the fact that PHY ID is read BEFORE the PHY reset
GPIO (if present) is asserted, so we can be in the scenario where the
phydev have the previous PHY ID (with the PHY firmware loaded) but
after reset the generic AS21xxx PHY is present in the PHY ID registers.

To better handle this, skip reading the PHY ID register only for the PHY
that are not AS21xxx (by matching for the Aeonsemi Vendor) and always
read the PHY ID for the other case to handle both firmware already
loaded or an HW reset.

Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://patch.msgid.link/20250823134431.4854-2-ansuelsmth@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Christian Marangi and committed by
Jakub Kicinski
b4d5cd20 1abe21ef

+4 -3
+4 -3
drivers/net/phy/as21xxx.c
··· 884 884 u32 phy_id; 885 885 int ret; 886 886 887 - /* Skip PHY that are not AS21xxx or already have firmware loaded */ 888 - if (phydev->c45_ids.device_ids[MDIO_MMD_PCS] != PHY_ID_AS21XXX) 887 + /* Skip PHY that are not AS21xxx */ 888 + if (!phy_id_compare_vendor(phydev->c45_ids.device_ids[MDIO_MMD_PCS], 889 + PHY_VENDOR_AEONSEMI)) 889 890 return genphy_match_phy_device(phydev, phydrv); 890 891 891 - /* Read PHY ID to handle firmware just loaded */ 892 + /* Read PHY ID to handle firmware loaded or HW reset */ 892 893 ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MII_PHYSID1); 893 894 if (ret < 0) 894 895 return ret;