device_tree: Add phandle caching and lookups

This patch caches phandles when unflattening the device tree, so we
don't have to look up the phandle property again every time we're trying
to find the phandle of a node. This is especially important when
supporting phandle lookups, which are also added. In addition we keep
track of the highest phandle in the whole tree, which will be important
for applying overlays later.

With this, dt_get_phandle(node) becomes obsolete because the phandle is
already available as a member variable in the node.

This patch was adapted from depthcharge's http://crosreview.com/1536385

Change-Id: I9cbd67d1d13e57c25d068b3db18bb75c709d7ebe
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32863
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/cavium/cn81xx/soc.c b/src/soc/cavium/cn81xx/soc.c
index 98166b0..0500749 100644
--- a/src/soc/cavium/cn81xx/soc.c
+++ b/src/soc/cavium/cn81xx/soc.c
@@ -234,7 +234,7 @@
 			continue;
 		}
 		/* Store the phandle */
-		phandle = dt_get_phandle(dt_node);
+		phandle = dt_node->phandle;
 		printk(BIOS_INFO, "%s: Removing node %s\n", __func__, path);
 		list_remove(&dt_node->list_node);