board: visionfive2: Select fdtfile based on revision
cover board: visionfive2: Select fdtfile based on revision
From: Jami Kettunen <[email protected]>
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.
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(+)
Signature · 1 line
2.42.0
RFC PATCH 1/2 board: visionfive2: Select fdtfile based on revision
From: Jami Kettunen <[email protected]>
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
--- .../visionfive2/starfive_visionfive2.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
board/starfive/visionfive2/starfive_visionfive2.c +25 -0
@@ -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 ;
Signature · 1 line
2.42.0
Quoted 6 lines · Jami Kettunen
From: Jami Kettunen <[email protected]>
Linux mainline kernel device tree files[1] are named:
- jh7110-starfive-visionfive-2-v1.2a
- jh7110-starfive-visionfive-2-v1.3b
Quoted 6 lines
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 <[email protected]>
Quoted 47 lines
--- .../visionfive2/starfive_visionfive2.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)board/starfive/visionfive2/starfive_visionfive2.c +25
-0@@ -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 ;
RFC PATCH 2/2 configs: visionfive2: Enable MISC_INIT_R
In reply to Jami KettunenFrom: Jami Kettunen <[email protected]>
Used to select mainline kernel fdtfile based on board revision.
--- configs/starfive_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/starfive_visionfive2_defconfig +1 -0
@@ -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
Signature · 1 line
2.42.0
Re: [PATCH RFC 2/2] configs: visionfive2: Enable MISC_INIT_R
Quoted 5 lines · Jami Kettunen
From: Jami Kettunen <[email protected]>
Used to select mainline kernel fdtfile based on board revision.
Signed-off-by Jami Kettunen <[email protected]>
Quoted 13 lines
--- configs/starfive_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+)configs/starfive_visionfive2_defconfig +1
-0@@ -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
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/[email protected]/
Best regards,
Shengyu
(This mail is sent twice because the first one didn't use reply all)
Quoted 25 lines
From: Jami Kettunen <[email protected]>
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.htmlThis 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.
Jami Kettunen (2):
board: visionfive2: Select fdtfile based on revision
configs: visionfive2: EnableMISC_INIT_R
.../visionfive2/starfive_visionfive2.c| 25 +++++++++++++++++++
configs/starfive_visionfive2_defconfig | 1 +2 files changed, 26 insertions(+)
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
Quoted 25 lines
From: Jami Kettunen <[email protected]>
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.htmlThis 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.
Jami Kettunen (2):
board: visionfive2: Select fdtfile based on revision
configs: visionfive2: EnableMISC_INIT_R.../visionfive2/starfive_visionfive2.c | 25 +++++++++++++++++++ configs/starfive_visionfive2_defconfig | 1 + 2 files changed, 26 insertions(+)