aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/devtree.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurentp@cse-semaphore.com>2008-04-10 17:03:04 +0200
committerKumar Gala <galak@kernel.crashing.org>2008-04-17 01:01:37 -0500
commitda0a5f0c65913e4ec0a70a5019ce0a7bcaab21c9 (patch)
tree6aab633690a25acaf46d61416cff6a808deaad8d /arch/powerpc/boot/devtree.c
parent[POWERPC] cpm_uart: Allocate DPRAM memory for SMC ports on CPM2-based platforms. (diff)
downloadlinux-dev-da0a5f0c65913e4ec0a70a5019ce0a7bcaab21c9.tar.xz
linux-dev-da0a5f0c65913e4ec0a70a5019ce0a7bcaab21c9.zip
[POWERPC] Add bootwrapper function to get virtual reg from the device tree.
This patch adds a new generic device tree processing function that retrieves virtual reg addresses from the device tree to the bootwrapper code. It also updates the bootwrapper code to use the new function. dt_get_virtual_reg() retrieves the virtual reg addresses from the "virtual-reg" property. If the property can't be found, it uses the "reg" property and walks the tree to translate it to absolute addresses. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/boot/devtree.c')
-rw-r--r--arch/powerpc/boot/devtree.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index 60f561e307a9..5d12336dc360 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -350,3 +350,23 @@ int dt_is_compatible(void *node, const char *compat)
return 0;
}
+
+int dt_get_virtual_reg(void *node, void **addr, int nres)
+{
+ unsigned long xaddr;
+ int n;
+
+ n = getprop(node, "virtual-reg", addr, nres * 4);
+ if (n > 0)
+ return n / 4;
+
+ for (n = 0; n < nres; n++) {
+ if (!dt_xlate_reg(node, n, &xaddr, NULL))
+ break;
+
+ addr[n] = (void *)xaddr;
+ }
+
+ return n;
+}
+