From: <markus.stockhausen@gmx.de>
To: "'Andrew Lunn'" <andrew@lunn.ch>, <Chris.Packham@alliedtelesis.co.nz>
Cc: <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <michael@fossekall.de>,
<daniel@makrotopia.org>, <netdev@vger.kernel.org>
Subject: AW: [PATCH] net: phy: realtek: convert RTL8226-CG to c45 only
Date: Wed, 18 Jun 2025 08:03:25 +0200 [thread overview]
Message-ID: <788b01dbe016$b92c4470$2b84cd50$@gmx.de> (raw)
In-Reply-To: <6e0e38b4-db64-4b63-ac36-4a432b762767@lunn.ch>
> Von: Andrew Lunn <andrew@lunn.ch>
> Gesendet: Dienstag, 17. Juni 2025 17:36
> An: Markus Stockhausen <markus.stockhausen@gmx.de>
> Betreff: Re: [PATCH] net: phy: realtek: convert RTL8226-CG to c45 only
>
> On Tue, Jun 17, 2025 at 11:01:47AM -0400, Markus Stockhausen wrote:
> > The RTL8226-CG can be found on devices like the Zyxel XGS1210-12. These
> > are driven by a RTL9302B SoC that has active phy hardware polling in
> > the background.
>
> It would be a lot better to just turn that polling off.
This is our challenge:
https://elixir.bootlin.com/linux/v6.16-rc2/source/drivers/net/mdio/mdio-real
tek-rtl9300.c#L366
>
> > As soon as this is active and set to c45 most c22
> > register accesses are blocked and will stop working. Convert the
> > phy to a c45-only function set.
> >
> > For documentation purposes some register extracts that where taken to
> > verify proper detection.
>
> Please could you show us the output from ethtool before/after.
>
> > PHY_ID_MATCH_EXACT(0x001cc838),
> > .name = "RTL8226-CG 2.5Gbps PHY",
> > - .get_features = rtl822x_get_features,
>
> You can see this calls genphy_read_abilities(phydev) at the end, so
> reading information about 10/100/1G speeds, using the standard C22
> registers.
>
> > - .config_aneg = rtl822x_config_aneg,
> > - .read_status = rtl822x_read_status,
> > - .suspend = genphy_suspend,
> > - .resume = rtlgen_resume,
> > + .soft_reset = rtl822x_c45_soft_reset,
> > + .get_features = rtl822x_c45_get_features,
>
> This only calls genphy_c45_pma_read_abilities(). So i expect 10/100/1G
> is missing.
I had to patch the mdio driver to make the existing RTL8226 phy driver work
with
It. So whenever a c22 command is sent it will toggle the protocol. I do not
believe
that this is what it was designed for but maybe Chris has some more
experience.
Output with patched bus:
[ 49.552627] toggle bus 1 from c45 to c22 to read port 24 page 0 register
1
[ 49.560663] toggle bus 1 from c22 to c45
...
# ethtool lan9
Settings for lan9:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 24
Transceiver: external
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: d
Wake-on: d
Link detected: no
The RTL8226 seems to support proper MDIO_PMA_EXTABLE flags.
So genphy_c45_pma_read_abilities() can conveniently call
genphy_c45_pma_read_ext_abilities() and 10/100/1000 is
populated right.
Outputs with patched driver:
# ethtool lan9
Settings for lan9:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 24
Transceiver: external
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: d
Wake-on: d
Link detected: no
Markus
next prev parent reply other threads:[~2025-06-18 6:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 15:01 [PATCH] net: phy: realtek: convert RTL8226-CG to c45 only Markus Stockhausen
2025-06-17 15:36 ` Andrew Lunn
2025-06-18 6:03 ` markus.stockhausen [this message]
2025-06-18 21:27 ` AW: " Chris Packham
2025-06-19 2:47 ` Chris Packham
2025-06-19 6:23 ` AW: " markus.stockhausen
2025-07-03 6:18 ` markus.stockhausen
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='788b01dbe016$b92c4470$2b84cd50$@gmx.de' \
--to=markus.stockhausen@gmx.de \
--cc=Chris.Packham@alliedtelesis.co.nz \
--cc=andrew@lunn.ch \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michael@fossekall.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.