[RFC PATCH 06/10] net: pcs: xpcs: improve SGMII AN state handling for Rockchip RK3568

Jiawen Wu jiawenwu at trustnetic.com
Thu Jul 16 19:22:51 PDT 2026


On Wed, Jul 15, 2026 7:05 AM, Coia Prant wrote:
> Andrew Lunn <andrew at lunn.ch> 于2026年7月15日周三 06:44写道:
> >
> > On Wed, Jul 15, 2026 at 03:08:34AM +0800, Coia Prant wrote:
> > > Commit 2a22b7ae2fa3 ("net: pcs: xpcs: adapt Wangxun NICs for SGMII mode")
> >
> > You do not appear to Cc: the Wangxun NIC people. It would be good to
> > have there comments on this change.
> 
> I apologize; the output from get_maintainer.pl is very long. I’ve
> heard that having too many recipients can cause the PATCH to be
> rejected by the LKML mail server.
> 
> I have added Wangxun maintainer (Jiawen Wu <jiawenwu at trustnetic.com>
> and Mengyuan Lou <mengyuanlou at net-swift.com>) to the CC list.
> 
> > > Fixes: 2a22b7ae2fa3 ("net: pcs: xpcs: adapt Wangxun NICs for SGMII mode")
> > > Signed-off-by: Coia Prant <coiaprant at gmail.com>
> >
> > Please don't mix fixed and new code. Is this a real fix? Should it be
> > back ported to stable?
> 
> I am not sure if this is a specific characteristic of Wangxun NICs, as
> I do not have any available for testing.
> 
> The behavior of the Rockchip DW XPCS IP core matches what is described
> in the commit message (even though phylink brings the link to down
> based on the phydev link status).
> 
> This appears to be a bug (at least on Rockchip platforms) or Wangxun
> NICs features.
> 
> However, I cannot confirm whether Wangxun NICs behave the same way.
> Therefore, I have kept their code as is for now.
> 
> Could a Wangxun NICs maintainer provide some feedback based on testing?
> 
> If we can confirm that this is indeed a bug, I can submit a separate fix.
> 
> I would greatly appreciate it.
> 
> Thanks.

Hi Coia,

I have tested this patch and it works on Wangxun NICs, thanks.

The commit 2a22b7ae2fa3 ("net: pcs: xpcs: adapt Wangxun NICs for SGMII mode")
is too long ago for me to recall exactly what that thought was.

The log shows:

"On this device, CL37_ANSGM_STS (bit[4:1] of VR_MII_AN_INTR_STS) indicates
the status received from remote link during the auto-negotiation, and
self-clear after the auto-negotiation is complete.
Meanwhile, CL37_ANCMPLT_INTR will be set to 1, to indicate CL37 AN is
complete. So add another way to get the state for CL37 SGMII."

I tried to reproduce this issue, but it didn't seem to exist.
In the current logic:

link up -> read status from CL37_ANSGM_STS -> CL37_ANCMPLT_INTR not clear
link down -> read status from BMCR -> CL37_ANCMPLT_INTR clear

It also works, although CL37_ANCMPLT_INTR is not cleared every time, and AN
restart is absent. But BMCR looks like it only wants to be return as 0, it is
weird.

So I think Wangxun NICs also can be applied to general code as well, for
getting state in C37 SGMII mode.

However, I am wondering whether CL37_ANCMPLT_INTR clear and ANRESTART are
necessary.





More information about the Linux-rockchip mailing list