Repository navigation
gk-ephy: read as the GK7101 internal PHY does - #206
Conversation
The model gave the internal PHY an invented ID (0x0007c0f1) and set the
BMSR link bit, so that phylib would accept it. A GK7101 reads
otherwise, with a 100 Mb/s full-duplex link up:
BMCR 3100 BMSR 78e9 ID1 0000 ID2 0000 ANAR 01e1 ANLPAR cde1
No ID, and autoneg complete but never the link bit. The vendor kernel
driver copes (it takes autoneg complete for link up, and prints mii id
= 0). OpenIPC U-Boot's phylib did not, and found no PHY on the camera,
while it worked here. Read as the silicon does, so it fails here too.
Boots of the gk7101 machine: the vendor-based kernel logs mii id = 0 and
reaches login; U-Boot without an ID workaround reports Could not get PHY,
with one it tftps. test-gk710x.py and test-gk710xs.py pass.
PR Summary by QodoMatch GK7101 internal PHY register reads
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. New PHY register values have no regression test
|
| case 1: /* BMSR: 100/10 FD/HD, preamble suppression, AN complete */ | ||
| return 0x78E9; | ||
| case 2: /* PHYID1 / PHYID2 */ | ||
| case 3: | ||
| return 0xC0F1; | ||
| case 5: /* ANLPAR: the partner advertises the same */ | ||
| return 0x45E1; | ||
| return 0; | ||
| case 5: /* ANLPAR, as a switch advertised it to that GK7101 */ | ||
| return 0xCDE1; |
There was a problem hiding this comment.
1. New phy register values have no regression test 📘 Rule violation ⚙ Maintainability
gk_ephy_read now returns BMSR 0x78E9, zero for both ID registers and ANLPAR 0xCDE1, but the PR adds or changes no register-level test for gk-ephy. Neither test-gk710x.py nor test-gk710xs.py reads the PHY window, so a later change that restores an ID or the link bit would pass both tests.
Agent Prompt
## Issue description
The `gk-ephy` read values (BMSR `0x78E9`, ID1/ID2 0, ANLPAR `0xCDE1`) are not covered by any register test.
## Fix Focus Areas
- qemu/tests/test-gk710x.py[121-290]
- qemu/hw/misc/gk-ephy.c[42-58]
## Recommended Fix
Add a `test_ephy` to `test-gk710x.py` that reads the PHY MMIO window (`ephy_base` from `qemu/hw/arm/goke.c`) at +0x4 (BMSR), +0x8 and +0xC (IDs), +0x10 (ANAR) and +0x14 (ANLPAR). It should assert `0x78E9`, 0, 0, `0x01E1` and `0xCDE1`, and that the link bit (`0x4`) is clear. Call it from `main`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The internal-PHY model reported an invented ID (0x0007c0f1) and set the BMSR link bit. A real GK7101, with a 100 Mb/s full-duplex link up, reads:
There is no ID, and BMSR shows autoneg complete but never the link bit. U-Boot's phylib therefore found no PHY on the camera, while it worked in qemu. The model now reads like the silicon, so that failure shows here too.
Checked:
mii id = 0and boots to login;Could not get PHY, and with one (OpenIPC/u-boot hi3516ev200 / hi3518ev300: u-boot "hardware decompress overtime" — HW decompressor unimplemented #60) it transfers a file over TFTP;test-gk710x.pyandtest-gk710xs.pypass.