mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] ARM: stm32mp: lxa-mc1: break reg_3v3 dependency on PMIC
Date: Fri, 24 Apr 2020 18:01:10 +0200	[thread overview]
Message-ID: <20200424160111.10532-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200424160111.10532-1-a.fatoum@pengutronix.de>

While the regulator is indeed powered by the PMIC, basically the whole
system is, and it's always on. Linux doesn't handle this specially
however and will defer SDMMC probe till after the PMIC is probed costing
us some valuable boot time. Fix this up.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/lxa-mc1/board.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
index d36924fc2793..7f1f3ccd7e06 100644
--- a/arch/arm/boards/lxa-mc1/board.c
+++ b/arch/arm/boards/lxa-mc1/board.c
@@ -5,6 +5,28 @@
 #include <asm/memory.h>
 #include <mach/bbu.h>
 #include <bootsource.h>
+#include <of.h>
+
+static int of_fixup_regulator_supply_disable(struct device_node *root, void *path)
+{
+	struct device_node *node;
+	struct property *prop;
+
+	node = of_find_node_by_path_from(root, path);
+	if (!node) {
+		pr_warn("fixup for %s failed: not found\n", (const char *)path);
+		return -ENOENT;
+	}
+
+	if (!of_property_read_bool(node, "regulator-always-on"))
+		return 0;
+
+	prop = of_find_property(node, "vin-supply", NULL);
+	if (prop)
+		of_delete_property(prop);
+
+	return 0;
+}
 
 static int mc1_device_init(void)
 {
@@ -26,6 +48,11 @@ static int mc1_device_init(void)
 
 	barebox_set_hostname("lxa-mc1");
 
-	return 0;
+	/* The regulator is powered by the PMIC, but is always on as far as
+	 * software is concerned. Break the reference to the PMIC, so the OS
+	 * doesn't need to defer SDMMC/Ethernet peripherals till after the PMIC
+	 * is up.
+	 */
+	return of_register_fixup(of_fixup_regulator_supply_disable, "/regulator_3v3");
 }
 device_initcall(mc1_device_init);
-- 
2.26.1


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

  reply	other threads:[~2020-04-24 16:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 16:01 [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Ahmad Fatoum
2020-04-24 16:01 ` Ahmad Fatoum [this message]
2020-04-27  7:45   ` [PATCH] fixup! " Ahmad Fatoum
2020-04-28  7:47     ` Sascha Hauer
2020-04-24 16:01 ` [PATCH 3/3] ARM: stm32mp: expand stm32mp_defconfig for new drivers and board Ahmad Fatoum
2020-04-27  7:32 ` [PATCH 1/3] ARM: stm32mp: add Linux Automation MC-1 support Sascha Hauer
2020-04-27  7:37   ` Ahmad Fatoum
2020-04-27  7:38     ` 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=20200424160111.10532-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@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