openwrt/target
Jonas Jelonek 322041ffeb
realtek: mdio: enhance reading phy id
Reading the PHY ID to assign a PHY config is currently simple. For C45
two MDIO reads of a hardcoded MMD are done to get the standard PHY ID
registers. MMD 31 (MMD_VEND2) is used for that purpose, assuming there
will be a valid PHY ID stored in this MMD in all cases. However, with
Aquantia AQR813 there's at least one example for which this isn't true.
This PHY returns 0 for the PHY ID in MMD_VEND2, instead MMD_VEND1 would
have the correct ID.

Enhance reading the PHY by accessing a common set of MMDs of which most
PHY at least implement one and have a valid PHY ID in. To keep overhead
low, do not scan all MMDs. As soon as a valid PHY ID is found, exit and
use that. This is similar to the kernel logic, jsut reduced to fewer
MMDs.

Also handle possible errors coming from MDIO reads to avoid reading garbage.

While at it, move reading the PHY ID to a separate function to not
pollute the poll fixup retrievel function.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21515
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2026-01-25 12:12:15 +01:00
..
imagebuilder imagebuilder: fix parsing ABI for apk packages 2026-01-24 11:02:18 +01:00
linux realtek: mdio: enhance reading phy id 2026-01-25 12:12:15 +01:00
llvm-bpf build: use zstd for IB, toolchain, SDK and LLVM compression 2024-04-13 08:05:04 +02:00
sdk sdk: use GIT_COMMIT for buildbot SDK 2025-12-04 19:20:55 +01:00
toolchain build: use zstd for IB, toolchain, SDK and LLVM compression 2024-04-13 08:05:04 +02:00
Config.in targets: add USES_PM auto-feature 2025-07-20 12:16:13 +01:00
Makefile