mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/3] ARM: Phytec-phyCARD-imx27: switch to deep probe
Date: Tue, 28 May 2024 22:12:13 +0200	[thread overview]
Message-ID: <20240528201214.1467597-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240528201214.1467597-1-s.hauer@pengutronix.de>

Switch board to deep probe.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/phytec-phycard-imx27/pca100.c | 29 +++++++++++++++----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boards/phytec-phycard-imx27/pca100.c b/arch/arm/boards/phytec-phycard-imx27/pca100.c
index d3a5598e96..6a881498c2 100644
--- a/arch/arm/boards/phytec-phycard-imx27/pca100.c
+++ b/arch/arm/boards/phytec-phycard-imx27/pca100.c
@@ -45,7 +45,17 @@ static void pca100_usb_register(void) { };
 
 static void pca100_usb_init(void)
 {
+	struct device_node *gpio_np;
 	u32 reg;
+	int ret;
+
+	gpio_np = of_find_node_by_name_address(NULL, "gpio@10015100");
+	if (!gpio_np)
+		return;
+
+	ret = of_device_ensure_probed(gpio_np);
+	if (ret)
+		return;
 
 	reg = readl(MX27_USB_OTG_BASE_ADDR + 0x600);
 	reg &= ~((3 << 21) | 1);
@@ -75,7 +85,7 @@ static void pca100_usb_init(void)
 	gpio_direction_output(GPIO_PORTB + 24, 1);
 }
 
-static int pca100_devices_init(void)
+static int pca100_probe(struct device *dev)
 {
 	int i;
 	unsigned int mode[] = {
@@ -106,9 +116,6 @@ static int pca100_devices_init(void)
 		PE25_PF_USBOTG_DATA7,
 	};
 
-	if (!of_machine_is_compatible("phytec,imx27-pca100"))
-		return 0;
-
 	barebox_set_model("Phytec phyCARD-i.MX27");
 	barebox_set_hostname("phycard-imx27");
 
@@ -128,4 +135,16 @@ static int pca100_devices_init(void)
 	return 0;
 }
 
-device_initcall(pca100_devices_init);
+static const struct of_device_id pca100_of_match[] = {
+	{ .compatible = "phytec,imx27-pca100" },
+	{ /* Sentinel */},
+};
+
+static struct driver pca100_driver = {
+	.name = "phytec-imx27-pca100",
+	.probe = pca100_probe,
+	.of_compatible = pca100_of_match,
+};
+postcore_platform_driver(pca100_driver);
+
+BAREBOX_DEEP_PROBE_ENABLE(pca100_of_match);
-- 
2.39.2




  reply	other threads:[~2024-05-28 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 20:12 [PATCH 1/3] clk: imx27: sync with kernel Sascha Hauer
2024-05-28 20:12 ` Sascha Hauer [this message]
2024-05-28 20:12 ` [PATCH 3/3] ARM: Phytec-phyCARD-imx27: register USB from device tree Sascha Hauer
2024-06-10 13:23 ` [PATCH 1/3] clk: imx27: sync with kernel 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=20240528201214.1467597-2-s.hauer@pengutronix.de \
    --to=s.hauer@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