[PATCH 5/5] of: platform: Ensure timers are probed early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Timers are a very crucial resource and are needed early. Without them
no delay function can work properly. With deep probe enabled they may
be initialized very late in the initialization order. Make sure they
are probed early. We do not know which device node provides the timer,
so probe all nodes named "timer".

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/of/platform.c | 26 ++++++++++++++++++++++++++
 include/of.h          |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 4e96350ae2..e4e0b5dc40 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -529,6 +529,24 @@ int of_devices_ensure_probed_by_property(const char *property_name)
 }
 EXPORT_SYMBOL_GPL(of_devices_ensure_probed_by_property);
 
+int of_devices_ensure_probed_by_name(const char *name)
+{
+	struct device_node *node;
+	int err, ret = 0;
+
+	if (!deep_probe_is_supported())
+		return 0;
+
+	for_each_node_by_name(node, name) {
+		ret = of_device_ensure_probed(node);
+		if (err)
+			ret = err;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_devices_ensure_probed_by_name);
+
 static int of_stdoutpath_init(void)
 {
 	struct device_node *np;
@@ -545,3 +563,11 @@ static int of_stdoutpath_init(void)
 	return of_device_ensure_probed(np);
 }
 postconsole_initcall(of_stdoutpath_init);
+
+static int of_timer_init(void)
+{
+	of_devices_ensure_probed_by_name("timer");
+
+	return 0;
+}
+postcore_initcall(of_timer_init);
diff --git a/include/of.h b/include/of.h
index 9089409f9f..cf9950e9b3 100644
--- a/include/of.h
+++ b/include/of.h
@@ -287,6 +287,7 @@ extern struct device_d *of_device_enable_and_register_by_alias(
 extern int of_device_ensure_probed(struct device_node *np);
 extern int of_device_ensure_probed_by_alias(const char *alias);
 extern int of_devices_ensure_probed_by_property(const char *property_name);
+extern int of_devices_ensure_probed_by_name(const char *name);
 extern int of_devices_ensure_probed_by_dev_id(const struct of_device_id *ids);
 extern int of_partition_ensure_probed(struct device_node *np);
 
-- 
2.30.2


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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux