From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8CA9AC021B2 for ; Sun, 23 Feb 2025 01:33:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9BD7D808B6; Sun, 23 Feb 2025 02:33:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=freeshell.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=freeshell.de header.i=@freeshell.de header.b="EidJ8pbu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1D84480F67; Sun, 23 Feb 2025 02:33:51 +0100 (CET) Received: from freeshell.de (freeshell.de [116.202.128.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C37E080087 for ; Sun, 23 Feb 2025 02:33:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=freeshell.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=e@freeshell.de Received: from [192.168.2.35] (unknown [98.97.26.251]) (Authenticated sender: e) by freeshell.de (Postfix) with ESMTPSA id A2DA6B4C038F; Sun, 23 Feb 2025 02:33:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freeshell.de; s=mail; t=1740274428; bh=h5HYkiNrU83E0tAxOskh5fGOYWF243X5aMiCEh3Sn4w=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=EidJ8pbuXlL9XwR4h2/AOVEfcKXuW3b8kzlfIMBFpzkl/M5jOJ/91jVSCPlh4l8d/ cfknYoXiDO8hcPg2rDxc3lGDOFmwaEHGC6M6lH4DkoVwcVBXmu6KI2wc5d/o1EcXh7 nCFpax0JRzGzfspYtd7BkEwbV/CP0d/FT/igYh7E= Message-ID: <79f87309-a4a4-4332-8ea1-9a9df0174186@freeshell.de> Date: Sat, 22 Feb 2025 17:33:43 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/4] board: starfive: spl: strip off 'starfive/' prefix To: Heinrich Schuchardt , Rick Chen , Leo Cc: Minda Chen , Hal Feng , Simon Glass , Yu-Chien Peter Lin , Sumit Garg , "Leon M . Busch-George" , Lukas Funke , H Bell , u-boot@lists.denx.de References: <20250221095856.36530-1-heinrich.schuchardt@canonical.com> <20250221095856.36530-4-heinrich.schuchardt@canonical.com> Content-Language: en-US From: E Shattow In-Reply-To: <20250221095856.36530-4-heinrich.schuchardt@canonical.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 > Reviewed-by: Leo Yu-Chi Liang > --- > 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