Am 2020-04-30 21:41, schrieb Andrew Lunn:
ECD. The registers looks exactly like the one from the Marvell PHYs,
which makes me wonder if both have the same building block or if one
imitated the registers of the other. There are subtle differences
like one bit in the broadcom PHY is "break link" and is self-clearing,
while the bit on the Marvell PHY is described as "perform diagnostics
on link break".
Should we be sharing code between the two drivers?
If they are indeed the same sure, but it doesn't look like that the
marvell procedure works for the broadcom PHY.
What do you mean by calibrate it?
Some of the Marvell documentation talks about calibrating for losses
on the PCB. Run a diagnostics with no cable plugged in, and get the
cable length to the 'fault'. This gives you the distance to the RJ45
socket. You should then subtract that from all subsequent results.
But since this is board design specific, i decided to ignore it. I
suppose it could be stuffed into a DT property, but i got the feeling
it is not worth it, given the measurement granularity of 80cm.
Oh so, the time delta counter of the Marvell PHY also runs at 125MHz? ;)
/* Accoring to the datasheet the distance to the fault is
* DELTA_TIME * 0.824 meters.
*
* The author suspect the correct formula is:
* distance in meters = (c * VF) / (2 * 125MHz)
* where c is the speed of light, VF is the velocity factor of
* the twisted pair cable, 125MHz the counter frequency and
* the factor 2 because the hardware will measure the round
* trip time.
* With a VF of 0.69 we get the factor 0.824 mentioned in the
* datasheet.
*/
-michael