All of lore.kernel.org
 help / color / mirror / Atom feed
From: <markus.stockhausen@gmx.de>
To: "'Heiner Kallweit'" <hkallweit1@gmail.com>, <andrew@lunn.ch>,
	<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>, <jan@3e8.eu>
Subject: AW: [PATCH v2] net: phy: realtek: convert RTL8226-CG to c45 only
Date: Thu, 31 Jul 2025 12:55:40 +0200	[thread overview]
Message-ID: <059901dc0209$a817de50$f8479af0$@gmx.de> (raw)
In-Reply-To: <d0e1c087-f701-402e-b842-3444fbce7f27@gmail.com>

Hi Heiner,

> Von: Heiner Kallweit <hkallweit1@gmail.com> 
> Gesendet: Donnerstag, 31. Juli 2025 12:25
>
> On 31.07.2025 07:44, Markus Stockhausen wrote:
> > The RTL8226-CG can be found on devices like the Zyxel XGS1210-12. 
> > These are driven by a Realtek RTL9302B SoC that has phy hardware 
> > polling in the background. One must decide if a port is polled via c22 or c45.
> > Additionally the hardware disables MMD access in c22 mode. For 
> > reference
>
> For my understanding: Which hardware disables c22 MMD access on RTL8226 how?
> RTL930x configures RTL8226 in a way that is doesn't accept c45 over c22 any longer?

sorry to be not clear about this. We have rtl9300 mdio driver
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree
/drivers/net/mdio/mdio-realtek-rtl9300.c?h=v6.16

This must decide how its four smi busses are configured. Either c22 
or c45. https://svanheule.net/realtek/longan/register/smi_glb_ctrl 
So it does.

	/* Put the interfaces into C45 mode if required */
	glb_ctrl_mask = GENMASK(19, 16);
	for (i = 0; i < MAX_SMI_BUSSES; i++)
		if (priv->smi_bus_is_c45[i])
			glb_ctrl_val |= GLB_CTRL_INTF_SEL(i);
	...
	err = regmap_update_bits(regmap, SMI_GLB_CTRL,
				 glb_ctrl_mask, glb_ctrl_val);

As soon as this bit is set to one mode the bus will block most
accesses with the other mode. E.g. In c22 mode registers 13/14
are a dead end. So the only option for the bus is to limit access
like this.

	bus->name = "Realtek Switch MDIO Bus";
	if (priv->smi_bus_is_c45[mdio_bus]) {
		bus->read_c45 = rtl9300_mdio_read_c45;
		bus->write_c45 =  rtl9300_mdio_write_c45;
	} else {
		bus->read = rtl9300_mdio_read_c22;
		bus->write = rtl9300_mdio_write_c22;
	}

Markus


  reply	other threads:[~2025-07-31 10:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31  5:44 [PATCH v2] net: phy: realtek: convert RTL8226-CG to c45 only Markus Stockhausen
2025-07-31  9:23 ` Daniel Golle
2025-07-31  9:58   ` AW: " markus.stockhausen
2025-07-31 10:25 ` Heiner Kallweit
2025-07-31 10:55   ` markus.stockhausen [this message]
2025-07-31 13:50     ` Andrew Lunn
2025-07-31 14:01     ` AW: " Russell King (Oracle)
2025-07-31 14:33       ` Daniel Golle

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='059901dc0209$a817de50$f8479af0$@gmx.de' \
    --to=markus.stockhausen@gmx.de \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jan@3e8.eu \
    --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.