While refactoring the Aeonsemi AS21xxx driver to prepare support for the
2nd PHY generation, a number of bugs were found in the existing code,
all dating back to its initial support commit.
Fix them in this series, which was developed and tested on Gen2
hardware, and additionally verified on an Airoha AN7583 evaluation board
with a Gen1 (AS21010JB1) PHY, running a 6.12.94 OpenWrt based kernel.
Note the first two patches were cherry-picked from [1] to avoid bringing
in a partial dependency, since the remaining patches in that series had
to be replaced in order to address all the corner cases.
In more detail, the series covers:
- Link status, speed and duplex reporting: avoid reporting link up with
a stale speed while autoneg is restarting; fix the speed status mask
and the 10M status value (the mask bug had been hiding the latter);
read speed from VEND1_SPEED_STATUS on the autoneg path too and derive
duplex from the link partner abilities; read 10/100/1000 link modes
from the Clause 22 advertisement.
- Autoneg advertisement: the PHY doesn't fully support the C45 AN
registers written by phylib, which can break the link when restricting
the advertisement. Implement .config_aneg via the firmware IPC
command, which takes only a top speed, and reflect the result in
phydev->advertising.
- IPC mailbox robustness: don't write the reply to a NULL buffer, take
ipc_lock before writing the payload, check payload write errors, and
reject odd payload lengths.
- Bounds and validation: handle odd-length firmware without reading out
of bounds, fix the off-by-one LED index check, and return -EOPNOTSUPP
for unsupported LED hw control rules instead of overwriting the LED
configuration.
- Reset handling: release the PHY reset before reading the ID in
.match_phy_device(), so rebinding the driver no longer leaves the PHY
stuck in reset.
[1] https://lore.kernel.org/all/2026…@gmail.com/
Signed-off-by: Cristian Ciocaltea <cris…@collabora.com>
---
Christian Marangi (2):
net: phy: as21xxx: handle stale link status during autoneg
net: phy: as21xxx: handle odd firmware on loading
Cristian Ciocaltea (12):
net: phy: as21xxx: Fix LED index bounds check
net: phy: as21xxx: Use the correct mask for the speed status
net: phy: as21xxx: Correct the 10M speed status value
net: phy: as21xxx: Do not write the IPC reply to a NULL buffer
net: phy: as21xxx: Write IPC payload under ipc_lock
net: phy: as21xxx: Handle IPC payload write errors
net: phy: as21xxx: Reject odd IPC payload lengths
net: phy: as21xxx: Fix LED hw control set for unsupported rules
net: phy: as21xxx: Read 10/100/1000 link modes from C22 advertisement
net: phy: as21xxx: Configure autoneg advertisement via IPC
net: phy: as21xxx: Fix speed and duplex reporting
net: phy: as21xxx: Release reset before reading ID in match
drivers/net/phy/as21xxx.c | 496 +++++++++++++++++++++++++++++++++++++++-------
1 file changed, 420 insertions(+), 76 deletions(-)
---
base-commit: fad0d57b12f6979bc0127f0a4f704c6d7177ca78
change-id: 20261129-as21xxx-fixes-e934adae8841
[PATCH net 00/14] net: phy: as21xxx: Fix a batch of driver issues
- From
- cris…@collabora.com (Cristian Ciocaltea)
- Organization
- Usenet Network
- Message-ID
- <2026…@collabora.com>
- Date
- Newsgroups
- linux.kernel.netdev