Re: [PATCH net-next 3/4] net: phy: broadcom: add cable test support

From: Michael Walle
Date: Sun May 10 2020 - 10:51:33 EST


Am 2020-05-10 16:44, schrieb Andrew Lunn:
On Sun, May 10, 2020 at 12:37:13AM +0200, Michael Walle wrote:
Most modern broadcom PHYs support ECD (enhanced cable diagnostics). Add
support for it in the bcm-phy-lib so they can easily be used in the PHY
driver.

There are two access methods for ECD: legacy by expansion registers and
via the new RDB registers which are exclusive. Provide functions in two
variants where the PHY driver can from. To keep things simple for now,

can from ?

can choose from. Should I send a new patch? Will DaveM fix minor typos, if
he commits it?


+static int bcm_phy_report_length(struct phy_device *phydev, int result,
+ int pair)
+{
+ int val;
+
+ val = __bcm_phy_read_exp(phydev,
+ BCM54XX_EXP_ECD_PAIR_A_LENGTH_RESULTS + pair);
+ if (val < 0)
+ return val;
+
+ if (val == BCM54XX_ECD_LENGTH_RESULTS_INVALID)
+ return 0;
+
+ /* intra-pair shorts report twice the length */
+ if (result == BCM54XX_ECD_FAULT_TYPE_CROSS_SHORT)
+ val >>= 1;

You mentioned this before. This seems odd. The pulse travelled the
same distance as for an open or shorted cable. The whole of time
domain reflectrometry is based on some sort of echo and you always
need to device by two. So why this special case?

Well, I don't know why this is special. But one thing which is
different is that you listen on all pairs for the pulse instead of
just the one where you've sent it (which seems to be a bit trickier
otherwise the cheapo AT8031 would support it, too). Maybe they
screwed that. In any case, I can try it with a 100m cable just
to be sure.

-michael