Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Josua Mayer <josua@solid-run.com>
Cc: "linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Vinod Koul <vkoul@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH phy-next 5/5] phy: lynx-28g: add support for 25GBASER
Date: Wed, 13 May 2026 14:22:22 +0300	[thread overview]
Message-ID: <20260513112222.2szwvxptk2udv7ga@skbuf> (raw)
In-Reply-To: <375dddbc-385c-4dcb-a280-33292215ae67@solid-run.com>

On Wed, May 13, 2026 at 11:00:32AM +0000, Josua Mayer wrote:
> Wouldn't it be more clear instead of indirect lane offset shift with
> lynx_28g_e25g_pcvt, to instead fix the E25G_CFG definition?:
> 
> -#define E25G_CFG(id) (28 - (id) * 4) /* Offset into PCCD */
> +#define E25G_CFG(id) ((id) * 4)      /* Offset into PCCD */
> 
> This is equivalent when inserting (7 - lane) into E25G_CFG id:
> 
> (28 - (id) * 4) = (28 - (7 - lane) * 4) = (28 - 7*4 + lane*4)

The 'indirect' lane offset shift is actually a two-step lookup:
lane -> protocol converter index
protocol converted index -> offset into PCCD

LX2160ARM documents PCCD fields as:
E25GA_CFG, aka E25G_CFG(0) in code: 30:28
E25GB_CFG, aka E25G_CFG(1) in code: 26:24
...
E25GH_CFG, aka E25G_CFG(7) in code: 2:0

The odd bit is that lane 0 uses E25G protocol converter 7, unlike, say,
1G and 10G where we have a lane:pcvt identity mapping.
lynx_28g_e25g_pcvt() performs that translation.

Additionally, for locating E40GA_CFG, E40GB_CFG in PCCE, I've adopted
the same scheme downstream, where E40G_CFG() returns bits 30:28 for
argument 0 (pcvt A) and bits 26:24 for argument 1 (pcvt B), and it is
called with this lane->pcvt translation function:

static int lynx_28g_e40g_pcvt(int lane)
{
	return lane < 4 ? 1 : 0;
}

Are you saying that merging the two lookups would be more clear because
as a reader you'd get to ask yourself less questions (the code would
flow more naturally) despite the non-trivial lane<->pcvt mapping, or why
exactly? For me it is the exact opposite. I can follow the RM
definitions and then I have a separate function that tells me how lanes
are mapped to the protocol converters.

  reply	other threads:[~2026-05-13 11:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 15:00 [PATCH phy-next 0/5] Lynx 28G SerDes: 25GbE support Vladimir Oltean
2026-05-11 15:00 ` [PATCH phy-next 1/5] dt-bindings: phy: lynx-28g: add compatible strings per SerDes and instantiation Vladimir Oltean
2026-05-11 15:00 ` [PATCH phy-next 2/5] dt-bindings: phy: lynx-28g: add constraint on LX2162A lane indices Vladimir Oltean
2026-05-11 16:30   ` Conor Dooley
2026-05-11 15:00 ` [PATCH phy-next 3/5] phy: lynx-28g: require an OF node to probe Vladimir Oltean
2026-05-12 15:01   ` Ioana Ciornei
2026-05-11 15:00 ` [PATCH phy-next 4/5] phy: lynx-28g: probe on per-SoC and per-instance compatible strings Vladimir Oltean
2026-05-12 15:02   ` Ioana Ciornei
2026-05-11 15:00 ` [PATCH phy-next 5/5] phy: lynx-28g: add support for 25GBASER Vladimir Oltean
2026-05-13 11:00   ` Josua Mayer
2026-05-13 11:22     ` Vladimir Oltean [this message]
2026-05-13 11:41       ` Josua Mayer
2026-05-13 11:37   ` Josua Mayer
2026-05-13 11:44     ` Josua Mayer
2026-05-13 13:37     ` Vladimir Oltean
2026-05-13 14:50       ` Josua Mayer
2026-05-13 15:10         ` Vladimir Oltean
2026-05-13 14:51 ` [PATCH phy-next 0/5] Lynx 28G SerDes: 25GbE support Josua Mayer

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=20260513112222.2szwvxptk2udv7ga@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=josua@solid-run.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /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