wkz / phytool

Linux MDIO register access
GNU General Public License v2.0
143 stars 75 forks source link

Reading extended registers doesn't work #11

Closed coveritytest closed 1 year ago

coveritytest commented 1 year ago

to read extended registers on DP83826I PHY which does not work. According to section 9.3.11.5 in the manual we need to do:

phytool write eth0/5/D 0x001F phytool write eth0/5/E 0x0025 phytool write eth0/5/D 0x401F phytool read eth0/5/E

in order to read register 0x25. This results in 0x4000. It does result in 0x4000 for all extended registers, I always get 0x4000 as a result.

coveritytest commented 1 year ago

Okay, it works with

phytool write eth0/5/0xD 0x001F phytool write eth0/5/0xE 0x0025 phytool write eth0/5/0xD 0x401F phytool read eth0/5/0xE

Don't know if bug or feature.

wkz commented 1 year ago

I would say that if your first example had worked, then that would have been the bug. Heuristics around bases always end bad in my experience. I.e. which register would you expect to read with phytool read eth0/5/10? 10 or 16 (decimal)?

Accepting decimal numbers is good for several reasons:

Let me also recommend that you check out mdio-tools, which already implements Clause 45 over Clause 22 addressing. In your case, mdio <YOUR-BUS> mmd-c22 5:0x1f 0x25 should replace the 4 invocations of phytool.

coveritytest commented 1 year ago

Thanks for clarification.