Commit e81c98649b7a67d43c5baae407430a242d3b26b9
Committed by
Simon Glass
1 parent
e11aa602ab
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
dm: core: add clocks node scan
Currently, all fixed-clock declared in "clocks" node in device tree can be binded by clk_fixed_rate.c driver only if each of them have the "simple-bus" compatible string. This constraint has been invoked here [1]. This patch offers a solution to avoid adding "simple-bus" compatible string to nodes that are not busses. [1] https://patchwork.ozlabs.org/patch/558837/ Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Showing 2 changed files with 46 additions and 2 deletions Side-by-side Diff
drivers/core/root.c
... | ... | @@ -312,8 +312,38 @@ |
312 | 312 | #endif |
313 | 313 | return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only); |
314 | 314 | } |
315 | +#else | |
316 | +static int dm_scan_fdt_node(struct udevice *parent, const void *blob, | |
317 | + int offset, bool pre_reloc_only) | |
318 | +{ | |
319 | + return 0; | |
320 | +} | |
315 | 321 | #endif |
316 | 322 | |
323 | +int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only) | |
324 | +{ | |
325 | + int node, ret; | |
326 | + | |
327 | + ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only); | |
328 | + if (ret) { | |
329 | + debug("dm_scan_fdt() failed: %d\n", ret); | |
330 | + return ret; | |
331 | + } | |
332 | + | |
333 | + /* bind fixed-clock */ | |
334 | + node = ofnode_to_offset(ofnode_path("/clocks")); | |
335 | + /* if no DT "clocks" node, no need to go further */ | |
336 | + if (node < 0) | |
337 | + return ret; | |
338 | + | |
339 | + ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node, | |
340 | + pre_reloc_only); | |
341 | + if (ret) | |
342 | + debug("dm_scan_fdt_node() failed: %d\n", ret); | |
343 | + | |
344 | + return ret; | |
345 | +} | |
346 | + | |
317 | 347 | __weak int dm_scan_other(bool pre_reloc_only) |
318 | 348 | { |
319 | 349 | return 0; |
320 | 350 | |
... | ... | @@ -335,9 +365,9 @@ |
335 | 365 | } |
336 | 366 | |
337 | 367 | if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { |
338 | - ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only); | |
368 | + ret = dm_extended_scan_fdt(gd->fdt_blob, pre_reloc_only); | |
339 | 369 | if (ret) { |
340 | - debug("dm_scan_fdt() failed: %d\n", ret); | |
370 | + debug("dm_extended_scan_dt() failed: %d\n", ret); | |
341 | 371 | return ret; |
342 | 372 | } |
343 | 373 | } |
include/dm/root.h
... | ... | @@ -56,6 +56,20 @@ |
56 | 56 | int dm_scan_fdt(const void *blob, bool pre_reloc_only); |
57 | 57 | |
58 | 58 | /** |
59 | + * dm_extended_scan_fdt() - Scan the device tree and bind drivers | |
60 | + * | |
61 | + * This calls dm_scna_dft() which scans the device tree and creates a driver | |
62 | + * for each node. the top-level subnodes are examined and also all sub-nodes | |
63 | + * of "clocks" node. | |
64 | + * | |
65 | + * @blob: Pointer to device tree blob | |
66 | + * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC | |
67 | + * flag. If false bind all drivers. | |
68 | + * @return 0 if OK, -ve on error | |
69 | + */ | |
70 | +int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only); | |
71 | + | |
72 | +/** | |
59 | 73 | * dm_scan_other() - Scan for other devices |
60 | 74 | * |
61 | 75 | * Some devices may not be visible to Driver Model. This weak function can |
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a
-
mentioned in commit ee730a