summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRouven Czerwinski <r.czerwinski@pengutronix.de>2020-11-09 14:44:27 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-12 11:28:20 +0100
commitdc5e67bee2cc4755994dd464a2b783524a6be468 (patch)
treecbdad915959a7a88b3f90974971d6ccc03929d7d /arch
parent2b0459b2d07e2553fbee8914144b22dcb07fd21f (diff)
downloadbarebox-dc5e67bee2cc4755994dd464a2b783524a6be468.tar.gz
barebox-dc5e67bee2cc4755994dd464a2b783524a6be468.tar.xz
ARM: vexpress: convert to board driver
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/vexpress/init.c69
1 files changed, 40 insertions, 29 deletions
diff --git a/arch/arm/boards/vexpress/init.c b/arch/arm/boards/vexpress/init.c
index 946385393f..6ba23bbb62 100644
--- a/arch/arm/boards/vexpress/init.c
+++ b/arch/arm/boards/vexpress/init.c
@@ -19,9 +19,33 @@
#define V2M_SYS_FLASH 0x03c
-static int vexpress_core_init(void)
+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 vexpress_probe(struct device_d *dev)
{
char *hostname = "vexpress-unknown";
+ int ret = 0;
if (amba_is_arm_sp804(IOMEM(0x10011000))) {
vexpress_a9_legacy_init();
@@ -42,35 +66,22 @@ static int vexpress_core_init(void)
barebox_set_hostname(hostname);
- 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;
+ ret = of_register_fixup(of_fixup_virtio_mmio, NULL);
- 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;
+ return ret;
+}
- of_copy_node(parent, np);
- }
+static const struct of_device_id vexpress_of_match[] = {
+ { .compatible = "arm,vexpress,v2p-ca9" },
+ { .compatible = "arm,vexpress,v2p-ca15" },
+ { .compatible = "arm,vexpress" },
+ { /* Sentinel */},
+};
- return 0;
-}
+static struct driver_d vexpress_board_driver = {
+ .name = "board-vexpress",
+ .probe = vexpress_probe,
+ .of_compatible = vexpress_of_match,
+};
-static int of_register_virtio_mmio_fixup(void)
-{
- return of_register_fixup(of_fixup_virtio_mmio, NULL);
-}
-late_initcall(of_register_virtio_mmio_fixup);
+postcore_platform_driver(vexpress_board_driver);