From patchwork Tue Apr 22 06:49:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: E Shattow X-Patchwork-Id: 2075201 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4ZhXsM4XyWz1yMZ for ; Tue, 22 Apr 2025 16:49:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F80D81026; Tue, 22 Apr 2025 08:49:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=freeshell.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 93D07810E8; Tue, 22 Apr 2025 08:49:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 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 AAAE58056A for ; Tue, 22 Apr 2025 08:49:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=freeshell.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=e@freeshell.de Received: from hay.lan. (unknown [IPv6:2605:59c0:20f3:a400:6ecf:39ff:fe00:8375]) (Authenticated sender: e) by freeshell.de (Postfix) with ESMTPSA id 350E3B4C0206; Tue, 22 Apr 2025 08:49:38 +0200 (CEST) From: E Shattow To: Minda Chen , Hal Feng , Tom Rini Cc: E Shattow , u-boot@lists.denx.de Subject: [PATCH v1] board: starfive: visionfive2: Order board detection logic to match config Date: Mon, 21 Apr 2025 23:49:17 -0700 Message-ID: <20250422064925.635394-1-e@freeshell.de> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 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 Refactor inside-out EEPROM-checking logic to better match the board-seeking callback and ordered list of targets from starfive_visionfive2_config since the JH7110 OF_UPSTREAM migration. Signed-off-by: E Shattow Reviewed-by: Leo Yu-Chi Liang --- board/starfive/visionfive2/spl.c | 40 ++++++++++++++------------------ 1 file changed, 18 insertions(+), 22 deletions(-) base-commit: cde0050618968aae335dfbc930641656d51ff5d0 prerequisite-patch-id: 3fdb915979e0c14c53e387fcf00d2dcaae28165e prerequisite-patch-id: 1a0c600d97801d90a464a645794ae65df41f2789 diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 3e4d3e21988..4d319f65a36 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -116,30 +116,26 @@ void board_init_f(ulong dummy) #if CONFIG_IS_ENABLED(LOAD_FIT) int board_fit_config_name_match(const char *name) { - const char *product_id; - u8 version; - - 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') && - !strcmp(name, "jh7110-starfive-visionfive-2-v1.3b")) - return 0; - - if ((version == 'a' || version == 'A') && - !strcmp(name, "jh7110-starfive-visionfive-2-v1.2a")) - return 0; - } else if (!strncmp(product_id, "MARS", 4) && - !strcmp(name, "jh7110-milkv-mars")) { + if(!strcmp(name, "starfive/jh7110-milkv-mars") && + !strncmp(get_product_id_from_eeprom(), "MARS", 4)) { return 0; - } else if (!strncmp(product_id, "STAR64", 6) && - !strcmp(name, "jh7110-pine64-star64")) { + } 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;