riscv: qemu: Create a simple-bus driver for the soc node
authorBin Meng <bmeng.cn@gmail.com>
Wed, 12 Dec 2018 14:12:25 +0000 (06:12 -0800)
committerAndes <uboot@andestech.com>
Tue, 18 Dec 2018 01:56:26 +0000 (09:56 +0800)
To enumerate devices on the /soc/ node, create a "simple-bus"
driver to match "riscv-virtio-soc".

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
arch/riscv/cpu/qemu/cpu.c

index 25d97d0b416d90f4ee63423a0f3115d6b9c4d85c..ad2950ce40ae7dbad48e2a4821c58b049752c13f 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 
 /*
  * cleanup_before_linux() is called just before we call linux
@@ -19,3 +20,16 @@ int cleanup_before_linux(void)
 
        return 0;
 }
+
+/* To enumerate devices on the /soc/ node, create a "simple-bus" driver */
+static const struct udevice_id riscv_virtio_soc_ids[] = {
+       { .compatible = "riscv-virtio-soc" },
+       { }
+};
+
+U_BOOT_DRIVER(riscv_virtio_soc) = {
+       .name = "riscv_virtio_soc",
+       .id = UCLASS_SIMPLE_BUS,
+       .of_match = riscv_virtio_soc_ids,
+       .flags = DM_FLAG_PRE_RELOC,
+};