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

From: Andrew Lunn
Date: Sun May 10 2020 - 10:44:18 EST


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 ?

> +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?

Florian, do you have access to any erratas? Is this maybe fixed in
other revisions/family members?

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew