All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: Minda Chen <minda.chen@starfivetech.com>,
	Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>
Cc: Lukasz Tekieli <tekieli.lukasz@gmail.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Chanho Park <chanho61.park@samsung.com>,
	Shiji Yang <yangshiji66@outlook.com>,
	Shengyu Qu <wiagn233@outlook.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	E Shattow <lucent@gmail.com>,
	u-boot@lists.denx.de,
	Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Subject: [PATCH v2 1/6] riscv: do not set default fdt for VisionFive 2
Date: Thu, 21 Mar 2024 19:11:44 +0100	[thread overview]
Message-ID: <20240321181149.177356-2-heinrich.schuchardt@canonical.com> (raw)
In-Reply-To: <20240321181149.177356-1-heinrich.schuchardt@canonical.com>

Currently in set_fdtfile() we set the value of environment variable fdtfile
unconditionally. The implies that a value in the environment will be
ignored.

With the patch environment variable fdtfile will only be set if it does not
yet exist. This requires that CONFIG_DEFAULT_FDT_FILE is not set.

Now the user can either set and save fdtfile interactively or in the U-Boot
configuration to overrule the device-tree name chosen based on the
hardware in set_fdtfile().

Reported-by: E Shattow <lucent@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
v2:
	new patch
---
 .../visionfive2/starfive_visionfive2.c         |  4 ++++
 configs/starfive_visionfive2_defconfig         |  1 -
 doc/board/starfive/visionfive2.rst             | 18 ++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
index 78e118d5a05..76439179fa7 100644
--- a/board/starfive/visionfive2/starfive_visionfive2.c
+++ b/board/starfive/visionfive2/starfive_visionfive2.c
@@ -49,6 +49,10 @@ static void set_fdtfile(void)
 	u8 version;
 	const char *fdtfile;
 
+	fdtfile = env_get("fdtfile");
+	if (fdtfile)
+		return;
+
 	version = get_pcb_revision_from_eeprom();
 	switch (version) {
 	case 'a':
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index 7a3f1d4dbdf..fa80d489f5e 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -40,7 +40,6 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
-CONFIG_DEFAULT_FDT_FILE="starfive/jh7110-starfive-visionfive-2.dtb"
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
 CONFIG_DISPLAY_CPUINFO=y
diff --git a/doc/board/starfive/visionfive2.rst b/doc/board/starfive/visionfive2.rst
index abda8ac21bc..2e04c02dca5 100644
--- a/doc/board/starfive/visionfive2.rst
+++ b/doc/board/starfive/visionfive2.rst
@@ -71,6 +71,24 @@ Program the SD card
 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.
+
 Flashing
 ~~~~~~~~
 
-- 
2.43.0


  reply	other threads:[~2024-03-21 18:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 18:11 [PATCH v2 0/6] riscv: add support for Milk-V Mars board Heinrich Schuchardt
2024-03-21 18:11 ` Heinrich Schuchardt [this message]
2024-03-27  9:01   ` [PATCH v2 1/6] riscv: do not set default fdt for VisionFive 2 Leo Liang
2024-03-21 18:11 ` [PATCH v2 2/6] eeprom: starfive: function get_product_id_from_eeprom() Heinrich Schuchardt
2024-03-27  9:13   ` Leo Liang
2024-03-21 18:11 ` [PATCH v2 3/6] riscv: set fdtfile on Milk-V Mars Heinrich Schuchardt
2024-03-28  3:35   ` Leo Liang
2024-03-21 18:11 ` [PATCH v2 4/6] board: starfive: support Milk-V Mars board Heinrich Schuchardt
2024-03-24 15:00   ` Aurelien Jarno
2024-03-27 11:03     ` Heinrich Schuchardt
2024-03-28  6:24       ` Leo Liang
2024-03-28 16:01     ` Heinrich Schuchardt
2024-04-01 15:28       ` Aurelien Jarno
2024-04-01 15:54         ` Heinrich Schuchardt
2024-04-02  1:19           ` Minda Chen
2024-03-28  5:24   ` Leo Liang
2024-03-21 18:11 ` [PATCH v2 5/6] riscv: starfive: avoid including common.h Heinrich Schuchardt
2024-03-28  3:09   ` Leo Liang
2024-03-21 18:11 ` [PATCH v2 6/6] doc: describe Milk-V Mars board Heinrich Schuchardt
2024-03-25  3:10 ` 回复: [PATCH v2 0/6] riscv: add support for " Minda Chen

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=20240321181149.177356-2-heinrich.schuchardt@canonical.com \
    --to=heinrich.schuchardt@canonical.com \
    --cc=aurelien@aurel32.net \
    --cc=chanho61.park@samsung.com \
    --cc=lucent@gmail.com \
    --cc=minda.chen@starfivetech.com \
    --cc=rick@andestech.com \
    --cc=sw0312.kim@samsung.com \
    --cc=tekieli.lukasz@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=wiagn233@outlook.com \
    --cc=yangshiji66@outlook.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.