1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
15 #include <virtio_types.h>
18 DECLARE_GLOBAL_DATA_PTR;
20 #if IS_ENABLED(CONFIG_MTD_NOR_FLASH)
21 int is_flash_available(void)
23 if (!ofnode_equal(ofnode_by_compatible(ofnode_null(), "cfi-flash"),
34 * Make sure virtio bus is enumerated so that peripherals
35 * on the virtio bus can be discovered by their drivers
42 int board_late_init(void)
48 chosen_node = ofnode_path("/chosen");
49 if (!ofnode_valid(chosen_node)) {
50 debug("No chosen node found, can't get kernel start address\n");
54 #ifdef CONFIG_ARCH_RV64I
55 ret = ofnode_read_u64(chosen_node, "riscv,kernel-start",
56 (u64 *)&kernel_start);
58 ret = ofnode_read_u32(chosen_node, "riscv,kernel-start",
59 (u32 *)&kernel_start);
62 debug("Can't find kernel start address in device tree\n");
66 env_set_hex("kernel_start", kernel_start);
72 u32 spl_boot_device(void)
74 /* RISC-V QEMU only supports RAM as SPL boot device */
75 return BOOT_DEVICE_RAM;
79 #ifdef CONFIG_SPL_LOAD_FIT
80 int board_fit_config_name_match(const char *name)
82 /* boot using first FIT config */
87 void *board_fdt_blob_setup(int *err)
90 /* Stored the DTB address there during our init */
91 return (void *)(ulong)gd->arch.firmware_fdt_addr;