Re: [PATCH] net: phy: realtek: Add RTL8224 cable testing support
From: Andrew Lunn
Date: Sun Oct 26 2025 - 20:16:34 EST
> +#define RTL8224_SRAM_RTCT_FAULT_BUSY BIT(0)
> +#define RTL8224_SRAM_RTCT_FAULT_OPEN BIT(3)
> +#define RTL8224_SRAM_RTCT_FAULT_SAME_SHORT BIT(4)
> +#define RTL8224_SRAM_RTCT_FAULT_OK BIT(5)
> +#define RTL8224_SRAM_RTCT_FAULT_DONE BIT(6)
> +#define RTL8224_SRAM_RTCT_FAULT_CROSS_SHORT BIT(7)
It is unusual these are bits. Does the datasheet say what happens if
the cable is both same short and cross short?
> +static int rtl8224_cable_test_result_trans(u32 result)
> +{
> + if (result & RTL8224_SRAM_RTCT_FAULT_SAME_SHORT)
> + return ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT;
> +
> + if (result & RTL8224_SRAM_RTCT_FAULT_BUSY)
> + return ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC;
> +
> + if (result & RTL8224_SRAM_RTCT_FAULT_CROSS_SHORT)
> + return ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT;
I don't remember seeing a PHY able to report both same short and cross
short at the same time. Maybe there has been, but there is no code for
it. We could add such a code.
Andrew