[U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan

patrice.chotard at st.com patrice.chotard at st.com
Mon Jul 31 15:12:20 UTC 2017


From: Patrice Chotard <patrice.chotard at st.com>

Currently, all fixed-clock declared in "clocks" node in device tree
can be binded by clk_fixed_rate.c driver only if the "simple-bus"
compatible string is set inside "clocks" node.
This constraint has been invoked here [1].

This patch offers a solution to avoid adding "simple-bus" compatible
string to "clocks" node.

[1] https://patchwork.ozlabs.org/patch/558837/

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
---
 drivers/core/root.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index d691d6f..f285df8 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -312,6 +312,12 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
 #endif
 	return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
 }
+#else
+static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
+			    int offset, bool pre_reloc_only)
+{
+	return 0;
+}
 #endif
 
 __weak int dm_scan_other(bool pre_reloc_only)
@@ -322,6 +328,7 @@ __weak int dm_scan_other(bool pre_reloc_only)
 int dm_init_and_scan(bool pre_reloc_only)
 {
 	int ret;
+	int node;
 
 	ret = dm_init(IS_ENABLED(CONFIG_OF_LIVE));
 	if (ret) {
@@ -340,6 +347,12 @@ int dm_init_and_scan(bool pre_reloc_only)
 			debug("dm_scan_fdt() failed: %d\n", ret);
 			return ret;
 		}
+
+		/* bind fixed-clock */
+		node = fdt_path_offset(gd->fdt_blob, "/clocks");
+		if (node >= 0)
+			dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
+					 pre_reloc_only);
 	}
 
 	ret = dm_scan_other(pre_reloc_only);
-- 
1.9.1



More information about the U-Boot mailing list