U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: E Shattow <e@freeshell.de>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
	Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>
Cc: Minda Chen <minda.chen@starfivetech.com>,
	Hal Feng <hal.feng@starfivetech.com>,
	Simon Glass <sjg@chromium.org>,
	Yu-Chien Peter Lin <peter.lin@sifive.com>,
	Sumit Garg <sumit.garg@linaro.org>,
	"Leon M . Busch-George" <leon@georgemail.eu>,
	Lukas Funke <lukas.funke@weidmueller.com>,
	H Bell <dmoo_dv@protonmail.com>,
	u-boot@lists.denx.de
Subject: Re: [PATCH v3 3/4] board: starfive: spl: strip off 'starfive/' prefix
Date: Sat, 22 Feb 2025 17:33:43 -0800	[thread overview]
Message-ID: <79f87309-a4a4-4332-8ea1-9a9df0174186@freeshell.de> (raw)
In-Reply-To: <20250221095856.36530-4-heinrich.schuchardt@canonical.com>



On 2/21/25 01:58, Heinrich Schuchardt wrote:
> The configuration descriptions generated by binman contain the vendor
> device-tree directory. Instead of adding it to all match strings just strip
> it off.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
> ---
> v3:
> 	no change
> v2:
> 	no change
> ---
>  board/starfive/visionfive2/spl.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c
> index 22afd76c6b9..d63eb1abe6a 100644
> --- a/board/starfive/visionfive2/spl.c
> +++ b/board/starfive/visionfive2/spl.c
> @@ -118,6 +118,10 @@ int board_fit_config_name_match(const char *name)
>  
>  	product_id = get_product_id_from_eeprom();
>  
> +	/* Strip off prefix */
> +	if (strncmp(name, "starfive/", 9))
> +		return -EINVAL;
> +	name += 9;
>  	if (!strncmp(product_id, "VF7110", 6)) {
>  		version = get_pcb_revision_from_eeprom();
>  		if ((version == 'b' || version == 'B') &&

Let's insist on logic statements in board_fit_config_name_match()
callback that begin with literal items (no pointer math trickery) from
configs/starfive_visionfive2_defconfig:CONFIG_OF_LIST and in that order:

#if CONFIG_IS_ENABLED(LOAD_FIT)
int board_fit_config_name_match(const char *name)
{
	if(!strcmp(name, "starfive/jh7110-milkv-mars") &&
	   !strncmp(get_product_id_from_eeprom(), "MARS", 4)) {
		return 0;
	} else if((!strcmp(name, "starfive/jh7110-pine64-star64")) &&
	   !strncmp(get_product_id_from_eeprom(), "STAR64", 6)) {
		return 0;
	} else if((!strcmp(name, "starfive/jh7110-starfive-visionfive-2-v1.2a")) &&
	   !strncmp(get_product_id_from_eeprom(), "VF7110", 6)) {
		switch (get_pcb_revision_from_eeprom()) {
		case 'a':
		case 'A':
			return 0;
		}
	} else if((!strcmp(name, "starfive/jh7110-starfive-visionfive-2-v1.2b")) &&
	   !strncmp(get_product_id_from_eeprom(), "VF7110", 6)) {
		switch (get_pcb_revision_from_eeprom()) {
		case 'b':
		case 'B':
			return 0;
		}
	}

	return -EINVAL;
}
#endif

Not sure about code style so that is simply an example of keeping the
sort order the same as how it exists in
configs/starfive_visionfive2_defconfig:CONFIG_OF_LIST

Mars CM (and CM Lite) logic may be dropped since those targets do not
exist at the moment in starfive_visionfive2_defconfig:CONFIG_OF_LIST
however, I do anticipate to submit for review into Linux upstream soon
and to begin that process. A donation board was sent to me so I now have
Mars CM to test as well as Mars CM Lite.

Are the duplicate string definitions and logic in
board/starfive/visionfive2/starfive_visionfive2.c:set_fdtfile() etc.
still appropriate, could those now be factored out? I think Simon's
suggestion (in reply on IRC) of CONFIG_FIT_BEST_MATCH could replace that
functionality? -E

  reply	other threads:[~2025-02-23  1:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21  9:58 [PATCH v3 0/4] riscv: dts: starfive: simplify binman config Heinrich Schuchardt
2025-02-21  9:58 ` [PATCH v3 1/4] riscv: dts: add OF_LIST handling to binman.dtsi Heinrich Schuchardt
2025-02-22 22:05   ` E Shattow
2025-02-21  9:58 ` [PATCH v3 2/4] riscv: dts: no default configuration for MULTI_DTB_FIT Heinrich Schuchardt
2025-02-22 22:07   ` E Shattow
2025-02-21  9:58 ` [PATCH v3 3/4] board: starfive: spl: strip off 'starfive/' prefix Heinrich Schuchardt
2025-02-23  1:33   ` E Shattow [this message]
2025-02-23 12:55     ` Heinrich Schuchardt
2025-02-23 14:18       ` E Shattow
2025-02-23 15:39         ` Heinrich Schuchardt
2025-02-24 10:00           ` E Shattow
2025-02-24 10:13         ` Heinrich Schuchardt
2025-02-25 13:43           ` E Shattow
2025-02-21  9:58 ` [PATCH v3 4/4] riscv: dts: starfive: remove duplicate itb entries Heinrich Schuchardt
2025-02-23  1:36   ` E Shattow

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=79f87309-a4a4-4332-8ea1-9a9df0174186@freeshell.de \
    --to=e@freeshell.de \
    --cc=dmoo_dv@protonmail.com \
    --cc=hal.feng@starfivetech.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=leon@georgemail.eu \
    --cc=lukas.funke@weidmueller.com \
    --cc=minda.chen@starfivetech.com \
    --cc=peter.lin@sifive.com \
    --cc=rick@andestech.com \
    --cc=sjg@chromium.org \
    --cc=sumit.garg@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.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