From: Jami Kettunen <jamipkettunen@gmail.com>
To: u-boot@lists.denx.de
Cc: Mason Huo <mason.huo@starfivetech.com>,
Minda Chen <minda.chen@starfivetech.com>,
Yanhong Wang <yanhong.wang@starfivetech.com>,
Shengyu Qu <wiagn233@outlook.com>,
Jami Kettunen <jamipkettunen@gmail.com>,
Jami Kettunen <jami.kettunen@protonmail.com>
Subject: [PATCH RFC 1/2] board: visionfive2: Select fdtfile based on revision
Date: Mon, 11 Sep 2023 18:32:35 +0300 [thread overview]
Message-ID: <20230911153253.20701-2-jamipkettunen@gmail.com> (raw)
In-Reply-To: <20230911153253.20701-1-jamipkettunen@gmail.com>
From: Jami Kettunen <jami.kettunen@protonmail.com>
Linux mainline kernel device tree files[1] are named:
- jh7110-starfive-visionfive-2-v1.2a
- jh7110-starfive-visionfive-2-v1.3b
which should be selected accordingly by U-Boot to have a proper extlinux
experience with fdtdir set by the distribution.
[1] https://github.com/torvalds/linux/tree/master/arch/riscv/boot/dts/starfive
Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
---
.../visionfive2/starfive_visionfive2.c | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
index d609262b67..9244d4654b 100644
--- a/board/starfive/visionfive2/starfive_visionfive2.c
+++ b/board/starfive/visionfive2/starfive_visionfive2.c
@@ -10,6 +10,8 @@
#include <cpu_func.h>
#include <dm.h>
#include <linux/bitops.h>
+#include <asm/arch-jh7110/eeprom.h>
+#include <env.h>
#define JH7110_L2_PREFETCHER_BASE_ADDR 0x2030000
#define JH7110_L2_PREFETCHER_HART_OFFSET 0x2000
@@ -41,6 +43,29 @@ int board_init(void)
return 0;
}
+int misc_init_r(void)
+{
+ u8 rev;
+ const char *linux_dtb_file;
+
+ rev = get_pcb_revision_from_eeprom();
+ switch (rev) {
+ case 'a':
+ case 'A':
+ linux_dtb_file = "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb";
+ break;
+
+ case 'b':
+ case 'B':
+ default:
+ linux_dtb_file = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb";
+ break;
+ };
+
+ env_set("fdtfile", linux_dtb_file);
+ return 0;
+}
+
void *board_fdt_blob_setup(int *err)
{
*err = 0;
--
2.42.0
next prev parent reply other threads:[~2023-09-11 15:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-11 15:32 [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision Jami Kettunen
2023-09-11 15:32 ` Jami Kettunen [this message]
2023-09-12 8:26 ` [PATCH RFC 1/2] " Milan P. Stanić
2023-09-11 15:32 ` [PATCH RFC 2/2] configs: visionfive2: Enable MISC_INIT_R Jami Kettunen
2023-09-12 8:26 ` Milan P. Stanić
2023-09-12 3:59 ` [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision Shengyu Qu
2023-09-14 16:48 ` Shengyu Qu
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=20230911153253.20701-2-jamipkettunen@gmail.com \
--to=jamipkettunen@gmail.com \
--cc=jami.kettunen@protonmail.com \
--cc=mason.huo@starfivetech.com \
--cc=minda.chen@starfivetech.com \
--cc=u-boot@lists.denx.de \
--cc=wiagn233@outlook.com \
--cc=yanhong.wang@starfivetech.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox