summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2017-10-12 12:26:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-10-17 08:46:08 +0200
commita5eb6e506296c76f571492752e807b18f3bf77f7 (patch)
tree45a212092a8898cce9559bbc1194f993306dfbf3 /arch
parent2aec5f446763fe9075a9625f8197efdd19f9d7f3 (diff)
downloadbarebox-a5eb6e506296c76f571492752e807b18f3bf77f7.tar.gz
barebox-a5eb6e506296c76f571492752e807b18f3bf77f7.tar.xz
ARM: vexpress: add fixup handler for 'virtio, mmio' devices
Qemu adds 'virtio,mmio' nodes to the device tree. Before passing it to the bootloader or the Linux kernel. This fixup handler copies these nodes to the new device tree. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/vexpress/init.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/boards/vexpress/init.c b/arch/arm/boards/vexpress/init.c
index 1bbc8c3476..946385393f 100644
--- a/arch/arm/boards/vexpress/init.c
+++ b/arch/arm/boards/vexpress/init.c
@@ -45,3 +45,32 @@ static int vexpress_core_init(void)
return 0;
}
postcore_initcall(vexpress_core_init);
+
+static int of_fixup_virtio_mmio(struct device_node *root, void *unused)
+{
+ struct device_node *barebox_root, *np, *parent;
+
+ barebox_root = of_get_root_node();
+ if (root == barebox_root)
+ return 0;
+
+ for_each_compatible_node_from(np, barebox_root, NULL, "virtio,mmio") {
+ if (of_get_parent(np) == barebox_root)
+ parent = root;
+ else
+ parent = of_find_node_by_path_from(root,
+ of_get_parent(np)->full_name);
+ if (!parent)
+ return -EINVAL;
+
+ of_copy_node(parent, np);
+ }
+
+ return 0;
+}
+
+static int of_register_virtio_mmio_fixup(void)
+{
+ return of_register_fixup(of_fixup_virtio_mmio, NULL);
+}
+late_initcall(of_register_virtio_mmio_fixup);