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.ysmal@stormshield.eu>
Obtained from: Stormshield
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10719
This commit is contained in:
zbb 2017-05-17 15:54:33 +00:00
parent b7d47a1821
commit ba51542898

View File

@ -2280,11 +2280,12 @@ win_cpu_from_dt(void)
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);