U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: E Shattow <e@freeshell.de>
To: Minda Chen <minda.chen@starfivetech.com>,
	Hal Feng <hal.feng@starfivetech.com>,
	Tom Rini <trini@konsulko.com>
Cc: E Shattow <e@freeshell.de>, 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	[thread overview]
Message-ID: <20250422064925.635394-1-e@freeshell.de> (raw)

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 <e@freeshell.de>
---
 board/starfive/visionfive2/spl.c | 40 ++++++++++++++------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

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;

base-commit: cde0050618968aae335dfbc930641656d51ff5d0
prerequisite-patch-id: 3fdb915979e0c14c53e387fcf00d2dcaae28165e
prerequisite-patch-id: 1a0c600d97801d90a464a645794ae65df41f2789
-- 
2.49.0


             reply	other threads:[~2025-04-22  6:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22  6:49 E Shattow [this message]
2025-04-25  8:32 ` [PATCH v1] board: starfive: visionfive2: Order board detection logic to match config Leo Liang

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=20250422064925.635394-1-e@freeshell.de \
    --to=e@freeshell.de \
    --cc=hal.feng@starfivetech.com \
    --cc=minda.chen@starfivetech.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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