U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] jh7110: starfive: visionfive2 drop setting of $fdtfile
@ 2025-04-22  6:45 E Shattow
  2025-04-22  6:45 ` [PATCH v1 1/2] doc: board: starfive: Drop " E Shattow
  2025-04-22  6:45 ` [PATCH v1 2/2] board: starfive: visionfive2: " E Shattow
  0 siblings, 2 replies; 7+ messages in thread
From: E Shattow @ 2025-04-22  6:45 UTC (permalink / raw)
  To: Tom Rini, Minda Chen, Hal Feng, Heinrich Schuchardt, Simon Glass
  Cc: E Shattow, u-boot

Drop convenience hack that sets default value of $fdtfile on visionfive2
target(s). This is not needed since the JH7110 OF_UPSTREAM migration and is
anyways a duplication of code from SPL that adds friction to maintenance or
adding new variant visionfive2 targets.

If it is still desirable to have default $fdtfile values based on
OF_UPSTREAM dtb filenames then this should be provided further up the code
path in an API and not by duplicating all board detection logic again from
SPL into the main payload.

Users who need to specify $fdtfile may still do so the normal way as
described in U-Boot documentation.

E Shattow (2):
  doc: board: starfive: Drop setting of $fdtfile
  board: starfive: visionfive2: Drop setting of $fdtfile

 .../visionfive2/starfive_visionfive2.c        | 61 -------------------
 doc/board/starfive/milk-v_mars.rst            | 18 ------
 doc/board/starfive/pine64_star64.rst          | 16 -----
 doc/board/starfive/visionfive2.rst            | 18 ------
 4 files changed, 113 deletions(-)


base-commit: cde0050618968aae335dfbc930641656d51ff5d0
-- 
2.49.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/2] doc: board: starfive: Drop setting of $fdtfile
  2025-04-22  6:45 [PATCH v1 0/2] jh7110: starfive: visionfive2 drop setting of $fdtfile E Shattow
@ 2025-04-22  6:45 ` E Shattow
  2025-04-22  6:45 ` [PATCH v1 2/2] board: starfive: visionfive2: " E Shattow
  1 sibling, 0 replies; 7+ messages in thread
From: E Shattow @ 2025-04-22  6:45 UTC (permalink / raw)
  To: Tom Rini, Minda Chen, Hal Feng, Heinrich Schuchardt, Simon Glass
  Cc: E Shattow, u-boot

Information about setting $fdtfile is covered by generic U-Boot docs. Drop
the redundant section.

Signed-off-by: E Shattow <e@freeshell.de>
---
 doc/board/starfive/milk-v_mars.rst   | 18 ------------------
 doc/board/starfive/pine64_star64.rst | 16 ----------------
 doc/board/starfive/visionfive2.rst   | 18 ------------------
 3 files changed, 52 deletions(-)

diff --git a/doc/board/starfive/milk-v_mars.rst b/doc/board/starfive/milk-v_mars.rst
index 554932ecfd4..9cfd5d7bddd 100644
--- a/doc/board/starfive/milk-v_mars.rst
+++ b/doc/board/starfive/milk-v_mars.rst
@@ -39,24 +39,6 @@ Now build the U-Boot SPL and U-Boot proper.
 This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well
 as the FIT image (u-boot.itb) with OpenSBI and U-Boot.
 
-Device-tree selection
-~~~~~~~~~~~~~~~~~~~~~
-
-Depending on the board version U-Boot set variable $fdtfile to either
-starfive/jh7110-starfive-visionfive-2-v1.2a.dtb or
-starfive/jh7110-starfive-visionfive-2-v1.3b.dtb.
-
-To overrule this selection the variable can be set manually and saved in the
-environment
-
-::
-
-    setenv fdtfile my_device-tree.dtb
-    env save
-
-or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to set to
-provide a default value.
-
 Boot source selection
 ~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/board/starfive/pine64_star64.rst b/doc/board/starfive/pine64_star64.rst
index 52e9a907917..1fdd1660a31 100644
--- a/doc/board/starfive/pine64_star64.rst
+++ b/doc/board/starfive/pine64_star64.rst
@@ -39,22 +39,6 @@ Now build the U-Boot SPL and U-Boot proper.
 This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well
 as the FIT image (u-boot.itb) with OpenSBI and U-Boot.
 
-Device-tree selection
-~~~~~~~~~~~~~~~~~~~~~
-
-U-Boot will set variable $fdtfile to starfive/jh7110-pine64-star64.dtb.
-
-To overrule this selection the variable can be set manually and saved in the
-environment
-
-::
-
-    env set fdtfile my_device-tree.dtb
-    env save
-
-or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to set to
-provide a default value.
-
 Boot source selection
 ~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/board/starfive/visionfive2.rst b/doc/board/starfive/visionfive2.rst
index 2c68df3ce4d..abda8ac21bc 100644
--- a/doc/board/starfive/visionfive2.rst
+++ b/doc/board/starfive/visionfive2.rst
@@ -71,24 +71,6 @@ Now build the U-Boot SPL and U-Boot proper
 This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well
 as the FIT image (u-boot.itb) with OpenSBI and U-Boot.
 
-Device-tree selection
-~~~~~~~~~~~~~~~~~~~~~
-
-Depending on the board version U-Boot set variable $fdtfile to either
-starfive/jh7110-starfive-visionfive-2-v1.2a.dtb or
-starfive/jh7110-starfive-visionfive-2-v1.3b.dtb.
-
-To overrule this selection the variable can be set manually and saved in the
-environment
-
-::
-
-    setenv fdtfile my_device-tree.dtb
-    env save
-
-or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to provide
-a default value.
-
 Flashing
 ~~~~~~~~
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/2] board: starfive: visionfive2: Drop setting of $fdtfile
  2025-04-22  6:45 [PATCH v1 0/2] jh7110: starfive: visionfive2 drop setting of $fdtfile E Shattow
  2025-04-22  6:45 ` [PATCH v1 1/2] doc: board: starfive: Drop " E Shattow
@ 2025-04-22  6:45 ` E Shattow
  2025-04-22  7:28   ` Heinrich Schuchardt
  2025-04-22 10:07   ` E Shattow
  1 sibling, 2 replies; 7+ messages in thread
From: E Shattow @ 2025-04-22  6:45 UTC (permalink / raw)
  To: Tom Rini, Minda Chen, Hal Feng, Heinrich Schuchardt, Simon Glass
  Cc: E Shattow, u-boot

Remove board detection logic from main payload that is duplicated from SPL
and do not set convenience data into $fdtfile environment variable. U-Boot
"starfive visionfive2" board target(s) now boot on recent upstream Linux
Kernel releases without this manipulation since the JH7110 OF_UPSTREAM
migration. Changes to $fdtfile by users (i.e. following newer or older Linux
Kernel releases) should follow the advice in general U-Boot documentation.

Signed-off-by: E Shattow <e@freeshell.de>
---
 .../visionfive2/starfive_visionfive2.c        | 61 -------------------
 1 file changed, 61 deletions(-)

diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
index b8cd509bc89..039a32f1874 100644
--- a/board/starfive/visionfive2/starfive_visionfive2.c
+++ b/board/starfive/visionfive2/starfive_visionfive2.c
@@ -17,14 +17,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 #define JH7110_L2_PREFETCHER_BASE_ADDR		0x2030000
 #define JH7110_L2_PREFETCHER_HART_OFFSET	0x2000
-#define FDTFILE_MILK_V_MARS \
-	"starfive/jh7110-milkv-mars.dtb"
-#define FDTFILE_VISIONFIVE2_1_2A \
-	"starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"
-#define FDTFILE_VISIONFIVE2_1_3B \
-	"starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"
-#define FDTFILE_PINE64_STAR64 \
-	"starfive/jh7110-pine64-star64.dtb"
 
 /* enable U74-mc hart1~hart4 prefetcher */
 static void enable_prefetcher(void)
@@ -45,51 +37,6 @@ static void enable_prefetcher(void)
 	}
 }
 
-/**
- * set_fdtfile() - set the $fdtfile variable based on the board revision
- */
-static void set_fdtfile(void)
-{
-	u8 version;
-	const char *fdtfile;
-	const char *product_id;
-
-	fdtfile = env_get("fdtfile");
-	if (fdtfile)
-		return;
-
-	product_id = get_product_id_from_eeprom();
-	if (!product_id) {
-		log_err("Can't read EEPROM\n");
-		return;
-	}
-	if (!strncmp(product_id, "MARS", 4)) {
-		fdtfile = FDTFILE_MILK_V_MARS;
-	} else if (!strncmp(product_id, "VF7110", 6)) {
-		version = get_pcb_revision_from_eeprom();
-
-		switch (version) {
-		case 'a':
-		case 'A':
-			fdtfile = FDTFILE_VISIONFIVE2_1_2A;
-			break;
-
-		case 'b':
-		case 'B':
-		default:
-			fdtfile = FDTFILE_VISIONFIVE2_1_3B;
-			break;
-		}
-	} else if (!strncmp(product_id, "STAR64", 6)) {
-		fdtfile = FDTFILE_PINE64_STAR64;
-	} else {
-		log_err("Unknown product\n");
-		return;
-	}
-
-	env_set("fdtfile", fdtfile);
-}
-
 int board_init(void)
 {
 	enable_caches();
@@ -98,14 +45,6 @@ int board_init(void)
 	return 0;
 }
 
-int board_late_init(void)
-{
-	if (CONFIG_IS_ENABLED(ID_EEPROM))
-		set_fdtfile();
-
-	return 0;
-}
-
 int board_fdt_blob_setup(void **fdtp)
 {
 	if (gd->arch.firmware_fdt_addr) {
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] board: starfive: visionfive2: Drop setting of $fdtfile
  2025-04-22  6:45 ` [PATCH v1 2/2] board: starfive: visionfive2: " E Shattow
@ 2025-04-22  7:28   ` Heinrich Schuchardt
  2025-04-22  9:50     ` E Shattow
  2025-04-22 10:07   ` E Shattow
  1 sibling, 1 reply; 7+ messages in thread
From: Heinrich Schuchardt @ 2025-04-22  7:28 UTC (permalink / raw)
  To: E Shattow, Tom Rini, Minda Chen, Hal Feng, Simon Glass; +Cc: u-boot

Am 22. April 2025 08:45:26 MESZ schrieb E Shattow <e@freeshell.de>:
>Remove board detection logic from main payload that is duplicated from SPL
>and do not set convenience data into $fdtfile environment variable. U-Boot
>"starfive visionfive2" board target(s) now boot on recent upstream Linux
>Kernel releases without this manipulation since the JH7110 OF_UPSTREAM
>migration. Changes to $fdtfile by users (i.e. following newer or older Linux
>Kernel releases) should follow the advice in general U-Boot documentation.

We cannot expect that users have a U-Boot installed in SPI flash that matches the Linux they intend to boot.

Linux is known to break device-tree compatibility between versions.

Without U-Boot providing a value of $fdtfile that matches the board, U-Boot will not pick up the device-tree on the ESP of Ubuntu's installer image which matches the kernel version.

Please, keep U-Boot providing a value of $fdtfile that matches the actual board.

It would be preferable if that name could be based on the choice of the configuration by SPL instead of duplicating the logic. But I am not aware of logic that provides the configuration name to main U-Boot. Maybe we should simply match the model or conpatible string.

Best regards

Heinrich 

>
>Signed-off-by: E Shattow <e@freeshell.de>
>---
> .../visionfive2/starfive_visionfive2.c        | 61 -------------------
> 1 file changed, 61 deletions(-)
>
>diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
>index b8cd509bc89..039a32f1874 100644
>--- a/board/starfive/visionfive2/starfive_visionfive2.c
>+++ b/board/starfive/visionfive2/starfive_visionfive2.c
>@@ -17,14 +17,6 @@
> DECLARE_GLOBAL_DATA_PTR;
> #define JH7110_L2_PREFETCHER_BASE_ADDR		0x2030000
> #define JH7110_L2_PREFETCHER_HART_OFFSET	0x2000
>-#define FDTFILE_MILK_V_MARS \
>-	"starfive/jh7110-milkv-mars.dtb"
>-#define FDTFILE_VISIONFIVE2_1_2A \
>-	"starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"
>-#define FDTFILE_VISIONFIVE2_1_3B \
>-	"starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"
>-#define FDTFILE_PINE64_STAR64 \
>-	"starfive/jh7110-pine64-star64.dtb"
> 
> /* enable U74-mc hart1~hart4 prefetcher */
> static void enable_prefetcher(void)
>@@ -45,51 +37,6 @@ static void enable_prefetcher(void)
> 	}
> }
> 
>-/**
>- * set_fdtfile() - set the $fdtfile variable based on the board revision
>- */
>-static void set_fdtfile(void)
>-{
>-	u8 version;
>-	const char *fdtfile;
>-	const char *product_id;
>-
>-	fdtfile = env_get("fdtfile");
>-	if (fdtfile)
>-		return;
>-
>-	product_id = get_product_id_from_eeprom();
>-	if (!product_id) {
>-		log_err("Can't read EEPROM\n");
>-		return;
>-	}
>-	if (!strncmp(product_id, "MARS", 4)) {
>-		fdtfile = FDTFILE_MILK_V_MARS;
>-	} else if (!strncmp(product_id, "VF7110", 6)) {
>-		version = get_pcb_revision_from_eeprom();
>-
>-		switch (version) {
>-		case 'a':
>-		case 'A':
>-			fdtfile = FDTFILE_VISIONFIVE2_1_2A;
>-			break;
>-
>-		case 'b':
>-		case 'B':
>-		default:
>-			fdtfile = FDTFILE_VISIONFIVE2_1_3B;
>-			break;
>-		}
>-	} else if (!strncmp(product_id, "STAR64", 6)) {
>-		fdtfile = FDTFILE_PINE64_STAR64;
>-	} else {
>-		log_err("Unknown product\n");
>-		return;
>-	}
>-
>-	env_set("fdtfile", fdtfile);
>-}
>-
> int board_init(void)
> {
> 	enable_caches();
>@@ -98,14 +45,6 @@ int board_init(void)
> 	return 0;
> }
> 
>-int board_late_init(void)
>-{
>-	if (CONFIG_IS_ENABLED(ID_EEPROM))
>-		set_fdtfile();
>-
>-	return 0;
>-}
>-
> int board_fdt_blob_setup(void **fdtp)
> {
> 	if (gd->arch.firmware_fdt_addr) {


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] board: starfive: visionfive2: Drop setting of $fdtfile
  2025-04-22  7:28   ` Heinrich Schuchardt
@ 2025-04-22  9:50     ` E Shattow
  0 siblings, 0 replies; 7+ messages in thread
From: E Shattow @ 2025-04-22  9:50 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini, Minda Chen, Hal Feng, Simon Glass; +Cc: u-boot

Hi,

On 4/22/25 00:28, Heinrich Schuchardt wrote:
> Am 22. April 2025 08:45:26 MESZ schrieb E Shattow <e@freeshell.de>:
>> Remove board detection logic from main payload that is duplicated from SPL
>> and do not set convenience data into $fdtfile environment variable. U-Boot
>> "starfive visionfive2" board target(s) now boot on recent upstream Linux
>> Kernel releases without this manipulation since the JH7110 OF_UPSTREAM
>> migration. Changes to $fdtfile by users (i.e. following newer or older Linux
>> Kernel releases) should follow the advice in general U-Boot documentation.
> 

> We cannot expect that users have a U-Boot installed in SPI flash that matches the Linux they intend to boot.

Yes, but we must. We cannot expect that EFI System Partition will
contain the correct single dtb compatible for many on-disk versions of
Linux Kernel that we have no possible way to know which one will be
booted. This is not any better... we're chasing a problem that is not in
our domain.

From the downstream userland there's limits to U-Boot EFI variable
writing (yes, still today? or has this changed) that prevent U-Boot from
being informed by Linux distro-managed installation about the correct
device-tree pairings for Linux Kernel boot entries that should be loaded.

If that (EFI variable writing) were usable then we don't have to do
anything in U-Boot since it's a userland issue of parsing the model and
figuring this out when updating EFI variables.

In case of non-EFI then we're still doing it wrong and also not
consistently over U-Boot boards that are OF_UPSTREAM;  there would be a
mess of `fdt print` parsing to try and implement it as a U-Boot
script... and I don't know of any userland boot menu updating tools that
try to parse out the dtb path from Fdt as of yet, at least not for the
jh7110 targets I am familiar with.

The strategy I like to think of here is to make this generic and
maintainable. Current approach to copy-paste detection logic duplicated
from each U-Boot board target SPL to main payload init logic... it
served some immediate needs to get riscv64 over the starting line with
Linux distros but it smells weird and should get cleaned out.

> 
> Linux is known to break device-tree compatibility between versions.

U-Boot releases from before JH7110 OF_UPSTREAM migration would just do
wrong things because its internal Fdt was not consistent with any
release version of Linux Kernel. Now since OF_UPSTREAM it is consistent
with some known release version of upstream Linux Kernel. You can say
now with certainty that U-Boot release 'x' will work with Linux Kernel
version 'y' and intermediary boot loader versions (i.e. GRUB).

> 
> Without U-Boot providing a value of $fdtfile that matches the board, U-Boot will not pick up the device-tree on the ESP of Ubuntu's installer image which matches the kernel version.

Meanwhile, require a certain release version of U-Boot for a given
release of the (distro) installer, and then (distro) fixes userspace to
do something more robust. If making EFI variable setting outside of
U-Boot work properly is not feasible, and you must keep fdtfile var
setting, then on to your next point that it should be *consistent* and
general, applying to all OF_UPSTREAM board targets across U-Boot.

> 
> Please, keep U-Boot providing a value of $fdtfile that matches the actual board.
> 
> It would be preferable if that name could be based on the choice of the configuration by SPL instead of duplicating the logic. But I am not aware of logic that provides the configuration name to main U-Boot. Maybe we should simply match the model or conpatible string.
> 

Yes, Heinrich. For Simon, do you have any thoughts on this? The question
is broadly: we have this callback at SPL phase that selects for dtb from
multi fit and how can we bring some information of that outcome (namely
the dtb pathname) forward to the U-Boot main payload?

Is this to be a new (or existing? fdt print?) scripting command that
emits such info? An immutable env variable (such that i.e. `env set
fdtfile ${ofmake}/${ofmodel}.dtb` is valid for pre-boot) ?

-E

> Best regards
> 
> Heinrich 
> 
>>
>> Signed-off-by: E Shattow <e@freeshell.de>
>> ---
>> .../visionfive2/starfive_visionfive2.c        | 61 -------------------
>> 1 file changed, 61 deletions(-)
>>
>> diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
>> index b8cd509bc89..039a32f1874 100644
>> --- a/board/starfive/visionfive2/starfive_visionfive2.c
>> +++ b/board/starfive/visionfive2/starfive_visionfive2.c
>> @@ -17,14 +17,6 @@
>> DECLARE_GLOBAL_DATA_PTR;
>> #define JH7110_L2_PREFETCHER_BASE_ADDR		0x2030000
>> #define JH7110_L2_PREFETCHER_HART_OFFSET	0x2000
>> -#define FDTFILE_MILK_V_MARS \
>> -	"starfive/jh7110-milkv-mars.dtb"
>> -#define FDTFILE_VISIONFIVE2_1_2A \
>> -	"starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"
>> -#define FDTFILE_VISIONFIVE2_1_3B \
>> -	"starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"
>> -#define FDTFILE_PINE64_STAR64 \
>> -	"starfive/jh7110-pine64-star64.dtb"
>>
>> /* enable U74-mc hart1~hart4 prefetcher */
>> static void enable_prefetcher(void)
>> @@ -45,51 +37,6 @@ static void enable_prefetcher(void)
>> 	}
>> }
>>
>> -/**
>> - * set_fdtfile() - set the $fdtfile variable based on the board revision
>> - */
>> -static void set_fdtfile(void)
>> -{
>> -	u8 version;
>> -	const char *fdtfile;
>> -	const char *product_id;
>> -
>> -	fdtfile = env_get("fdtfile");
>> -	if (fdtfile)
>> -		return;
>> -
>> -	product_id = get_product_id_from_eeprom();
>> -	if (!product_id) {
>> -		log_err("Can't read EEPROM\n");
>> -		return;
>> -	}
>> -	if (!strncmp(product_id, "MARS", 4)) {
>> -		fdtfile = FDTFILE_MILK_V_MARS;
>> -	} else if (!strncmp(product_id, "VF7110", 6)) {
>> -		version = get_pcb_revision_from_eeprom();
>> -
>> -		switch (version) {
>> -		case 'a':
>> -		case 'A':
>> -			fdtfile = FDTFILE_VISIONFIVE2_1_2A;
>> -			break;
>> -
>> -		case 'b':
>> -		case 'B':
>> -		default:
>> -			fdtfile = FDTFILE_VISIONFIVE2_1_3B;
>> -			break;
>> -		}
>> -	} else if (!strncmp(product_id, "STAR64", 6)) {
>> -		fdtfile = FDTFILE_PINE64_STAR64;
>> -	} else {
>> -		log_err("Unknown product\n");
>> -		return;
>> -	}
>> -
>> -	env_set("fdtfile", fdtfile);
>> -}
>> -
>> int board_init(void)
>> {
>> 	enable_caches();
>> @@ -98,14 +45,6 @@ int board_init(void)
>> 	return 0;
>> }
>>
>> -int board_late_init(void)
>> -{
>> -	if (CONFIG_IS_ENABLED(ID_EEPROM))
>> -		set_fdtfile();
>> -
>> -	return 0;
>> -}
>> -
>> int board_fdt_blob_setup(void **fdtp)
>> {
>> 	if (gd->arch.firmware_fdt_addr) {
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] board: starfive: visionfive2: Drop setting of $fdtfile
  2025-04-22  6:45 ` [PATCH v1 2/2] board: starfive: visionfive2: " E Shattow
  2025-04-22  7:28   ` Heinrich Schuchardt
@ 2025-04-22 10:07   ` E Shattow
  2025-04-22 15:17     ` Samuel Holland
  1 sibling, 1 reply; 7+ messages in thread
From: E Shattow @ 2025-04-22 10:07 UTC (permalink / raw)
  To: Tom Rini, Minda Chen, Hal Feng, Heinrich Schuchardt, Simon Glass; +Cc: u-boot

Oops should have compiled before sending.

On 4/21/25 23:45, E Shattow wrote:
> Remove board detection logic from main payload that is duplicated from SPL
> and do not set convenience data into $fdtfile environment variable. U-Boot
> "starfive visionfive2" board target(s) now boot on recent upstream Linux
> Kernel releases without this manipulation since the JH7110 OF_UPSTREAM
> migration. Changes to $fdtfile by users (i.e. following newer or older Linux
> Kernel releases) should follow the advice in general U-Boot documentation.
> 
> Signed-off-by: E Shattow <e@freeshell.de>
> ---
>  .../visionfive2/starfive_visionfive2.c        | 61 -------------------
>  1 file changed, 61 deletions(-)
> 
> diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
> index b8cd509bc89..039a32f1874 100644
> --- a/board/starfive/visionfive2/starfive_visionfive2.c
> +++ b/board/starfive/visionfive2/starfive_visionfive2.c
> @@ -17,14 +17,6 @@
>  DECLARE_GLOBAL_DATA_PTR;
>  #define JH7110_L2_PREFETCHER_BASE_ADDR		0x2030000
>  #define JH7110_L2_PREFETCHER_HART_OFFSET	0x2000
> -#define FDTFILE_MILK_V_MARS \
> -	"starfive/jh7110-milkv-mars.dtb"
> -#define FDTFILE_VISIONFIVE2_1_2A \
> -	"starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"
> -#define FDTFILE_VISIONFIVE2_1_3B \
> -	"starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"
> -#define FDTFILE_PINE64_STAR64 \
> -	"starfive/jh7110-pine64-star64.dtb"
>  
>  /* enable U74-mc hart1~hart4 prefetcher */
>  static void enable_prefetcher(void)
> @@ -45,51 +37,6 @@ static void enable_prefetcher(void)
>  	}
>  }
>  
> -/**
> - * set_fdtfile() - set the $fdtfile variable based on the board revision
> - */
> -static void set_fdtfile(void)
> -{
> -	u8 version;
> -	const char *fdtfile;
> -	const char *product_id;
> -
> -	fdtfile = env_get("fdtfile");
> -	if (fdtfile)
> -		return;
> -
> -	product_id = get_product_id_from_eeprom();
> -	if (!product_id) {
> -		log_err("Can't read EEPROM\n");
> -		return;
> -	}
> -	if (!strncmp(product_id, "MARS", 4)) {
> -		fdtfile = FDTFILE_MILK_V_MARS;
> -	} else if (!strncmp(product_id, "VF7110", 6)) {
> -		version = get_pcb_revision_from_eeprom();
> -
> -		switch (version) {
> -		case 'a':
> -		case 'A':
> -			fdtfile = FDTFILE_VISIONFIVE2_1_2A;
> -			break;
> -
> -		case 'b':
> -		case 'B':
> -		default:
> -			fdtfile = FDTFILE_VISIONFIVE2_1_3B;
> -			break;
> -		}
> -	} else if (!strncmp(product_id, "STAR64", 6)) {
> -		fdtfile = FDTFILE_PINE64_STAR64;
> -	} else {
> -		log_err("Unknown product\n");
> -		return;
> -	}
> -
> -	env_set("fdtfile", fdtfile);
> -}
> -
>  int board_init(void)
>  {
>  	enable_caches();
> @@ -98,14 +45,6 @@ int board_init(void)
>  	return 0;
>  }
>  

> -int board_late_init(void)
> -{
> -	if (CONFIG_IS_ENABLED(ID_EEPROM))
> -		set_fdtfile();
> -
> -	return 0;
> -}
> -


Need to keep board_late_init() or compile fails. Will fix in v2.

>  int board_fdt_blob_setup(void **fdtp)
>  {
>  	if (gd->arch.firmware_fdt_addr) {

-E

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] board: starfive: visionfive2: Drop setting of $fdtfile
  2025-04-22 10:07   ` E Shattow
@ 2025-04-22 15:17     ` Samuel Holland
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Holland @ 2025-04-22 15:17 UTC (permalink / raw)
  To: E Shattow
  Cc: u-boot, Tom Rini, Minda Chen, Hal Feng, Heinrich Schuchardt,
	Simon Glass

Hi,

On 2025-04-22 5:07 AM, E Shattow wrote:
> Oops should have compiled before sending.
> 
> On 4/21/25 23:45, E Shattow wrote:
>> Remove board detection logic from main payload that is duplicated from SPL
>> and do not set convenience data into $fdtfile environment variable. U-Boot
>> "starfive visionfive2" board target(s) now boot on recent upstream Linux
>> Kernel releases without this manipulation since the JH7110 OF_UPSTREAM
>> migration. Changes to $fdtfile by users (i.e. following newer or older Linux
>> Kernel releases) should follow the advice in general U-Boot documentation.
>>
>> Signed-off-by: E Shattow <e@freeshell.de>
>> ---
>>  .../visionfive2/starfive_visionfive2.c        | 61 -------------------
>>  1 file changed, 61 deletions(-)
>>
>> diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
>> index b8cd509bc89..039a32f1874 100644
>> --- a/board/starfive/visionfive2/starfive_visionfive2.c
>> +++ b/board/starfive/visionfive2/starfive_visionfive2.c
>> @@ -17,14 +17,6 @@
>>  DECLARE_GLOBAL_DATA_PTR;
>>  #define JH7110_L2_PREFETCHER_BASE_ADDR		0x2030000
>>  #define JH7110_L2_PREFETCHER_HART_OFFSET	0x2000
>> -#define FDTFILE_MILK_V_MARS \
>> -	"starfive/jh7110-milkv-mars.dtb"
>> -#define FDTFILE_VISIONFIVE2_1_2A \
>> -	"starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"
>> -#define FDTFILE_VISIONFIVE2_1_3B \
>> -	"starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"
>> -#define FDTFILE_PINE64_STAR64 \
>> -	"starfive/jh7110-pine64-star64.dtb"
>>  
>>  /* enable U74-mc hart1~hart4 prefetcher */
>>  static void enable_prefetcher(void)
>> @@ -45,51 +37,6 @@ static void enable_prefetcher(void)
>>  	}
>>  }
>>  
>> -/**
>> - * set_fdtfile() - set the $fdtfile variable based on the board revision
>> - */
>> -static void set_fdtfile(void)
>> -{
>> -	u8 version;
>> -	const char *fdtfile;
>> -	const char *product_id;
>> -
>> -	fdtfile = env_get("fdtfile");
>> -	if (fdtfile)
>> -		return;
>> -
>> -	product_id = get_product_id_from_eeprom();
>> -	if (!product_id) {
>> -		log_err("Can't read EEPROM\n");
>> -		return;
>> -	}
>> -	if (!strncmp(product_id, "MARS", 4)) {
>> -		fdtfile = FDTFILE_MILK_V_MARS;
>> -	} else if (!strncmp(product_id, "VF7110", 6)) {
>> -		version = get_pcb_revision_from_eeprom();
>> -
>> -		switch (version) {
>> -		case 'a':
>> -		case 'A':
>> -			fdtfile = FDTFILE_VISIONFIVE2_1_2A;
>> -			break;
>> -
>> -		case 'b':
>> -		case 'B':
>> -		default:
>> -			fdtfile = FDTFILE_VISIONFIVE2_1_3B;
>> -			break;
>> -		}
>> -	} else if (!strncmp(product_id, "STAR64", 6)) {
>> -		fdtfile = FDTFILE_PINE64_STAR64;
>> -	} else {
>> -		log_err("Unknown product\n");
>> -		return;
>> -	}
>> -
>> -	env_set("fdtfile", fdtfile);
>> -}
>> -
>>  int board_init(void)
>>  {
>>  	enable_caches();
>> @@ -98,14 +45,6 @@ int board_init(void)
>>  	return 0;
>>  }
>>  
> 
>> -int board_late_init(void)
>> -{
>> -	if (CONFIG_IS_ENABLED(ID_EEPROM))
>> -		set_fdtfile();
>> -
>> -	return 0;
>> -}
>> -
> 
> 
> Need to keep board_late_init() or compile fails. Will fix in v2.

Alternatively you can drop the "select BOARD_LATE_INIT" from arch/riscv/Kconfig.

Regards,
Samuel

>>  int board_fdt_blob_setup(void **fdtp)
>>  {
>>  	if (gd->arch.firmware_fdt_addr) {
> 
> -E


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-22 15:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22  6:45 [PATCH v1 0/2] jh7110: starfive: visionfive2 drop setting of $fdtfile E Shattow
2025-04-22  6:45 ` [PATCH v1 1/2] doc: board: starfive: Drop " E Shattow
2025-04-22  6:45 ` [PATCH v1 2/2] board: starfive: visionfive2: " E Shattow
2025-04-22  7:28   ` Heinrich Schuchardt
2025-04-22  9:50     ` E Shattow
2025-04-22 10:07   ` E Shattow
2025-04-22 15:17     ` Samuel Holland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox