* [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision
@ 2023-09-11 15:32 Jami Kettunen
2023-09-11 15:32 ` [PATCH RFC 1/2] " Jami Kettunen
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Jami Kettunen @ 2023-09-11 15:32 UTC (permalink / raw)
To: u-boot
Cc: Mason Huo, Minda Chen, Yanhong Wang, Shengyu Qu, Jami Kettunen,
Jami Kettunen
From: Jami Kettunen <jami.kettunen@protonmail.com>
Currently booting a mainline Linux kernel via extlinux with fdtdir set
doesn't load a proper DTB but passes on the U-Boot one to the kernel
which as far as I know is very incorrect and prevents user (normally
distro) provided DTB usage in a sensible/generic way.
A uEnv.txt or similar manual environment changes were not used and
should not be required to boot the board as per:
https://u-boot.readthedocs.io/en/latest/develop/distro.html
This also currently needs a kernel patch[1] for my board to have the
full 8GB of memory available to Linux instead of just 4GB it shows with
these patches alone.
[1] https://gitlab.alpinelinux.org/nmeum/alpine-visionfive/-/blob/main/starfive/linux-starfive/set-8GB-RAM.patch
Jami Kettunen (2):
board: visionfive2: Select fdtfile based on revision
configs: visionfive2: Enable MISC_INIT_R
.../visionfive2/starfive_visionfive2.c | 25 +++++++++++++++++++
configs/starfive_visionfive2_defconfig | 1 +
2 files changed, 26 insertions(+)
--
2.42.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH RFC 1/2] board: visionfive2: Select fdtfile based on revision
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
2023-09-12 8:26 ` Milan P. Stanić
2023-09-11 15:32 ` [PATCH RFC 2/2] configs: visionfive2: Enable MISC_INIT_R Jami Kettunen
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Jami Kettunen @ 2023-09-11 15:32 UTC (permalink / raw)
To: u-boot
Cc: Mason Huo, Minda Chen, Yanhong Wang, Shengyu Qu, Jami Kettunen,
Jami Kettunen
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH RFC 2/2] configs: visionfive2: Enable MISC_INIT_R
2023-09-11 15:32 [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision Jami Kettunen
2023-09-11 15:32 ` [PATCH RFC 1/2] " Jami Kettunen
@ 2023-09-11 15:32 ` 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
3 siblings, 1 reply; 7+ messages in thread
From: Jami Kettunen @ 2023-09-11 15:32 UTC (permalink / raw)
To: u-boot
Cc: Mason Huo, Minda Chen, Yanhong Wang, Shengyu Qu, Jami Kettunen,
Jami Kettunen
From: Jami Kettunen <jami.kettunen@protonmail.com>
Used to select mainline kernel fdtfile based on board revision.
Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
---
configs/starfive_visionfive2_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index e9b63e5b84..33f9ec8ad6 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -125,3 +125,4 @@ CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PCI=y
CONFIG_USB_KEYBOARD=y
+CONFIG_MISC_INIT_R=y
--
2.42.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision
2023-09-11 15:32 [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision Jami Kettunen
2023-09-11 15:32 ` [PATCH RFC 1/2] " Jami Kettunen
2023-09-11 15:32 ` [PATCH RFC 2/2] configs: visionfive2: Enable MISC_INIT_R Jami Kettunen
@ 2023-09-12 3:59 ` Shengyu Qu
2023-09-14 16:48 ` Shengyu Qu
3 siblings, 0 replies; 7+ messages in thread
From: Shengyu Qu @ 2023-09-12 3:59 UTC (permalink / raw)
To: Jami Kettunen, u-boot; +Cc: Mason Huo, Minda Chen, Yanhong Wang, Jami Kettunen
Hello Jami,
For DDR size problem, I think we could enable CONFIG_OF_BOARD_SETUP, then use ft_board_setup() to apply fdt_fixup_memory()? Just like what they did in spl.c: https://patchwork.ozlabs.org/project/uboot/patch/20230615093652.23161-12-yanhong.wang@starfivetech.com/
Best regards,
Shengyu
(This mail is sent twice because the first one didn't use reply all)
>From: Jami Kettunen <jami.kettunen@protonmail.com>
>
>Currently booting a mainline Linux kernel via extlinux with fdtdir set
>doesn't load a proper DTB but passes on the U-Boot one to the kernel
>which as far as I know is very incorrect and prevents user (normally
>distro) provided DTB usage in a sensible/generic way.
>
>A uEnv.txt or similar manual environment changes were not used and
>should not be required to boot the board as per:
>https://u-boot.readthedocs.io/en/latest/develop/distro.html
>
>This also currently needs a kernel patch[1] for my board to have the
>full 8GB of memory available to Linux instead of just 4GB it shows with
>these patches alone.
>
>[1] https://gitlab.alpinelinux.org/nmeum/alpine-visionfive/-/blob/main/starfive/linux-starfive/set-8GB-RAM.patch
>
>Jami Kettunen (2):
> board: visionfive2: Select fdtfile based on revision
> configs: visionfive2: Enable MISC_INIT_R
>
> .../visionfive2/starfive_visionfive2.c | 25 +++++++++++++++++++
> configs/starfive_visionfive2_defconfig | 1 +
> 2 files changed, 26 insertions(+)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 1/2] board: visionfive2: Select fdtfile based on revision
2023-09-11 15:32 ` [PATCH RFC 1/2] " Jami Kettunen
@ 2023-09-12 8:26 ` Milan P. Stanić
0 siblings, 0 replies; 7+ messages in thread
From: Milan P. Stanić @ 2023-09-12 8:26 UTC (permalink / raw)
To: Jami Kettunen
Cc: u-boot, Mason Huo, Minda Chen, Yanhong Wang, Shengyu Qu,
Jami Kettunen
On Mon, 2023-09-11 at 18:32, Jami Kettunen wrote:
> 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>
Tested-by: Milan P. Stanić <mps@arvanta.net>
> ---
> .../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;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 2/2] configs: visionfive2: Enable MISC_INIT_R
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ć
0 siblings, 0 replies; 7+ messages in thread
From: Milan P. Stanić @ 2023-09-12 8:26 UTC (permalink / raw)
To: Jami Kettunen
Cc: u-boot, Mason Huo, Minda Chen, Yanhong Wang, Shengyu Qu,
Jami Kettunen
On Mon, 2023-09-11 at 18:32, Jami Kettunen wrote:
> From: Jami Kettunen <jami.kettunen@protonmail.com>
>
> Used to select mainline kernel fdtfile based on board revision.
>
> Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
Tested-by: Milan P. Stanić <mps@arvanta.net>
> ---
> configs/starfive_visionfive2_defconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
> index e9b63e5b84..33f9ec8ad6 100644
> --- a/configs/starfive_visionfive2_defconfig
> +++ b/configs/starfive_visionfive2_defconfig
> @@ -125,3 +125,4 @@ CONFIG_USB=y
> CONFIG_USB_XHCI_HCD=y
> CONFIG_USB_XHCI_PCI=y
> CONFIG_USB_KEYBOARD=y
> +CONFIG_MISC_INIT_R=y
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision
2023-09-11 15:32 [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision Jami Kettunen
` (2 preceding siblings ...)
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
3 siblings, 0 replies; 7+ messages in thread
From: Shengyu Qu @ 2023-09-14 16:48 UTC (permalink / raw)
To: Jami Kettunen, u-boot
Cc: wiagn233, Mason Huo, Minda Chen, Yanhong Wang, Jami Kettunen
Hello Jami,
I made a fix for memory size problem based on your series, but I can't try
that because I'm using 4GB version. Could you test this?
https://github.com/Headcrabed/u-boot/tree/ddr_fix_v1
Best regards,
Shengyu
> From: Jami Kettunen <jami.kettunen@protonmail.com>
>
> Currently booting a mainline Linux kernel via extlinux with fdtdir set
> doesn't load a proper DTB but passes on the U-Boot one to the kernel
> which as far as I know is very incorrect and prevents user (normally
> distro) provided DTB usage in a sensible/generic way.
>
> A uEnv.txt or similar manual environment changes were not used and
> should not be required to boot the board as per:
> https://u-boot.readthedocs.io/en/latest/develop/distro.html
>
> This also currently needs a kernel patch[1] for my board to have the
> full 8GB of memory available to Linux instead of just 4GB it shows with
> these patches alone.
>
> [1] https://gitlab.alpinelinux.org/nmeum/alpine-visionfive/-/blob/main/starfive/linux-starfive/set-8GB-RAM.patch
>
> Jami Kettunen (2):
> board: visionfive2: Select fdtfile based on revision
> configs: visionfive2: Enable MISC_INIT_R
>
> .../visionfive2/starfive_visionfive2.c | 25 +++++++++++++++++++
> configs/starfive_visionfive2_defconfig | 1 +
> 2 files changed, 26 insertions(+)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-14 16:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-11 15:32 [PATCH RFC 0/2] board: visionfive2: Select fdtfile based on revision Jami Kettunen
2023-09-11 15:32 ` [PATCH RFC 1/2] " Jami Kettunen
2023-09-12 8:26 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox