Author: zbb
Date: Wed May 17 15:54:33 2017
New Revision: 318407
URL: https://svnweb.freebsd.org/changeset/base/318407

Log:
  Enable proper parsing of nested simlpe-buses on Marvell platforms
  
  OF_finddevice doesn't find the "simple-bus" node, which is problematic
  for Marvell platforms, using nested buses in Device Tree, like
  Armada 38x SoC.
  
  Submitted by: Arnaud Ysmal <arnaud.ys...@stormshield.eu>
  Obtained from: Stormshield
  Sponsored by: Stormshield
  Reviewed by: loos
  Differential revision: https://reviews.freebsd.org/D10719

Modified:
  head/sys/arm/mv/mv_common.c

Modified: head/sys/arm/mv/mv_common.c
==============================================================================
--- head/sys/arm/mv/mv_common.c Wed May 17 15:53:13 2017        (r318406)
+++ head/sys/arm/mv/mv_common.c Wed May 17 15:54:33 2017        (r318407)
@@ -2280,11 +2280,12 @@ moveon:
 static int
 fdt_win_setup(void)
 {
-       phandle_t node, child;
+       phandle_t node, child, sb;
        struct soc_node_spec *soc_node;
        u_long size, base;
        int err, i;
 
+       sb = 0;
        node = OF_finddevice("/");
        if (node == -1)
                panic("fdt_win_setup: no root node");
@@ -2326,7 +2327,7 @@ fdt_win_setup(void)
                 */
                child = OF_peer(child);
                if ((child == 0) && (node == OF_finddevice("/"))) {
-                       node = fdt_find_compatible(node, "simple-bus", 0);
+                       sb = node = fdt_find_compatible(node, "simple-bus", 0);
                        if (node == 0)
                                return (ENXIO);
                        child = OF_child(node);
@@ -2336,7 +2337,7 @@ fdt_win_setup(void)
                 * it is present) and its children. This node also have
                 * "simple-bus" compatible.
                 */
-               if ((child == 0) && (node == OF_finddevice("simple-bus"))) {
+               if ((child == 0) && (node == sb)) {
                        node = fdt_find_compatible(node, "simple-bus", 0);
                        if (node == 0)
                                return (0);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to