netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <se@simonwunderlich.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	sw@simonwunderlich.de, Issam Hamdi <ih@simonwunderlich.de>
Subject: Re: [PATCH] net: phy: realtek: Add RTL8224 cable testing support
Date: Mon, 27 Oct 2025 08:49:36 +0100	[thread overview]
Message-ID: <8597775.T7Z3S40VBb@ripper> (raw)
In-Reply-To: <3b1d35d7-ed62-4351-9e94-28e614d7f763@lunn.ch>

[-- Attachment #1: Type: text/plain, Size: 2292 bytes --]

On Monday, 27 October 2025 01:16:12 CET Andrew Lunn wrote:
> > +#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?

Unfortunately, the datasheet doesn't say anything about cable tests.

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

I've tried it a couple of times (with shorts at different lengths) but was not 
able to do this. For me, it looks like the RTL8224 can represent these faults 
in parallel but not actual detect them in parallel. I also played around with
open + shorts. At the end, I never saw any parallel detections and left it to 
the bit prioritization (during decoding) from RTLSDK.

RTL8226 in RTLSDK doesn't use (in contrast to RTL8224 in RTLSDK) the bits - 
but there seems to be at least some connections. The codes for RTL8226 
(according to RTLSDK) are:

* 0x60 RTL8226_SRAM_RTCT_FAULT_OK (would be RTL8224 OK+DONE)
* 0x48 RTL8226_SRAM_RTCT_FAULT_OPEN (would be RTL8224 OPEN+DONE)
* 0x50 RTL8226_SRAM_RTCT_FAULT_SHORT (would be RTL8224 SAME_SHORT + DONE)
* 0x42 RTL8226_SRAM_RTCT_FAULT_MISMATCH_OPEN (would be RTL8224 DONE + ????)
* 0x44 RTL8226_SRAM_RTCT_FAULT_MISMATCH_SHORT (would be RTL8224 DONE + ????)
* else: RTL8226_SRAM_RTCT_FAULT_UNKNOWN

It seems like these decoding would not even have cross shorts. Don't ask me 
what this mismatch is - couldn't find anything like this in RTL8224. The bits 
1 + 2 are completely unused there.

Regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-10-27  7:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  9:49 [PATCH] net: phy: realtek: Add RTL8224 cable testing support Sven Eckelmann
2025-10-27  0:16 ` Andrew Lunn
2025-10-27  7:49   ` Sven Eckelmann [this message]
2025-10-27 11:55     ` Andrew Lunn
2025-10-29  1:50 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8597775.T7Z3S40VBb@ripper \
    --to=se@simonwunderlich.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=ih@simonwunderlich.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sw@simonwunderlich.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).