Closed akaeba closed 3 years ago
Here's the thing: there are an enormous amount of different devices connected to MDIO buses - one class of devices, namely Alaska PHYs from Marvell, happen to use register 22 as a page register. So it would be wrong for a generic tool like mdio
to try to accommodate all such quirks.
Furthermore, changing the page register of a PHY that is controlled by a kernel driver will likely lead to weird bugs during debug sessions. Been there, done that - got the t-shirt: phytool
That is why mdio
has the mva
(Marvell Alaska) addressing mode. So instead of this:
~$ page=$(mdio stmmac-1 phy 0x01 raw 22)
~$ # Pray that the driver does not try to access the PHY before we're done
~$ mdio stmmac-1 phy 0x01 raw 22 6
~$ mdio stmmac-1 phy 0x01 raw 16 0x000e
~$ mdio stmmac-1 phy 0x01 raw 22 $page
You can use mva
like this:
~$ mdio stmmac-1 mva 0x01 raw 6:16 0x000e
In addition to being easier to use, the operation is atomic with respect to any other users of the PHY, e.g. a kernel driver.
So in summary: don't mess up the page register :smile:, use mva
. If you do mess up the page register, there is no reliable way for mdio
to figure that out.
Hello WKZ,
thanks again for the great tool!
It seems that I found an interesting behaviour. If I run the tool the first time with following command:
works the tool perfectly.
Now I mess up the page register, f.e.
and rerun again:
Then the wrong PHY-ID is readen.
One Solution could be to check the value of the page register before read the PHY-ID. Thanks for your Help.
Best Regards, Andreas