mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Subject: [PATCH 5/8] ARM: vexpress: convert to board driver
Date: Mon,  9 Nov 2020 14:44:27 +0100	[thread overview]
Message-ID: <20201109134430.21156-6-r.czerwinski@pengutronix.de> (raw)
In-Reply-To: <20201109134430.21156-1-r.czerwinski@pengutronix.de>

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 arch/arm/boards/vexpress/init.c | 69 +++++++++++++++++++--------------
 1 file 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);
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-11-09 13:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 13:44 [PATCH 0/8] QEMU virt machine support via mach-vexpress Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 1/8] ARM: MMU: add zero_page_{access,faulting} Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 2/8] mtd: cfi_flash: allow 0x0 mapping Rouven Czerwinski
2020-11-09 13:52   ` Lucas Stach
2020-11-10  6:33     ` Rouven Czerwinski
2020-11-10  7:48       ` Sascha Hauer
2020-11-10  9:15         ` Sascha Hauer
2020-11-10  9:36           ` Ahmad Fatoum
2020-11-10  9:43             ` Ahmad Fatoum
2020-11-12 10:06               ` Sascha Hauer
2020-11-12 10:09                 ` Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 3/8] amba: add *_amba_driver helper macros Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 4/8] ARM: vexpress: remove unused KConfig file Rouven Czerwinski
2020-11-09 13:44 ` Rouven Czerwinski [this message]
2020-11-09 13:44 ` [PATCH 6/8] ARM: vexpress: move Options to ARCH_VEXPRESS Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 7/8] ARM: qemu: add support for qemu virt platform Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 8/8] ARM: vexpress: enable VIRT board, MMU and cmds Rouven Czerwinski
2020-11-12 10:30 ` [PATCH 0/8] QEMU virt machine support via mach-vexpress Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201109134430.21156-6-r.czerwinski@pengutronix.de \
    --to=r.czerwinski@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox