[PATCH RFC 1/2] board: visionfive2: Select fdtfile based on revision
Milan P. Stanić
mps at arvanta.net
Tue Sep 12 10:26:10 CEST 2023
On Mon, 2023-09-11 at 18:32, Jami Kettunen wrote:
> From: Jami Kettunen <jami.kettunen at 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 at protonmail.com>
Tested-by: Milan P. Stanić <mps at 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;
More information about the U-Boot
mailing list