From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Vincent Jardin <vjardin@free.fr>
Cc: u-boot@lists.u-boot-project.org, Peng Fan <peng.fan@nxp.com>,
Tom Rini <trini@konsulko.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Wasim Khan <wasim.khan@nxp.com>,
Priyanka Jain <priyanka.jain@nxp.com>,
Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>,
Ioana Ciornei <ioana.ciornei@nxp.com>
Subject: Re: [PATCH v4 04/10] board: lx2160a: serdes: report unknown SD1 cases
Date: Mon, 28 Sep 2026 17:29:17 +0300 [thread overview]
Message-ID: <20260928142917.aabvby64k4e3tfpc@skbuf> (raw)
In-Reply-To: <20260928101330.881662-5-vjardin@free.fr> <20260928101330.881662-5-vjardin@free.fr>
On Mon, Sep 28, 2026 at 12:13:23PM +0200, Vincent Jardin wrote:
> Check and if unknown display:
> lx2160a serdes: unknown hwconfig serdes1:split, ignored
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
>
> ---
>
> Changes in v4:
> - New patch
>
> board/nxp/lx2160a/serdes_split.c | 32 ++++++++++++++++++++++++++++++--
> 1 file changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/board/nxp/lx2160a/serdes_split.c b/board/nxp/lx2160a/serdes_split.c
> index 11bec35fd22..a8fbb278b3a 100644
> --- a/board/nxp/lx2160a/serdes_split.c
> +++ b/board/nxp/lx2160a/serdes_split.c
> @@ -443,17 +443,23 @@ static const struct sd1_mode sd1_modes[] = {
> },
> };
>
> -static const struct sd1_mode *sd1_mode_find(const char *name)
> +static const struct sd1_mode *sd1_mode_findn(const char *name, size_t n)
> {
> int i;
>
> for (i = 0; i < ARRAY_SIZE(sd1_modes); i++)
> - if (!strcmp(sd1_modes[i].name, name))
> + if (strlen(sd1_modes[i].name) == n &&
> + !strncmp(sd1_modes[i].name, name, n))
> return &sd1_modes[i];
>
> return NULL;
> }
>
> +static const struct sd1_mode *sd1_mode_find(const char *name)
> +{
> + return sd1_mode_findn(name, strlen(name));
> +}
Hmm, there's a single other caller of sd1_mode_find(), from sd1_enter().
Is it really worth it to implement a shim over sd1_mode_findn()?
I don't think so.
Can you please plan accordingly and modify sd1_mode_find() to take the
function prototype of sd1_mode_find() from the get go?
> +
> static void sd1_print_pcc(unsigned long base)
> {
> printf("PCCC=%08x PCCD=%08x PCCE=%08x",
> @@ -503,6 +509,26 @@ static int sd1_enter(const struct sd1_mode *mode,
> return 0;
> }
>
> +static void sd1_report_unknown(void)
> +{
> + const char *arg, *comma, *eq;
> + size_t len, n;
> +
> + arg = hwconfig_arg("serdes1", &len);
> + while (arg && len) {
> + comma = memchr(arg, ',', len);
> + n = comma ? comma - arg : len;
> + eq = memchr(arg, '=', n);
> + if (n && !sd1_mode_findn(arg, eq ? eq - arg : n))
> + printf("lx2160a serdes: unknown hwconfig serdes1:%.*s, ignored\n",
> + (int)n, arg);
> + if (!comma)
> + break;
> + len -= n + 1;
> + arg = comma + 1;
What is the point of this manual hand-rolling of sub-options?
As far as I can read from doc/README.fsl-hwconfig, the serdes1 syntax is
A: 'serdes1:2x100g[;other-options:other-values]', not
B: 'serdes1:suboption=value,suboption2=other_value[;other-options:other-values]'.
To parse syntax A, you don't need any comma or equal detection.
The 'len' provided by hwconfig_arg() should end at the next semicolon
separator already, or at the end of the string. You should be able to
print that directly. Or if not, you haven't explained the need for all
this complexity.
> + }
> +}
> +
> /*
> * setenv hwconfig serdes1:<mode>
> *
> @@ -517,6 +543,8 @@ void lx2160a_serdes_apply_hwconfig(void)
> const struct sd1_mode *mode = NULL;
> int i;
>
> + sd1_report_unknown();
> +
> for (i = 0; i < ARRAY_SIZE(sd1_modes); i++) {
> if (!hwconfig_sub("serdes1", sd1_modes[i].name))
> continue;
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-09-28 14:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 10:13 [PATCH v4 00/10] board: lx2160a: runtime SD 1 lane configuration for LX2160A boards Vincent Jardin
2026-09-28 10:13 ` [PATCH v4 01/10] board: lx2160a: serdes: drop the split subcommand Vincent Jardin
2026-09-28 11:17 ` Vladimir Oltean
2026-09-28 10:13 ` [PATCH v4 02/10] board: lx2160a: serdes: rename serdes1:split to serdes1:100g4x25g Vincent Jardin
2026-09-28 11:18 ` Vladimir Oltean
2026-09-28 10:13 ` [PATCH v4 03/10] board: lx2160a: serdes: set SD1 with a table Vincent Jardin
2026-09-28 12:02 ` Vladimir Oltean
2026-09-28 10:13 ` [PATCH v4 04/10] board: lx2160a: serdes: report unknown SD1 cases Vincent Jardin
2026-09-28 14:29 ` Vladimir Oltean [this message]
2026-09-28 10:13 ` [PATCH v4 05/10] board: lx2160a: serdes: no SD1 config once MC runs Vincent Jardin
2026-09-28 14:50 ` Vladimir Oltean
2026-09-28 10:13 ` [PATCH v4 06/10] board: lx2160a: serdes: add serdes1:2x40g Vincent Jardin
2026-09-28 10:13 ` [PATCH v4 07/10] board: lx2160a: serdes: add serdes1:40g4x10g Vincent Jardin
2026-09-28 10:13 ` [PATCH v4 08/10] board: lx2160a: serdes: add serdes1:100g4x10g Vincent Jardin
2026-09-28 10:13 ` [PATCH v4 09/10] doc: lx2160a: document the sd1 hwconfig option Vincent Jardin
2026-09-28 15:05 ` Vladimir Oltean
2026-09-28 15:10 ` Vladimir Oltean
2026-09-28 22:13 ` Vincent Jardin
2026-09-28 10:13 ` [PATCH v4 10/10] board: nbxv3: apply sd1 hwconfig before MC starts Vincent Jardin
2026-09-28 15:07 ` Vladimir Oltean
2026-09-28 19:14 ` [PATCH v4 00/10] board: lx2160a: runtime SD 1 lane configuration for LX2160A boards Tom Rini
2026-09-28 20:59 ` Vincent Jardin
2026-09-28 21:15 ` Tom Rini
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=20260928142917.aabvby64k4e3tfpc@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=hemant.agrawal@nxp.com \
--cc=ioana.ciornei@nxp.com \
--cc=meenakshi.aggarwal@nxp.com \
--cc=peng.fan@nxp.com \
--cc=priyanka.jain@nxp.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=vjardin@free.fr \
--cc=wasim.khan@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox