From: Daniel Machon <daniel.machon@microchip.com>
To: Robert Marko <robert.marko@sartura.hr>
Cc: <UNGLinuxDriver@microchip.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <Steen.Hegelund@microchip.com>,
<netdev@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <luka.perkov@sartura.hr>
Subject: Re: [PATCH net-next] net: lan969x: correct RGMII port mapping index
Date: Mon, 28 Sep 2026 11:18:04 +0200 [thread overview]
Message-ID: <20260928091804.hjnabzi52kz4ktmf@DEN-DL-M70577> (raw)
In-Reply-To: <20260922125112.2111256-1-robert.marko@sartura.hr>
Hi Robert,
> Currently, the lan969x_port_dev_mapping does not check for RGMII ports
> and just returns the physical port index.
>
> However, this does not work for RGMII ports as they have dedicated DEVRGMII
> register space with an dedicated instance per RGMII port.
>
> So, check if requested port index is an RGMII port and return the correct
> DEVRGMII index.
>
> Signed-off-by: Robert Marko <robert.marko@sartura.hr>
> ---
> drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c
> index f3a9c71bea36a..bf5320c7a6ca8 100644
> --- a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c
> +++ b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c
> @@ -142,6 +142,15 @@ static u32 lan969x_get_dev_mode_bit(struct sparx5 *sparx5, int port)
>
> static u32 lan969x_port_dev_mapping(struct sparx5 *sparx5, int port)
> {
> + if (lan969x_port_is_rgmii(port)) {
> + switch (port) {
> + case 28:
> + return 0;
> + case 29:
> + return 1;
> + }
> + }
> +
> if (lan969x_port_is_5g(port)) {
> switch (port) {
> case 9:
> --
> 2.55.0
>
The mapping itself is right, but as far as I can see nothing upstream
uses the returned index to access DEVRGMII. Every caller of
sparx5_port_dev_index() pairs it with sparx5_to_high_dev() or
sparx5_to_pcs_dev(), which never return TARGET_DEVRGMII. Those paths
are also never taken for RGMII ports. The code that does access
DEVRGMII, in lan969x_rgmii.c, computes its own index with
RGMII_PORT_IDX(). Sashiko, correctly points this out.
So I don't think anything is broken today. Did you see a problem on
hardware that this fixes?
FYI, we carry the same change downstream. But there it was added together with
RGMII MTU support, which reads and writes DEVRGMII_MAC_MAXLEN_CFG() using this
index.
/Daniel
next prev parent reply other threads:[~2026-09-28 9:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 12:50 [PATCH net-next] net: lan969x: correct RGMII port mapping index Robert Marko
2026-09-26 14:06 ` netdev-bot+sashiko
2026-09-28 9:18 ` Daniel Machon [this message]
2026-09-28 10:39 ` Robert Marko
2026-09-28 11:04 ` Daniel Machon
2026-09-28 12:29 ` Robert Marko
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=20260928091804.hjnabzi52kz4ktmf@DEN-DL-M70577 \
--to=daniel.machon@microchip.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luka.perkov@sartura.hr \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robert.marko@sartura.hr \
/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